1
dnl @synopsis AC_PYTHON_DEVEL
3
dnl Checks for Python and tries to get the include path to 'Python.h'.
4
dnl It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS) output
7
dnl @category InstalledPackages
8
dnl @author Sebastian Huber <sebastian-huber@web.de>
9
dnl @author Alan W. Irwin <irwin@beluga.phys.uvic.ca>
10
dnl @author Rafael Laboissiere <laboissiere@psy.mpg.de>
11
dnl @author Andrew Collier <colliera@nu.ac.za>
12
dnl @version 2004-07-14
13
dnl @license GPLWithACException
15
AC_DEFUN([AC_PYTHON_DEVEL],[
17
# should allow for checking of python version here...
19
AC_REQUIRE([AM_PATH_PYTHON])
21
# Check for Python include path
22
AC_MSG_CHECKING([for Python include path])
23
python_path=`$PYTHON -c 'from distutils import sysconfig; print sysconfig.get_python_inc();'`
24
f_python_path=`find $python_path -type f -name Python.h -print | sed "1q"`
25
if test -n "$f_python_path" ; then
26
python_path=`dirname $f_python_path`
28
AC_MSG_RESULT([$python_path])
29
if test -z "$python_path" ; then
30
AC_MSG_ERROR([cannot find Python include path])
32
AC_SUBST([PYTHON_CPPFLAGS],[-I$python_path])
34
# Check for Python library path - python exec_prefix changed above, need to
36
AC_MSG_CHECKING([for Python library path])
37
python_path=`$PYTHON -c 'import sys; print sys.exec_prefix;'`
38
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
39
python_path=`find $i -type f -name libpython$PYTHON_VERSION.* -print | sed "1q"`
40
if test -n "$python_path" ; then
44
python_path=`echo $python_path | sed "s,/libpython.*$,,"`
45
AC_MSG_RESULT([$python_path])
46
if test -z "$python_path" ; then
47
AC_MSG_ERROR([cannot find Python library path])
49
AC_SUBST([PYTHON_LDFLAGS],["-L$python_path"])
51
python_site=`echo $python_path | sed "s/config/site-packages/"`
52
AC_SUBST([PYTHON_SITE_PKG],[$python_site])
54
# libraries which must be linked in when embedding
56
AC_MSG_CHECKING(python extra libraries)
57
PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
58
conf = distutils.sysconfig.get_config_var; \
59
print conf('LOCALMODLIBS')+' '+conf('LIBS')"
60
AC_MSG_RESULT($PYTHON_EXTRA_LIBS)`
61
AC_SUBST(PYTHON_EXTRA_LIBS)