]> Dogcows Code - chaz/openbox/commitdiff
check for the python cflags and libs
authorDana Jansens <danakj@orodu.net>
Sat, 11 Jan 2003 01:26:33 +0000 (01:26 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 11 Jan 2003 01:26:33 +0000 (01:26 +0000)
m4/python.m4 [new file with mode: 0644]

diff --git a/m4/python.m4 b/m4/python.m4
new file mode 100644 (file)
index 0000000..94a0a4d
--- /dev/null
@@ -0,0 +1,67 @@
+# PYTHON_DEVEL()
+#
+# Checks for Python and tries to get the include path to 'Python.h', and
+# the libpython library.
+# It provides the $(PYTHON_CFLAGS) $(PYTHON_LIBS) output variables.
+AC_DEFUN([PYTHON_DEVEL],
+[
+  AC_REQUIRE([AM_PATH_PYTHON])
+
+  python_prefix=${PYTHON%/bin*}
+
+  # Check for Python include path
+  AC_MSG_CHECKING([for Python include path])
+  for i in "$python_prefix/include/python$PYTHON_VERSION/" \
+           "$python_prefix/include/python/" "$python_prefix/"
+  do
+    python_path=`find $i -type f -name Python.h -print`
+    test "$python_path" && break
+  done
+  for i in $python_path
+  do
+    python_path=${python_path%/Python.h}
+    break
+  done
+  if test "$python_path"
+  then
+    AC_MSG_RESULT([$python_path])
+  else
+    AC_MSG_ERROR([cannot find Python include path])
+  fi
+  AC_SUBST([PYTHON_CFLAGS], [-I$python_path])
+
+  # Check for a Python library
+  AC_MSG_CHECKING([for Python library])
+  PYLIB=""
+  for i in "$python_prefix/lib" \
+           "$python_prefix/lib/python$PYTHON_VERSION/config" \
+           "$python_prefix/lib/python$PYTHON_VERSION/lib" \
+           "$python_prefix/lib/python/lib"
+  do
+    if test -r "$i/libpython$PYTHON_VERSION.so"; then
+      PYLIB="$i/libpython$PYTHON_VERSION.so"
+      PYTHON_LIBS="-L$i -l$PYVERSION"
+      break
+    else
+      if test -r "$i/lib$PYVERSION.a"; then
+        PYLIB="$i/lib$PYVERSION.a"
+        PYTHON_LIBS="-L$i -l$PYVERSION -lpthread -ldl -lutil -lm"
+        break
+      else
+        # look for really old versions
+        if test -r "$i/libPython.a"; then
+          PYLIB="$i/libPython.a"
+          PYTHON_LIBS="-L$i -lModules -lPython -lObjects -lParser"
+          break
+        fi
+      fi
+    fi
+  done
+  if test "$python_path"
+  then
+    AC_MSG_RESULT([$PYLIB])
+  else
+    AC_MSG_ERROR([cannot find Python library])
+  fi
+  AC_SUBST([PYTHON_LIBS])
+])
This page took 0.02327 seconds and 4 git commands to generate.