[Commits] [SCM] claws branch, master, updated. 3.9.1-21-gdf8a1d7

mones at claws-mail.org mones at claws-mail.org
Thu May 30 18:39:10 CEST 2013


The branch master of project "claws" (Claws Mail) has been updated
       via  df8a1d7e766dea1c48a47d6a7766e20922a78cab (commit)
      from  9375966944e6fef9cc85820b329c46125a93b3f3 (commit)


- Log -----------------------------------------------------------------
commit df8a1d7e766dea1c48a47d6a7766e20922a78cab
Author: Ricardo Mones <ricardo at mones.org>
Date:   Thu May 30 18:29:07 2013 +0200

    Check if detected libpython.so can be dlopen-ed
    
    A somewhat better solution for the libpython.so detection saga.
    Unfortunately it has not presented itself and had to be painfully
    extracted from a series of trial and error experiments. No living
    beings were harmed in the process, though.
    
    Many thanks to Paul for the help with testing this.

diff --git a/configure.ac b/configure.ac
index 3c8a5f5..f57dea1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1238,25 +1238,28 @@ AM_PATH_PYTHON([2.5], [
 
 	if test x"$HAVE_PYTHON" = xyes; then
 		# libpython.so
-		PYTHON_SO_FILE_LOCATION=`python-config --ldflags|sed 's/-L//'|awk '{print $1}'`
-		PYTHON_SO_FILE="libpython${PYTHON_VERSION}.so"
-		found_libpython_so="no"
-		if test -f "$PYTHON_PREFIX/lib/$PYTHON_SO_FILE"; then
-			found_libpython_so="yes"
-			PYTHON_SHARED_LIB=`python -c "import os,sys; print os.path.basename(os.path.realpath(\"$PYTHON_PREFIX/lib/$PYTHON_SO_FILE\"))"`
-		fi
-		if  test x"$found_libpython_so" != x"yes" && test -f "$PYTHON_PREFIX/lib64/$PYTHON_SO_FILE"; then
-			found_libpython_so="yes"
-			PYTHON_SHARED_LIB=`python -c "import os,sys; print os.path.basename(os.path.realpath(\"$PYTHON_PREFIX/lib64/$PYTHON_SO_FILE\"))"`
-		fi
-		if test x"$found_libpython_so" != x"yes" && test -f "$PYTHON_SO_FILE_LOCATION/$PYTHON_SO_FILE"; then
-			found_libpython_so="yes"
-			PYTHON_SHARED_LIB=`python -c "import os,sys; print os.path.basename(os.path.realpath(\"$PYTHON_SO_FILE_LOCATION/$PYTHON_SO_FILE\"))"`
-		fi
+		PYTHON_SHARED_LIB="libpython${PYTHON_VERSION}.so"
+		_save_libs="$LIBS"
+		LIBS="-ldl"
+		AC_MSG_CHECKING([whether to dlopen $PYTHON_SHARED_LIB works])
+		AC_RUN_IFELSE(
+			[AC_LANG_PROGRAM(
+				[#include <dlfcn.h>
+				 #define PYTHON_SO_FILE "${PYTHON_SHARED_LIB}"
+				],
+			 	[if (!dlopen(PYTHON_SO_FILE, RTLD_NOW | RTLD_GLOBAL)) return 1; return 0;])
+			],
+			[found_libpython_so="yes"],
+			[found_libpython_so="no"],
+			[AC_MSG_FAILURE([cross-compiling not supported])])
 		if test x"$found_libpython_so" != x"yes"; then
+			AC_MSG_RESULT(no)
 			AC_MSG_WARN(Could not find Python shared libary: $PYTHON_SO_FILE does not exist. Maybe you need to install development packages for Python.)
 			HAVE_PYTHON=no
+		else
+			AC_MSG_RESULT(yes)
 		fi
+		LIBS="$_save_libs";
 	fi
 	if test x"$HAVE_PYTHON" = xyes; then
 		PKG_CHECK_MODULES(PYGTK, pygtk-2.0 >= 2.10.3, [AC_DEFINE(ENABLE_PYTHON, [1], [Enable Python support])], HAVE_PYTHON=no)

-----------------------------------------------------------------------

Summary of changes:
 configure.ac |   33 ++++++++++++++++++---------------
 1 files changed, 18 insertions(+), 15 deletions(-)


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list