1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
--- a/macros/ac_python_devel.m4
+++ a/macros/ac_python_devel.m4
@@ -20,14 +20,8 @@ AC_DEFUN([AC_PYTHON_DEVEL],[
# Check for Python include path
AC_MSG_CHECKING([for Python include path])
- python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
- for i in "$python_path/include/python$PYTHON_VERSION/" "$python_path/include/python/" "$python_path/" ; do
- python_path=`find $i -type f -name Python.h -print | sed "1q"`
- if test -n "$python_path" ; then
- break
- fi
- done
- python_path=`echo $python_path | sed "s,/Python.h$,,"`
+ python_path=`$PYTHON -c 'import distutils.sysconfig; \
+ print(distutils.sysconfig.get_python_inc())'`
AC_MSG_RESULT([$python_path])
if test -z "$python_path" ; then
AC_MSG_ERROR([cannot find Python include path])
@@ -36,21 +30,16 @@ AC_DEFUN([AC_PYTHON_DEVEL],[
# Check for Python library path
AC_MSG_CHECKING([for Python library path])
- python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
- 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
- python_path=`find $i -type f -name libpython$PYTHON_VERSION.* -print | sed "1q"`
- if test -n "$python_path" ; then
- break
- fi
- done
- python_path=`echo $python_path | sed "s,/libpython.*$,,"`
+ python_path=`$PYTHON -c 'import distutils.sysconfig; \
+ print(distutils.sysconfig.get_config_var("LIBDIR"))'`
AC_MSG_RESULT([$python_path])
if test -z "$python_path" ; then
AC_MSG_ERROR([cannot find Python library path])
fi
AC_SUBST([PYTHON_LDFLAGS],["-L$python_path -lpython$PYTHON_VERSION"])
#
- python_site=`echo $python_path | sed "s/config/site-packages/"`
+ python_site=`$PYTHON -c 'import distutils.sysconfig; \
+ print(distutils.sysconfig.get_python_lib(standard_lib=False))'`
AC_SUBST([PYTHON_SITE_PKG],[$python_site])
#
# libraries which must be linked in when embedding
|