[gnome-python-extras] acinclude.m4: Rip out crappy python-finding code and just use pkg-config



commit 77cca7ce35bfb4f6bc283672dc295c2bb82a3b58
Author: Colin Walters <walters verbum org>
Date:   Tue Apr 26 09:46:14 2011 -0400

    acinclude.m4: Rip out crappy python-finding code and just use pkg-config
    
    The code for trying to find the Python library is not multilib (lib64)
    aware, and besides that is just plain hideous.
    
    We already hard require pkg-config installed to find pygobject, so
    use it for Python too.  (If python.pc doesn't come on Windows, pygobject
    should really start shipping it, because they can't link to different
    versions of Python).

 acinclude.m4 |   29 ++++++-----------------------
 1 files changed, 6 insertions(+), 23 deletions(-)
---
diff --git a/acinclude.m4 b/acinclude.m4
index 8694a65..467fdd5 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -69,30 +69,13 @@ CPPFLAGS="$save_CPPFLAGS"
 	# libpython2.5.a on unix.
 	WIN32_PYTHON_VERSION=`echo $PYTHON_VERSION | sed "s,\.,,"`
 
-        python_path=`dirname $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
-		if test -e "$i"; then
-	                python_path=`find $i -type f -name libpython$PYTHON_VERSION.* -print | sed "1q"`
-        	        if test -n "$python_path" ; then
-				python_lib="python$PYTHON_VERSION"
-                	        break
-	                fi
-
-			# Additionally test WIN32_PYTHON_VERSION
-	                python_path=`find $i -type f -name libpython$WIN32_PYTHON_VERSION.* -print | sed "1q"`
-        	        if test -n "$python_path" ; then
-				python_lib="python$WIN32_PYTHON_VERSION"
-                	        break
-	                fi
-		fi
-        done
-
-        python_path=`echo $python_path | sed "s,/libpython.*$,,"`
-        AC_MSG_RESULT([$python_path])
-        if test -z "$python_path" ; then
-                AC_MSG_ERROR([cannot find Python library path])
+	AC_MSG_CHECKING([for python.pc])
+	if ! pkg-config --exists python; then
+	   AC_MSG_ERROR([Can't find python.pc])
         fi
-        AC_SUBST([PYTHON_LDFLAGS],["-L$python_path -l$python_lib"])
+	AC_MSG_RESULT([found])
+	python_ldflags=`pkg-config --libs python`
+        AC_SUBST([PYTHON_LDFLAGS],["$python_ldflags"])
 ])
 
 dnl



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]