- [test "x$PERL" != "xno" -a "x$missing_perl_modules" != "xyes"])
-
-dnl dnl Check for Python (optional, for Python bindings).
-dnl AC_CHECK_PROG([PYTHON],[python],[python],[no])
-
-dnl PYTHON_PREFIX=
-dnl PYTHON_VERSION=
-dnl PYTHON_INCLUDEDIR=
-dnl PYTHON_SITE_PACKAGES=
-
-dnl if test "x$PYTHON" != "xno"; then
-dnl PYTHON_PREFIX=`$PYTHON -c "import sys; print sys.prefix"`
-dnl PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
-dnl for d in \
-dnl $PYTHON_PREFIX/include/python$PYTHON_VERSION \
-dnl /usr/include/python$PYTHON_VERSION \
-dnl /usr/local/include/python$PYTHON_VERSION
-dnl do
-dnl AC_MSG_CHECKING([Python.h in $d])
-dnl if test -r "$d/Python.h"; then
-dnl AC_MSG_RESULT([found])
-dnl PYTHON_INCLUDEDIR=$d
-dnl break
-dnl fi
-dnl AC_MSG_RESULT([not found])
-dnl done
-dnl for d in \
-dnl $PYTHON_PREFIX/lib64/python$PYTHON_VERSION/site-packages \
-dnl $PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages \
-dnl /usr/lib64/python$PYTHON_VERSION/site-packages \
-dnl /usr/lib/python$PYTHON_VERSION/site-packages \
-dnl /usr/local/lib/python$PYTHON_VERSION/site-packages
-dnl do
-dnl AC_MSG_CHECKING([for $d])
-dnl if test -d "$d"; then
-dnl AC_MSG_RESULT([found])
-dnl PYTHON_SITE_PACKAGES=$d
-dnl break
-dnl fi
-dnl AC_MSG_RESULT([not found])
-dnl done
-dnl fi
+ [test "x$PERL" != "xno" && test "x$missing_perl_modules" != "xyes"])
+
+dnl Check for Python (optional, for Python bindings).
+AC_CHECK_PROG([PYTHON],[python],[python],[no])
+
+PYTHON_PREFIX=
+PYTHON_VERSION=
+
+if test "x$PYTHON" != "xno"; then
+ PYTHON_PREFIX=`$PYTHON -c "import sys; print(sys.prefix)"`
+ PYTHON_VERSION=`$PYTHON -c "import sys; print(sys.version[[0:3]])"`
+
+ AC_MSG_CHECKING([for Python include path])
+ if test -z "$PYTHON_INCLUDEDIR"; then
+ python_path=`$PYTHON -c "import distutils.sysconfig; \
+ print (distutils.sysconfig.get_python_inc ());"`
+ PYTHON_INCLUDEDIR=$python_path
+ fi
+ AC_MSG_RESULT([$PYTHON_INCLUDEDIR])
+
+ AC_MSG_CHECKING([for Python site-packages path])
+ if test -z "$PYTHON_SITE_PACKAGES"; then
+ PYTHON_SITE_PACKAGES=`$PYTHON -c "import distutils.sysconfig; \
+ print (distutils.sysconfig.get_python_lib(1,0));"`
+ fi
+ AC_MSG_RESULT([$PYTHON_SITE_PACKAGES])
+
+ old_LIBS="$LIBS"
+ LIBS="$LIBS -lpython$PYTHON_VERSION"
+ AC_CHECK_FUNCS([PyCapsule_New])
+ LIBS="$old_LIBS"
+fi