[Users] [PATCH 1/8] osx: fix configure's runtime check for python library

Igor Mammedov imammedo at redhat.com
Tue Jan 20 22:14:35 CET 2015


'configure' says that python is not found, when building on OS X
using native gtk under jhbuild environment, due to LD_LIBRARY_PATH
pointing only to gtk build environment and test fails to find
python library in standart location.

But since pkgconfig provides directory for python to be used,
try dlopen python*.dylib with rpath set to path returned by
pkgconfig so that test would succeed.

Signed-off-by: Igor Mammedov <imammedo at redhat.com>
---
 configure.ac                   | 11 ++++++++---
 src/plugins/python/Makefile.am |  1 +
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 9439980..86d5de5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1201,6 +1201,7 @@ AM_PATH_PYTHON([2.5], [
 	if test x"$PYTHON_CONFIG" != x""; then
 		PYTHON_CFLAGS=`$PYTHON_CONFIG --includes`
 		PYTHON_LIBS=`$PYTHON_CONFIG --libs`
+		PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags`
 		PYTHON_PREFIX=`$PYTHON_CONFIG --prefix`
 		HAVE_PYTHON=yes
 	else
@@ -1211,9 +1212,12 @@ AM_PATH_PYTHON([2.5], [
 	if test x"$HAVE_PYTHON" = xyes; then
 		_save_libs="$LIBS"
 		if test x"$platform_win32" = xno; then
-			# libpython.so
-			PYTHON_SHARED_LIB="libpython${PYTHON_VERSION}.so"
-			LIBS="-ldl"
+			if test x"$PYTHON_PLATFORM" = xdarwin; then
+				PYTHON_SHARED_LIB="libpython${PYTHON_VERSION}.dylib"
+			else
+				PYTHON_SHARED_LIB="libpython${PYTHON_VERSION}.so"
+			fi
+			LIBS="-ldl -rpath ${PYTHON_PREFIX}/lib"
 			AC_MSG_CHECKING([whether to dlopen $PYTHON_SHARED_LIB works])
 			AC_RUN_IFELSE(
 				[AC_LANG_PROGRAM(
@@ -1242,6 +1246,7 @@ AM_PATH_PYTHON([2.5], [
 AC_SUBST(PYTHON_SHARED_LIB)
 AC_SUBST(PYTHON_CFLAGS)
 AC_SUBST(PYTHON_LIBS)
+AC_SUBST(PYTHON_LDFLAGS)
 AC_SUBST(PYGTK_CFLAGS)
 AC_SUBST(PYGTK_LIBS)
 
diff --git a/src/plugins/python/Makefile.am b/src/plugins/python/Makefile.am
index ebb9d72..30a03ff 100644
--- a/src/plugins/python/Makefile.am
+++ b/src/plugins/python/Makefile.am
@@ -39,6 +39,7 @@ python_la_LDFLAGS = \
 	$(GLIB_LIBS) \
 	$(GTK_LIBS) \
 	$(PYGTK_LIBS) \
+	$(PYTHON_LDFLAGS) \
 	$(PYTHON_LIBS)
 
 
-- 
1.9.3 (Apple Git-50)




More information about the Users mailing list