Fix python-dev cflags and libs detection
authorJulien Kerihuel <j.kerihuel@openchange.org>
Thu, 15 Mar 2012 13:50:43 +0000 (13:50 +0000)
committerJulien Kerihuel <j.kerihuel@openchange.org>
Thu, 15 Mar 2012 13:50:43 +0000 (13:50 +0000)
Make it an openchange build system requirement

Makefile
config.mk.in
configure.ac

index ac1c2a32c9c0333ca85d314595b2f524e8f774e8..02057616450a55fab075261d97c77ce68b797d83 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -41,17 +41,6 @@ samba-git-update:
 # top level compilation rules
 #################################################################
 
-ifeq ($(PYTHON_CONFIG),)
-PYTHON_CFLAGS=$(shell $(PYTHON_CONFIG) --cflags)
-PYTHON_LIBS=$(shell $(PYTHON_CONFIG) --libs)
-else
-PYTHON_VERSION=$(shell $(PYTHON) -V 2>& 1 | awk '{ print $$2 }')
-PYTHON_MAJOR_VERSION=$(shell echo $(PYTHON_VERSION) | cut -d . -f 1)
-PYTHON_MINOR_VERSION=$(shell echo $(PYTHON_VERSION) | cut -d . -f 2)
-PYTHON_CFLAGS=-I/usr/include/python$(PYTHON_MAJOR_VERSION).$(PYTHON_MINOR_VERSION) -I/usr/include/python
-PYTHON_LIBS=-lpython$(PYTHON_MAJOR_VERSION).$(PYTHON_MINOR_VERSION)
-endif
-
 all:           $(OC_IDL)               \
                $(OC_LIBS)              \
                $(OC_TOOLS)             \
index 4b079a4a26fccf39db19ccc37d2da82462ec3085..6b25fe055d4e45ffcf00da533a0ddc3175d91a27 100644 (file)
@@ -13,6 +13,8 @@ INSTALL=@INSTALL@
 SED=sed -i 's/"\(.*\)\/\(.*\)\.h"/<\1\/\2.h>/g'
 PYTHON=@PYTHON@
 PYTHON_CONFIG=@PYTHON_CONFIG@
+PYTHON_CFLAGS=@PYTHON_CFLAGS@
+PYTHON_LIBS=@PYTHON_LIBS@
 
 prefix=@prefix@
 exec_prefix=@exec_prefix@
index f97ee00ccddfdf76d210cb70556a3b4e6e5b1fa7..11060fb81f9f07327309ca16eb11688939001c7a 100644 (file)
@@ -303,13 +303,33 @@ dnl ---------------------------------------------------------------------------
 dnl Check for Python
 dnl ---------------------------------------------------------------------------
 
-AC_PATH_PROG(PYTHON,python)
-AC_PATH_PROG(PYTHON_CONFIG,python-config)
+AC_PATH_PROG(PYTHON, python)
+if test x"$PYTHON" = x""; then
+       AC_MSG_WARN([No version of python was found!])
+       AC_MSG_ERROR([Please install python])
+fi
+AC_SUBST(PYTHON)
+
+AC_PATH_PROG(PYTHON_CONFIG, python-config)
+if test x"$PYTHON_CONFIG" = x""; then
+       AC_MSG_WARN([No version of python-config was found!])
+       AC_MSG_ERROR([Please install python-dev 2.7])
+fi
+AC_SUBST(PYTHON_CONFIG)
+
+AC_MSG_CHECKING(python cflags)
+PYTHON_CFLAGS=`$PYTHON_CONFIG --cflags`
+AC_MSG_RESULT($PYTHON_CFLAGS)
+AC_SUBST(PYTHON_CFLAGS)
+
+AC_MSG_CHECKING(python libs)
+PYTHON_LIBS=`$PYTHON_CONFIG --libs`
+AC_MSG_RESULT($PYTHON_LIBS)
+AC_SUBST(PYTHON_LIBS)
 
 AC_MSG_CHECKING(python library directory)
 pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1, 0, '\\${prefix}')"`
 AC_MSG_RESULT($pythondir)
-
 AC_SUBST(pythondir)
 
 dnl ----------------------------------------------------------------------------
@@ -776,7 +796,6 @@ OpenChange Configuration (Please review)
           * Coverage Tests:            $use_cov
 
           * OpenChange Bindings:
-            - Python:                  $enable_pymapi
             - Qt4:                     $enable_openchange_qt4
 
           * Installation prefix:       $prefix