[libxslt] Add missing compile definition for static builds to Autotools



commit 3f3e888f1a80290e75c96d634323f00a52d2e564
Author: Mike Dalessio <mike dalessio gmail com>
Date:   Sat Aug 20 10:28:06 2022 -0400

    Add missing compile definition for static builds to Autotools
    
    Related to eaa53788 and 29923816
    
    Closes #73

 configure.ac           | 15 +++++++++++++++
 libexslt/Makefile.am   |  2 +-
 libxslt/Makefile.am    |  2 +-
 python/Makefile.am     |  2 +-
 tests/fuzz/Makefile.am |  2 +-
 xslt-config.in         |  2 +-
 xsltproc/Makefile.am   |  2 +-
 7 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 3cb0f648..9582b98f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -505,6 +505,21 @@ AC_SUBST(XSLT_INCLUDEDIR)
 AC_SUBST(XSLT_LIBS)
 AC_SUBST(XSLT_PRIVATE_LIBS)
 
+LIBXSLT_CFLAGS=""
+case ${host} in
+    *-*-mingw* | *-*-cygwin* | *-*-msvc* )
+        # If the host is Windows, and shared libraries are disabled, we
+        # need to add -DLIBXML_STATIC to EXTRA_CFLAGS in order for linking to
+        # work properly (without it, xmlexports.h would force the use of
+        # DLL imports, which obviously aren't present in a static
+        # library).
+        if test "x$enable_shared" = "xno"; then
+           LIBXSLT_CFLAGS="$LIBXSLT_CFLAGS -DLIBXSLT_STATIC -DLIBEXSLT_STATIC"
+        fi
+        ;;
+esac
+AC_SUBST(LIBXSLT_CFLAGS)
+
 EXSLT_LIBDIR='-L${libdir}'
 EXSLT_INCLUDEDIR='-I${includedir}'
 EXSLT_PRIVATE_LIBS="$XSLT_PRIVATE_LIBS $LIBGCRYPT_LIBS"
diff --git a/libexslt/Makefile.am b/libexslt/Makefile.am
index 46d4371e..c2dc6364 100644
--- a/libexslt/Makefile.am
+++ b/libexslt/Makefile.am
@@ -2,7 +2,7 @@ AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/libxslt -I$(top_srcdir)/libexslt \
              -I$(top_builddir) -I$(top_builddir)/libxslt \
              -I$(top_builddir)/libexslt
 
-AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(LIBXML_CFLAGS)
+AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(LIBXML_CFLAGS) $(LIBXSLT_CFLAGS)
 
 lib_LTLIBRARIES = libexslt.la
 
diff --git a/libxslt/Makefile.am b/libxslt/Makefile.am
index 4b131d50..9560dc3b 100644
--- a/libxslt/Makefile.am
+++ b/libxslt/Makefile.am
@@ -1,6 +1,6 @@
 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/libxslt
 
-AM_CFLAGS = $(LIBXML_CFLAGS)
+AM_CFLAGS = $(LIBXML_CFLAGS) $(LIBXSLT_CFLAGS)
 
 lib_LTLIBRARIES = libxslt.la
 
diff --git a/python/Makefile.am b/python/Makefile.am
index 24ede9c3..dfcf5e3f 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -19,7 +19,7 @@ libxsltmod_la_CPPFLAGS = \
        -I$(top_srcdir)/libxslt \
        -I$(top_srcdir) \
        -I../libexslt \
-       $(PYTHON_CFLAGS) $(LIBXML_CFLAGS)
+       $(PYTHON_CFLAGS) $(LIBXML_CFLAGS) $(LIBXSLT_CFLAGS)
 libxsltmod_la_SOURCES = libxslt.c types.c
 nodist_libxsltmod_la_SOURCES = libxslt-py.c
 libxsltmod_la_LIBADD = \
diff --git a/tests/fuzz/Makefile.am b/tests/fuzz/Makefile.am
index 7e22bd99..5f4d90b6 100644
--- a/tests/fuzz/Makefile.am
+++ b/tests/fuzz/Makefile.am
@@ -6,7 +6,7 @@ check_PROGRAMS = testTargets
 EXTRA_DIST = xpath.dict xpath.xml xslt.dict xslt.xml seed
 CLEANFILES = $(EXTRA_PROGRAMS)
 AM_CPPFLAGS = -I$(top_srcdir)
-AM_CFLAGS = $(LIBXML_CFLAGS)
+AM_CFLAGS = $(LIBXML_CFLAGS) $(LIBXSLT_CFLAGS)
 DEPENDENCIES = $(LIBXSLT_LIBS)
 LDADD = $(LIBXSLT_LIBS) \
         $(LIBXML_LIBS) $(EXTRA_LIBS) $(LIBM)
diff --git a/xslt-config.in b/xslt-config.in
index 1d376b66..f68df0f7 100644
--- a/xslt-config.in
+++ b/xslt-config.in
@@ -74,7 +74,7 @@ while test $# -gt 0; do
        ;;
 
     --cflags)
-        cflags="@LIBXML_CFLAGS@"
+        cflags="@LIBXML_CFLAGS@ @LIBXSLT_CFLAGS@"
         if test "$includedir" != "/usr/include"; then
             cflags="$cflags @XSLT_INCLUDEDIR@"
         fi
diff --git a/xsltproc/Makefile.am b/xsltproc/Makefile.am
index 9416da6c..7ddac9d2 100644
--- a/xsltproc/Makefile.am
+++ b/xsltproc/Makefile.am
@@ -7,7 +7,7 @@ bin_PROGRAMS = xsltproc
 
 noinst_PROGRAMS=testThreads
 
-AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(LIBXML_CFLAGS)
+AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(LIBXML_CFLAGS) $(LIBXSLT_CFLAGS)
 
 xsltproc_SOURCES = xsltproc.c
 xsltproc_LDFLAGS = 


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