ac_python_devel.m4 (1989B)
1 dnl Available from the GNU Autoconf Macro Archive at: 2 dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_python_devel.html 3 dnl 4 AC_DEFUN([AC_PYTHON_DEVEL],[ 5 # 6 # should allow for checking of python version here... 7 # 8 AC_REQUIRE([AM_PATH_PYTHON]) 9 10 # Check for Python include path 11 AC_MSG_CHECKING([for Python include path]) 12 python_path=`echo $PYTHON | sed "s,/bin.*$,,"` 13 for i in "$python_path/include/python$PYTHON_VERSION/" "$python_path/include/python/" "$python_path/" ; do 14 python_path=`find $i -type f -name Python.h -print | sed "1q"` 15 if test -n "$python_path" ; then 16 break 17 fi 18 done 19 python_path=`echo $python_path | sed "s,/Python.h$,,"` 20 AC_MSG_RESULT([$python_path]) 21 if test -z "$python_path" ; then 22 AC_MSG_WARN([cannot find Python include path]) 23 else 24 AC_SUBST([PYTHON_CPPFLAGS],[-I$python_path]) 25 26 # Check for Python library path 27 AC_MSG_CHECKING([for Python library path]) 28 python_path=`echo $PYTHON | sed "s,/bin.*$,,"` 29 for i in "$python_path/lib/python$PYTHON_VERSION/config/" "$python_path/lib/python$PYTHON_VERSION/" "$python_path/lib/python/config/" "$python_path/lib/python/" "$python_path/" ; do 30 python_path=`find $i -type f -name libpython$PYTHON_VERSION.* -print | sed "1q"` 31 if test -n "$python_path" ; then 32 break 33 fi 34 done 35 python_path=`echo $python_path | sed "s,/libpython.*$,,"` 36 AC_MSG_RESULT([$python_path]) 37 if test -z "$python_path" ; then 38 AC_MSG_ERROR([cannot find Python library path]) 39 fi 40 AC_SUBST([PYTHON_LDFLAGS],["-L$python_path -lpython$PYTHON_VERSION"]) 41 # 42 python_site=`echo $python_path | sed "s/config/site-packages/"` 43 AC_SUBST([PYTHON_SITE_PKG],[$python_site]) 44 # 45 # libraries which must be linked in when embedding 46 # 47 AC_MSG_CHECKING(python extra libraries) 48 PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \ 49 conf = distutils.sysconfig.get_config_var; \ 50 print conf('LOCALMODLIBS')+' '+conf('LIBS')" 51 AC_MSG_RESULT($PYTHON_EXTRA_LIBS)` 52 AC_SUBST(PYTHON_EXTRA_LIBS) 53 fi 54 ])