diff options
Diffstat (limited to 'source4/scripting/python/config.m4')
-rw-r--r-- | source4/scripting/python/config.m4 | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/source4/scripting/python/config.m4 b/source4/scripting/python/config.m4 index 5e982556fc..96e4da9add 100644 --- a/source4/scripting/python/config.m4 +++ b/source4/scripting/python/config.m4 @@ -65,7 +65,7 @@ if test -z "$PYTHON_LDFLAGS"; then py_version=`$PYTHON -c "from distutils.sysconfig import *; \ from string import join; \ print join(get_config_vars('VERSION'))"` - if test "$py_version" == "[None]"; then + if test "$py_version" = "[None]"; then if test -n "$PYTHON_VERSION"; then py_version=$PYTHON_VERSION else @@ -119,9 +119,31 @@ AC_SUBST(PYTHON_EXTRA_LDFLAGS) SMB_EXT_LIB(LIBPYTHON, [$PYTHON_LDFLAGS], [$PYTHON_CPPFLAGS]) + +AC_MSG_CHECKING(working python module support) if test x$working_python = xyes then - SMB_ENABLE(LIBPYTHON,YES) + ac_save_LIBS="$LIBS" + ac_save_CFLAGS="$CFLAGS" + LIBS="$LIBS $PYTHON_LDFLAGS" + CFLAGS="$CFLAGS $PYTHON_CPPFLAGS" + + AC_TRY_LINK([ + #include <Python.h> + #include <stdlib.h> + ],[ + Py_InitModule(NULL, NULL); + ],[ + SMB_ENABLE(LIBPYTHON,YES) + AC_MSG_RESULT([yes]) + ],[ + SMB_ENABLE(LIBPYTHON,NO) + AC_MSG_RESULT([no]) + ]) + + LIBS="$ac_save_LIBS" + CFLAGS="$ac_save_CFLAGS" else SMB_ENABLE(LIBPYTHON,NO) + AC_MSG_RESULT([no]) fi |