[libxml2] Fix Python build on Windows



commit ad6f10a81be19c4dca2f7e77a2f8173d3eaf2591
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Sun Sep 4 17:21:51 2022 +0200

    Fix Python build on Windows
    
    Build Python bindings with -no-undefined on Windows. Remove libs that
    should already be set by PKG_CHECK_MODULE.

 configure.ac       | 18 +++++-------------
 python/Makefile.am |  4 ++--
 2 files changed, 7 insertions(+), 15 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 2563d858..1c9da738 100644
--- a/configure.ac
+++ b/configure.ac
@@ -790,25 +790,17 @@ AS_IF([test "x$with_python" != "xno"], [
 AM_CONDITIONAL([WITH_PYTHON], [test "x$with_python" != "xno"])
 
 dnl
-dnl Extra Python flags for Windows (is this still needed now that we use
-dnl AM_PATH_PYTHON/PKG_CHECK_MODULES to detect and set up Python?)
+dnl Extra Python flags for Windows
 dnl
-EXTRA_PYTHON_LIBADD=
+PYTHON_LDFLAGS=
 if test "${PYTHON}" != ""; then
     case "$host" in
-        *-w64-mingw*)
-            EXTRA_PYTHON_LIBADD="-shrext .pyd -L${pythondir}/../../lib -lpython${PYTHON_VERSION}"
-            ;;
-        *-*-mingw*)
-            EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython$(echo ${PYTHON_VERSION} | tr -d .)"
-            ;;
-        *-*-cygwin*)
-            EXTRA_PYTHON_LIBADD="-L/usr/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}"
+        *-*-cygwin* | *-*-mingw* | *-*-msys* )
+            PYTHON_LDFLAGS="-no-undefined"
             ;;
     esac
 fi
-
-AC_SUBST(EXTRA_PYTHON_LIBADD)
+AC_SUBST(PYTHON_LDFLAGS)
 
 dnl
 dnl Check for DSO support
diff --git a/python/Makefile.am b/python/Makefile.am
index d9f909e9..778270df 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -20,8 +20,8 @@ pyexec_LTLIBRARIES = libxml2mod.la
 
 libxml2mod_la_SOURCES = libxml.c libxml_wrap.h types.c
 nodist_libxml2mod_la_SOURCES = libxml2-py.h libxml2-py.c
-libxml2mod_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version
-libxml2mod_la_LIBADD = $(top_builddir)/libxml2.la $(EXTRA_PYTHON_LIBADD) $(PYTHON_LIBS)
+libxml2mod_la_LDFLAGS = $(AM_LDFLAGS) $(PYTHON_LDFLAGS) -module -avoid-version
+libxml2mod_la_LIBADD = $(top_builddir)/libxml2.la $(PYTHON_LIBS)
 
 BUILT_SOURCES = libxml2-export.c libxml2-py.h libxml2-py.c
 


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