[pygobject] AM_CHECK_PYTHON_LIBS does not work for lib64



commit fcd457d1d1d8a813acb2ebfe5ee0e9aab2c9c88c
Author: Dieter Verfaillie <dieterv optionexplicit be>
Date:   Tue Sep 13 12:05:30 2011 +0200

    AM_CHECK_PYTHON_LIBS does not work for lib64
    
    But on Windows, Python extension modules need to be explicitly
    linked to libpython.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=658856

 configure.ac            |    4 +++-
 gi/Makefile.am          |    9 ++++++---
 gi/_glib/Makefile.am    |   10 ++++++++--
 gi/_gobject/Makefile.am |    8 +++++++-
 4 files changed, 24 insertions(+), 7 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b589a3f..55df65b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -102,7 +102,9 @@ if test $build_py3k = true ; then
 fi
 
 AM_CHECK_PYTHON_HEADERS(, AC_MSG_ERROR([Python headers not found]))
-AM_CHECK_PYTHON_LIBS(, AC_MSG_ERROR([Python libs not found]))
+if test "x$os_win32" = "xyes"; then
+  AM_CHECK_PYTHON_LIBS(, AC_MSG_ERROR([Python libs not found. Windows requires Python modules to be explicitly linked to libpython.]))
+fi
 
 AC_MSG_CHECKING([for PySignal_SetWakeupFd in Python.h])
 old_CPPFLAGS=$CPPFLAGS
diff --git a/gi/Makefile.am b/gi/Makefile.am
index 93bb4f8..0584cc9 100644
--- a/gi/Makefile.am
+++ b/gi/Makefile.am
@@ -8,14 +8,17 @@ extension_cppflags = \
 	$(PYTHON_INCLUDES) \
 	-DPY_SSIZE_T_CLEAN
 
-extension_libadd = \
-	$(PYTHON_LIBS)
-
 extension_ldflags = \
 	-module \
 	-avoid-version
 
 if OS_WIN32
+# Windows requires Python modules to be explicitly linked to libpython.
+# Extension modules are shared libaries (.dll), but need to be
+# called .pyd for Python to load it as an extension module.
+extension_libadd = \
+	$(PYTHON_LIBS)
+
 extension_ldflags += \
 	-no-undefined \
 	-shrext ".pyd"
diff --git a/gi/_glib/Makefile.am b/gi/_glib/Makefile.am
index 206740e..3cf2593 100644
--- a/gi/_glib/Makefile.am
+++ b/gi/_glib/Makefile.am
@@ -9,6 +9,12 @@ extension_ldflags = \
 	-avoid-version
 
 if OS_WIN32
+# Windows requires Python modules to be explicitly linked to libpython.
+# Extension modules are shared libaries (.dll), but need to be
+# called .pyd for Python to load it as an extension module.
+extension_libadd = \
+	$(PYTHON_LIBS)
+
 extension_ldflags += \
 	-no-undefined \
 	-shrext ".pyd"
@@ -33,7 +39,7 @@ libpyglib_gi_2_0_ PYTHON_BASENAME@_la_CPPFLAGS = \
 libpyglib_gi_2_0_ PYTHON_BASENAME@_la_CFLAGS = \
 	$(GLIB_CFLAGS)
 libpyglib_gi_2_0_ PYTHON_BASENAME@_la_LIBADD = \
-	$(PYTHON_LIBS) \
+	$(extension_libadd) \
 	$(FFI_LIBS) \
 	$(GLIB_LIBS)
 
@@ -65,7 +71,7 @@ _glib_la_CFLAGS = \
 _glib_la_CPPFLAGS = \
 	$(extension_cppflags)
 _glib_la_LIBADD = \
-	$(PYTHON_LIBS) \
+	$(extension_libadd) \
 	$(GLIB_LIBS) \
 	libpyglib-gi-2 0- PYTHON_BASENAME@.la
 _glib_la_LDFLAGS = \
diff --git a/gi/_gobject/Makefile.am b/gi/_gobject/Makefile.am
index 695c851..6bddcf7 100644
--- a/gi/_gobject/Makefile.am
+++ b/gi/_gobject/Makefile.am
@@ -13,6 +13,12 @@ extension_ldflags = \
 	-avoid-version
 
 if OS_WIN32
+# Windows requires Python modules to be explicitly linked to libpython.
+# Extension modules are shared libaries (.dll), but need to be
+# called .pyd for Python to load it as an extension module.
+extension_libadd = \
+	$(PYTHON_LIBS)
+
 extension_ldflags += \
 	-no-undefined \
 	-shrext ".pyd"
@@ -56,9 +62,9 @@ _gobject_la_CFLAGS = \
 _gi_la_CPPFLAGS = \
 	$(extension_cppflags)
 _gobject_la_LIBADD = \
+	$(extension_libadd) \
 	$(GLIB_LIBS) \
 	$(FFI_LIBS) \
-	$(PYTHON_LIBS) \
 	$(top_builddir)/gi/_glib/libpyglib-gi-2 0- PYTHON_BASENAME@.la
 _gobject_la_LDFLAGS = \
 	$(extension_ldflags) \



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