On 7/25/20 11:05 AM, minf...@apache.org wrote: > Author: minfrin > Date: Sat Jul 25 09:05:54 2020 > New Revision: 1880286 > > URL: http://svn.apache.org/viewvc?rev=1880286&view=rev > Log: > Use the xml2-config tool to configure libxml2. Revert changes to expat build > that prevented the expat library being propagated to APR. > > Modified: > apr/apr/trunk/build/xml.m4 > > Modified: apr/apr/trunk/build/xml.m4 > URL: > http://svn.apache.org/viewvc/apr/apr/trunk/build/xml.m4?rev=1880286&r1=1880285&r2=1880286&view=diff > ============================================================================== > --- apr/apr/trunk/build/xml.m4 (original) > +++ apr/apr/trunk/build/xml.m4 Sat Jul 25 09:05:54 2020 > @@ -139,56 +149,57 @@ dnl APU_FIND_LIBXML2: figure out where L > dnl > AC_DEFUN([APU_FIND_LIBXML2], [ > > -save_cppflags="$CPPFLAGS" > - > apu_has_libxml2=0 > apu_try_libxml2=0 > > +old_libs="$LIBS" > +old_cppflags="$CPPFLAGS" > +old_ldflags="$LDFLAGS" > + > AC_ARG_WITH([libxml2], > [ --with-libxml2=DIR specify libxml2 location], [ > if test "$withval" = "yes"; then > - apu_try_libxml2=1 > - APR_ADDTO(INCLUDES, [-I/usr/include/libxml2]) > - elif test "$withval" != "no"; then > - apu_try_libxml2=1 > - APR_ADDTO(INCLUDES, [-I$withval/include/libxml2]) > - if test "$withval" != "/usr"; then > - APR_ADDTO(LDFLAGS, [-L$withval/lib]) > + AC_PATH_TOOL([XML2_CONFIG],[xml2-config]) > + if test "x$XML2_CONFIG" != 'x'; then > + xml2_CPPFLAGS="`$XML2_CONFIG --cflags`" > + xml2_LIBS="`$XML2_CONFIG --libs`" > + > + APR_ADDTO(CPPFLAGS, [$xml2_CPPFLAGS]) > + APR_ADDTO(LIBS, [$xml2_LIBS]) > fi > - fi > - if test ${apu_try_libxml2} = "1" ; then > > - #test for libxml2 > - AC_CACHE_CHECK([libxml2], [apu_cv_libxml2], [ > - apu_libxml2_CPPFLAGS=$CPPFLAGS > - apu_libxml2_LIBS="$LIBS -lxml2" > - CPPFLAGS="$CPPFLAGS $INCLUDES" > - LIBS="$LIBS -lxml2" > - AC_TRY_LINK( > - [#include <libxml/parser.h>], > - [xmlSAXHandler sax; xmlCreatePushParserCtxt(&sax, NULL, NULL, 0, > NULL);], > - [apu_cv_libxml2=yes], > - [apu_cv_libxml2=no], > - ) > - CPPFLAGS=$apu_libxml2_CPPFLAGS > - LIBS=$apu_libxml2_LIBS > - ]) > - if test $apu_cv_libxml2 = yes ; then > - AC_DEFINE([HAVE_LIBXML2_H], 1, [libxml2 found]) > - apu_has_libxml2=1 > + AC_CHECK_HEADERS(libxml/parser.h, AC_CHECK_LIB(xml2, > xmlCreatePushParserCtxt, [apu_has_libxml2=1])) > + elif test "$withval" != "no"; then > + AC_PATH_TOOL([XML2_CONFIG],[xml2-config],,[$withval/bin]) > + if test "x$XML2_CONFIG" != 'x'; then > + xml2_CPPFLAGS="`$XML2_CONFIG --cflags`" > + xml2_LIBS="`$XML2_CONFIG --libs`" > else > - apu_has_libxml2=0 > + xml2_CPPFLAGS="-I$withval/include/libxml2" > + xml2_LDFLAGS="-L$withval/lib64 -L$withval/lib" Where do we use xml2_LDFLAGS and why don't we need to set it in the case that we have xml2-config? > fi > + > + APR_ADDTO(CPPFLAGS, [$xml2_CPPFLAGS]) > + APR_ADDTO(LIBS, [$xml2_LIBS]) > + > + AC_MSG_NOTICE(checking for libxml2 in $withval) > + AC_CHECK_HEADERS(libxml/parser.h, AC_CHECK_LIB(xml2, > xmlCreatePushParserCtxt, [apu_has_libxml2=1])) > fi > + ], [ > + AC_CHECK_HEADERS(libxml/parser.h, AC_CHECK_LIB(xml2, > xmlCreatePushParserCtxt, [apu_has_libxml2=1])) > ]) > AC_SUBST(apu_has_libxml2) > > if test ${apu_has_libxml2} = "1" ; then > - APR_ADDTO(APRUTIL_EXPORT_LIBS, [-lxml2]) > - APR_ADDTO(LIBS, [-lxml2]) > + APR_ADDTO(APRUTIL_CPPFLAGS, [$xml2_CPPFLAGS]) > + APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$xml2_CPPFLAGS]) > + APR_ADDTO(APRUTIL_LIBS, [$xml2_LIBS]) > fi > > -CPPFLAGS=$save_cppflags > +LIBS="$old_libs" > +CPPFLAGS="$old_cppflags" > +LDFLAGS="$old_ldflags" > + > ]) > > dnl > Regards RĂ¼diger