[cig-commits] r15012 - cs/autoconf/trunk

leif at geodynamics.org leif at geodynamics.org
Mon May 18 16:15:54 PDT 2009


Author: leif
Date: 2009-05-18 16:15:54 -0700 (Mon, 18 May 2009)
New Revision: 15012

Modified:
   cs/autoconf/trunk/cit_python.m4
Log:
Wrote CIT_PYTHON_CONFIG.  It is based upon the pythonX.X-config
utility that ships with Python 2.4 and later.  This new macro is
simpler than CIT_PYTHON_SYSCONFIG -- and therefore more robust
(hopefully).  However, it is not expected to work when Python is not
installed as a shared library.  See Issue39.


Modified: cs/autoconf/trunk/cit_python.m4
===================================================================
--- cs/autoconf/trunk/cit_python.m4	2009-05-18 23:02:05 UTC (rev 15011)
+++ cs/autoconf/trunk/cit_python.m4	2009-05-18 23:15:54 UTC (rev 15012)
@@ -35,6 +35,50 @@
 ])dnl CIT_CHECK_PYTHON_HEADER
 
 
+# CIT_PYTHON_CONFIG
+# --------------------
+AC_DEFUN([CIT_PYTHON_CONFIG], [
+# $Id$
+AC_REQUIRE([AM_PATH_PYTHON])
+AC_MSG_CHECKING([$am_display_PYTHON config])
+cat >python-config.py <<END_OF_PYTHON
+[
+# This is based upon the pythonX.X-config utility that ships with
+# Python 2.4 and later.
+from distutils import sysconfig
+
+pyver = sysconfig.get_config_var('VERSION')
+getvar = sysconfig.get_config_var
+
+cppflags = ['-I' + sysconfig.get_python_inc(),
+            '-I' + sysconfig.get_python_inc(plat_specific=True)]
+print 'PYTHON_CPPFLAGS="%s"' % ' '.join(cppflags)
+
+ldflags = ['-L' + getvar('LIBPL')]
+print 'PYTHON_LDFLAGS="%s"' % ' '.join(ldflags)
+
+libs = getvar('LIBS').split() + getvar('SYSLIBS').split()
+libs.append('-lpython'+pyver)
+print 'PYTHON_LIBS="%s"' % ' '.join(libs)
+
+]
+END_OF_PYTHON
+eval `$PYTHON python-config.py 2>/dev/null`
+if test -n "$PYTHON_CPPFLAGS"; then
+    AC_MSG_RESULT(ok)
+else
+    AC_MSG_ERROR(["failed
+
+Run '$PYTHON python-config.py' to see what went wrong.
+"])
+fi
+rm -f python-config.py
+AC_SUBST([PYTHON_CPPFLAGS], [$PYTHON_CPPFLAGS])
+AC_SUBST([PYTHON_LDFLAGS], [$PYTHON_LDFLAGS])
+AC_SUBST([PYTHON_LIBS], [$PYTHON_LIBS])
+])dnl CIT_PYTHON_CONFIG
+
+
 # CIT_PYTHON_SYSCONFIG
 # --------------------
 AC_DEFUN([CIT_PYTHON_SYSCONFIG], [
@@ -124,7 +168,7 @@
 else
     AC_MSG_ERROR(["failed
 
-Run '$PYTHON sysconfig.py' to see what wrong.
+Run '$PYTHON sysconfig.py' to see what went wrong.
 "])
 fi
 rm -f sysconfig.py



More information about the CIG-COMMITS mailing list