1AC_DEFUN([AX_CHECK_PYTHON_DEVEL], [ 2ac_previous_cppflags=$CPPFLAGS 3ac_previous_ldflags=$LDFLAGS 4ac_python_version=`$PYTHON -c 'import distutils.sysconfig; \ 5 print distutils.sysconfig.get_config_var("VERSION")'` 6AC_PATH_PROG([pyconfig], [$PYTHON-config], [no]) 7AS_IF([test x"$pyconfig" = x"no"], [ 8 dnl For those that don't have python-config 9 CPPFLAGS="$CFLAGS `$PYTHON -c 'import distutils.sysconfig; \ 10 print "-I" + distutils.sysconfig.get_config_var("INCLUDEPY")'`" 11 CPPFLAGS="$CPPFLAGS `$PYTHON -c 'import distutils.sysconfig; \ 12 print distutils.sysconfig.get_config_var("CFLAGS")'`" 13 PYTHON_LIBS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \ 14 print distutils.sysconfig.get_config_var("LIBS")'`" 15 PYTHON_LIBS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \ 16 print distutils.sysconfig.get_config_var("SYSLIBS")'`" 17 LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \ 18 print "-L" + distutils.sysconfig.get_python_lib(plat_specific=1,\ 19 standard_lib=1) + "/config"'`" 20 LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \ 21 print distutils.sysconfig.get_config_var("LINKFORSHARED")'`" 22 LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \ 23 print distutils.sysconfig.get_config_var("LDFLAGS")'`" 24], [ 25 dnl If python-config is found use it 26 CPPFLAGS="$CFLAGS `$PYTHON-config --cflags`" 27 LDFLAGS="$LDFLAGS `$PYTHON-config --ldflags`" 28 PYTHON_LIBS="$LIBS `$PYTHON-config --libs`" 29]) 30 31AC_CHECK_HEADER([Python.h], [], 32 [AC_MSG_ERROR([Unable to find Python development headers])],) 33AC_CHECK_LIB(python$ac_python_version, PyArg_ParseTuple, [], 34 [AC_MSG_ERROR([Unable to find a suitable python development library])], 35 [$PYTHON_LIBS]) 36CPPFLAGS=$ac_previous_cppflags 37LDFLAGS=$ac_previous_ldflags 38]) 39