This is an automated email from the ASF dual-hosted git repository.

jimjag pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 6ebe52f808 configure.ac: honor the directory given to 
--with-system-libxml/-libxslt/-curl
6ebe52f808 is described below

commit 6ebe52f808faa3285ea18ab8e983eb89d5cfb82c
Author: Jim Jagielski <[email protected]>
AuthorDate: Wed Aug 5 19:31:03 2026 -0400

    configure.ac: honor the directory given to 
--with-system-libxml/-libxslt/-curl
---
 main/configure.ac                 | 67 +++++++++++++++++++++++++++++++++++----
 main/forms/util/makefile.mk       | 28 ++++++++++++----
 main/set_soenv.in                 |  3 ++
 main/xmlsecurity/util/makefile.mk | 45 ++++++++++++++++++++++----
 4 files changed, 123 insertions(+), 20 deletions(-)

diff --git a/main/configure.ac b/main/configure.ac
index e79f175db4..7d8c04b85e 100644
--- a/main/configure.ac
+++ b/main/configure.ac
@@ -3952,8 +3952,23 @@ if test -n "$with_system_libxslt" -o -n 
"$with_system_libs" -o \
        if test "$_os" != "Darwin"; then
                PKG_CHECK_MODULES(LIBXSLT, libxslt)
        else
-               LIBXSLT_CFLAGS=`xslt-config --cflags`
-               LIBXSLT_LIBS=`xslt-config --libs`
+               dnl See the matching libxml check below for why this pins
+               dnl xslt-config to the directory given to --with-system-libxslt
+               dnl instead of resolving a bare "xslt-config" off PATH.
+               if test "$with_system_libxslt" != "yes" -a -n 
"$with_system_libxslt"; then
+                       XSLT_CONFIG="$with_system_libxslt/bin/xslt-config"
+                       if test ! -x "$XSLT_CONFIG"; then
+                               
AC_MSG_ERROR([--with-system-libxslt=$with_system_libxslt given, but 
$XSLT_CONFIG not found or not executable])
+                       fi
+               else
+                       AC_PATH_PROG(XSLT_CONFIG, xslt-config, [])
+                       if test -z "$XSLT_CONFIG"; then
+                               AC_MSG_ERROR([xslt-config not found on PATH])
+                       fi
+               fi
+               LIBXSLT_CFLAGS=`$XSLT_CONFIG --cflags`
+               LIBXSLT_LIBS=`$XSLT_CONFIG --libs`
+               LIBXSLT_PREFIX=`$XSLT_CONFIG --prefix`
        fi
 
    dnl Check for xsltproc
@@ -3969,6 +3984,7 @@ fi
 AC_SUBST(SYSTEM_LIBXSLT)
 AC_SUBST(LIBXSLT_CFLAGS)
 AC_SUBST(LIBXSLT_LIBS)
+AC_SUBST(LIBXSLT_PREFIX)
 
 
 dnl ===================================================================
@@ -3985,8 +4001,27 @@ if test -n "$with_system_libxml" -o -n 
"$with_system_libs" -o \
        if test "$_os" != "Darwin"; then
                PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
        else
-               LIBXML_CFLAGS=`xml2-config --cflags`
-               LIBXML_LIBS=`xml2-config --libs`
+               dnl A bare "xml2-config" resolves off whatever happens to be
+               dnl first on PATH, which is ambiguous when several package
+               dnl managers each ship their own libxml2 (MacPorts, Homebrew,
+               dnl a hand-built static copy, ...). When --with-system-libxml
+               dnl is given an actual directory (not just a bare "yes"), pin
+               dnl xml2-config to that prefix explicitly so the intended copy
+               dnl can't be shadowed by PATH order.
+               if test "$with_system_libxml" != "yes" -a -n 
"$with_system_libxml"; then
+                       XML2_CONFIG="$with_system_libxml/bin/xml2-config"
+                       if test ! -x "$XML2_CONFIG"; then
+                               
AC_MSG_ERROR([--with-system-libxml=$with_system_libxml given, but $XML2_CONFIG 
not found or not executable])
+                       fi
+               else
+                       AC_PATH_PROG(XML2_CONFIG, xml2-config, [])
+                       if test -z "$XML2_CONFIG"; then
+                               AC_MSG_ERROR([xml2-config not found on PATH])
+                       fi
+               fi
+               LIBXML_CFLAGS=`$XML2_CONFIG --cflags`
+               LIBXML_LIBS=`$XML2_CONFIG --libs`
+               LIBXML_PREFIX=`$XML2_CONFIG --prefix`
        fi
 else
     AC_MSG_RESULT([internal])
@@ -3996,6 +4031,7 @@ fi
 AC_SUBST(SYSTEM_LIBXML)
 AC_SUBST(LIBXML_CFLAGS)
 AC_SUBST(LIBXML_LIBS)
+AC_SUBST(LIBXML_PREFIX)
 
 
 dnl ===================================================================
@@ -4633,6 +4669,11 @@ AC_SUBST(COINMP_LIBS)
 dnl ===================================================================
 dnl Check for system curl
 dnl ===================================================================
+dnl Darwin always treats curl as external (see the "-o \"$_os\" = \"Darwin\""
+dnl clause below), regardless of whether --with-system-curl was actually
+dnl given a directory -- capture the as-given value first, before it gets
+dnl forced to a bare "yes", so a real --with-system-curl=DIR isn't lost.
+with_system_curl_dir="$with_system_curl"
 if test "$_os" = "Darwin" && test "$with_system_curl" != "no"; then
    with_system_curl=yes
 fi
@@ -4642,9 +4683,19 @@ if test -n "$with_system_curl" -o -n "$with_system_libs" 
&& \
    AC_MSG_RESULT([external])
    SYSTEM_CURL=YES
 
-   AC_PATH_PROG( CURLCONFIG, curl-config)
-   if test -z "$CURLCONFIG"; then
-      AC_MSG_ERROR([install curl to run this script])
+   dnl See the matching libxml check above for why this pins
+   dnl curl-config to the directory given to --with-system-curl instead
+   dnl of resolving a bare "curl-config" off PATH.
+   if test "$with_system_curl_dir" != "yes" -a -n "$with_system_curl_dir"; then
+      CURLCONFIG="$with_system_curl_dir/bin/curl-config"
+      if test ! -x "$CURLCONFIG"; then
+         AC_MSG_ERROR([--with-system-curl=$with_system_curl_dir given, but 
$CURLCONFIG not found or not executable])
+      fi
+   else
+      AC_PATH_PROG( CURLCONFIG, curl-config)
+      if test -z "$CURLCONFIG"; then
+         AC_MSG_ERROR([install curl to run this script])
+      fi
    fi
 
    # check curl version
@@ -4667,6 +4718,7 @@ if test -n "$with_system_curl" -o -n "$with_system_libs" 
&& \
 
    CURL_LIBS=`$CURLCONFIG --libs`
    CURL_CFLAGS=`$CURLCONFIG --cflags`
+   CURL_PREFIX=`$CURLCONFIG --prefix`
 else
    AC_MSG_RESULT([internal])
    SYSTEM_CURL=NO
@@ -4675,6 +4727,7 @@ fi
 AC_SUBST(SYSTEM_CURL)
 AC_SUBST(CURL_CFLAGS)
 AC_SUBST(CURL_LIBS)
+AC_SUBST(CURL_PREFIX)
 
 dnl ===================================================================
 dnl Check for system mdds
diff --git a/main/forms/util/makefile.mk b/main/forms/util/makefile.mk
index dea1f96486..887f0f1f9d 100644
--- a/main/forms/util/makefile.mk
+++ b/main/forms/util/makefile.mk
@@ -56,12 +56,28 @@ SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
 # plain "-lxml2" (as pulled in by LIBXML2LIB) resolves to that bundled
 # copy instead of the configured --with-system-libxml one, and it is
 # missing symbols (xmlXPathValuePush, xmlXPathValuePop) that xformsxpath
-# needs. Link the intended libxml2 statically by absolute path so the
-# search order can't shadow it and no dylib needs to be bundled.
-# The static archive carries no dependency info (unlike a dylib, which
-# records its own link to libz), so zlib must be linked explicitly here
-# to satisfy libxml2's HTTP/gzip symbols (deflate, inflate, gzopen, ...).
-FORMS_LIBXML2LIB:=$(shell xml2-config --prefix)/lib/libxml2.a $(ZLIB3RDLIB)
+# needs. Link the intended libxml2 by absolute path so the search order
+# can't shadow it.
+#
+# The path is built from $(LIBXML_PREFIX), not a live `xml2-config`
+# lookup -- see the matching comment in xmlsecurity/util/makefile.mk for
+# why: $(LIBXML_PREFIX) is resolved exactly once by `./configure`
+# (honoring the directory given to --with-system-libxml=DIR) and exported
+# via the generated *Env.Set.sh script, so it can't drift from what
+# configure actually resolved the way a fresh `xml2-config` shell-out at
+# dmake time could.
+#
+# Prefer the dylib when one is actually present at that prefix (it
+# records its own transitive links, e.g. to libz, so nothing extra needs
+# to be added); fall back to the static archive -- which carries no
+# dependency info, so zlib must be linked explicitly to satisfy libxml2's
+# HTTP/gzip symbols (deflate, inflate, gzopen, ...) -- when no dylib
+# exists there.
+.IF "$(shell test -f $(LIBXML_PREFIX)/lib/libxml2.dylib && echo yes)"=="yes"
+FORMS_LIBXML2LIB:=$(LIBXML_PREFIX)/lib/libxml2.dylib
+.ELSE
+FORMS_LIBXML2LIB:=$(LIBXML_PREFIX)/lib/libxml2.a $(ZLIB3RDLIB)
+.ENDIF
 .ELSE
 FORMS_LIBXML2LIB=$(LIBXML2LIB)
 .ENDIF
diff --git a/main/set_soenv.in b/main/set_soenv.in
index e0c696e4a9..167a145f6b 100644
--- a/main/set_soenv.in
+++ b/main/set_soenv.in
@@ -1984,6 +1984,7 @@ ToFile( "SYSTEM_LIBXML",     "@SYSTEM_LIBXML@",    "e" );
 ToFile( "USE_FT_EMBOLDEN",   "@USE_FT_EMBOLDEN@",  "e" );
 ToFile( "LIBXML_CFLAGS",     "@LIBXML_CFLAGS@",    "e" );
 ToFile( "LIBXML_LIBS",       "@LIBXML_LIBS@",      "e" );
+ToFile( "LIBXML_PREFIX",     "@LIBXML_PREFIX@",    "e" );
 ToFile( "SYSTEM_EXPAT",      "@SYSTEM_EXPAT@",     "e" );
 ToFile( "ENABLE_MYSQLC",     "@ENABLE_MYSQLC@",    "e" );
 ToFile( "SYSTEM_MYSQL",      "@SYSTEM_MYSQL@",     "e" );
@@ -2012,11 +2013,13 @@ ToFile( 
"SYSTEM_ODBC_HEADERS","@SYSTEM_ODBC_HEADERS@","e" );
 ToFile( "SYSTEM_LIBXSLT",    "@SYSTEM_LIBXSLT@",   "e" );
 ToFile( "LIBXSLT_CFLAGS",    "@LIBXSLT_CFLAGS@",   "e" );
 ToFile( "LIBXSLT_LIBS",      "@LIBXSLT_LIBS@",     "e" );
+ToFile( "LIBXSLT_PREFIX",    "@LIBXSLT_PREFIX@",   "e" );
 ToFile( "SYSTEM_SANE_HEADER","@SYSTEM_SANE_HEADER@","e" );
 ToFile( "SYSTEM_XRENDER_HEADERS","@SYSTEM_XRENDER_HEADERS@","e" );
 ToFile( "SYSTEM_CURL",       "@SYSTEM_CURL@",      "e" );
 ToFile( "CURL_CFLAGS",       "@CURL_CFLAGS@",      "e" );
 ToFile( "CURL_LIBS",         "@CURL_LIBS@",        "e" );
+ToFile( "CURL_PREFIX",       "@CURL_PREFIX@",      "e" );
 ToFile( "SYSTEM_BOOST",      "@SYSTEM_BOOST@",     "e" );
 ToFile( "SYSTEM_MDDS",       "@SYSTEM_MDDS@",      "e" );
 ToFile( "SYSTEM_VIGRA",      "@SYSTEM_VIGRA@",     "e" );
diff --git a/main/xmlsecurity/util/makefile.mk 
b/main/xmlsecurity/util/makefile.mk
index 34fe3c8a9b..2e80734b44 100644
--- a/main/xmlsecurity/util/makefile.mk
+++ b/main/xmlsecurity/util/makefile.mk
@@ -125,13 +125,44 @@ SHL2STDLIBS+= $(NSS3LIB) $(NSPR4LIB)
 # plain "-lxml2" (as pulled in by NSSCRYPTOLIBS via LIBXML2LIB) resolves
 # to that bundled copy instead of the configured --with-system-libxml one,
 # and it is missing symbols (xmlCtxtPushInput, xmlXPathValuePush) that
-# xmlsec1 needs. Link the intended libxml2 statically by absolute path
-# so the search order can't shadow it and no dylib needs to be bundled.
-# The static archive carries no dependency info (unlike a dylib, which
-# records its own link to libz), so zlib must be linked explicitly here
-# to satisfy libxml2's HTTP/gzip symbols (deflate, inflate, gzopen, ...).
-XMLSECURITY_SYSTEM_LIBXML2:=$(shell xml2-config --prefix)/lib/libxml2.a
-SHL2STDLIBS+= $(XMLSECLIB-NSS) $(XMLSECLIB) $(XMLSECURITY_SYSTEM_LIBXML2) 
$(ZLIB3RDLIB) $(NSS3LIB) $(NSPR4LIB) $(PLC4LIB)
+# xmlsec1 needs. Link the intended libxml2 by absolute path so the search
+# order can't shadow it.
+#
+# The path is built from $(LIBXML_PREFIX), not a live `xml2-config`
+# lookup: $(LIBXML_PREFIX) is resolved exactly once by `./configure`
+# (honoring the directory given to --with-system-libxml=DIR, see
+# configure.ac's libxml check) and exported via the generated
+# *Env.Set.sh script -- the same mechanism that already delivers
+# $(LIBXML_CFLAGS)/$(LIBXML_LIBS) (aka $(LIBXML2LIB), solenv/inc/libs.mk)
+# to every other module. Re-running `xml2-config` here at build time
+# instead would re-do that PATH-dependent lookup a second time,
+# independently of configure -- if the build-resume shell's PATH ever
+# differs from the configure shell's (e.g. MacPorts' /opt/local ends up
+# ahead of the intended prefix), that would silently link a stray
+# libxml2.a instead of the intended one, pulling in a different, unrelated
+# set of missing transitive symbols (seen in practice: ICU + GNU libiconv
+# from a MacPorts copy on one machine, liblzma from a different stray copy
+# on another). Going through $(LIBXML_PREFIX) removes that ambiguity.
+#
+# Prefer the dylib when one is actually present at that prefix: unlike a
+# static archive, a dylib records its own transitive links (e.g. to libz),
+# so the linker resolves those automatically and no extra -lz/-llzma is
+# needed. Fall back to the static archive (community builds normally only
+# install that, via --enable-shared=no) when no dylib exists there.
+.IF "$(shell test -f $(LIBXML_PREFIX)/lib/libxml2.dylib && echo yes)"=="yes"
+XMLSECURITY_SYSTEM_LIBXML2:=$(LIBXML_PREFIX)/lib/libxml2.dylib
+XMLSECURITY_SYSTEM_LIBXML2_EXTRALIBS:=
+.ELSE
+XMLSECURITY_SYSTEM_LIBXML2:=$(LIBXML_PREFIX)/lib/libxml2.a
+# The static archive carries no dependency info, so zlib must be linked
+# explicitly here to satisfy libxml2's HTTP/gzip symbols (deflate,
+# inflate, gzopen, ...). liblzma is linked only if actually present next
+# to it: it's not part of the documented static-lib bundle, so only
+# needed if this libxml2 build happens to have xz support compiled in.
+XMLSECURITY_SYSTEM_LIBLZMA:=$(shell test -f $(LIBXML_PREFIX)/lib/liblzma.a -o 
-f $(LIBXML_PREFIX)/lib/liblzma.dylib && echo $(LIBXML_PREFIX)/lib/liblzma.a)
+XMLSECURITY_SYSTEM_LIBXML2_EXTRALIBS:=$(ZLIB3RDLIB) 
$(XMLSECURITY_SYSTEM_LIBLZMA)
+.ENDIF
+SHL2STDLIBS+= $(XMLSECLIB-NSS) $(XMLSECLIB) $(XMLSECURITY_SYSTEM_LIBXML2) 
$(XMLSECURITY_SYSTEM_LIBXML2_EXTRALIBS) $(NSS3LIB) $(NSPR4LIB) $(PLC4LIB)
 .ELSE
 SHL2STDLIBS+= $(NSSCRYPTOLIBS)
 .ENDIF

Reply via email to