r26597: Attempt to provide alternative for hosts that don't have python-config.
authorJelmer Vernooij <jelmer@samba.org>
Tue, 25 Dec 2007 22:36:50 +0000 (16:36 -0600)
committerStefan Metzmacher <metze@samba.org>
Wed, 26 Dec 2007 17:57:08 +0000 (11:57 -0600)
source/scripting/python/config.m4

index b6ca7966df242261dd9c5a238b39438b3dc0a198..a629aa8f924abb310fd583c59636369aec5adba1 100644 (file)
@@ -19,10 +19,16 @@ if test -z "$PYTHON_CONFIG"; then
        AC_MSG_WARN([No python-config found])
 else
        working_python=yes
+       PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags`
+       PYTHON_CFLAGS=`$PYTHON_CONFIG --cflags`
 fi
 
-PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags`
-PYTHON_CFLAGS=`$PYTHON_CONFIG --cflags`
+if test $working_python = no && test x$PYTHON != x
+then
+       PYTHON_CFLAGS=`$PYTHON -c "from distutils import sysconfig; print '-I%s -I%s %s' % (sysconfig.get_python_inc(), sysconfig.get_python_inc(plat_specific=True), sysconfig.get_config_var('CFLAGS'))"`
+       PYTHON_LDFLAGS=`$PYTHON -c "from distutils import sysconfig; print '%s %s -lpython%s -L%s' % (sysconfig.get_config_var('LIBS'), sysconfig.get_config_var('SYSLIBS'), sysconfig.get_config_var('VERSION'), sysconfig.get_config_var('LIBPL'))"`
+       working_python=yes
+fi
 
 SMB_EXT_LIB(EXT_LIB_PYTHON, [$PYTHON_LDFLAGS], [$PYTHON_CFLAGS])