Created attachment 33673 [details] [review] Add fallback search of expat by pkg-config The latest expat installs pkg-config file, so please consider searching expat pkg-config, as libxml2 is also searched by pkg-config. Patch is attached. diff --git a/configure.in b/configure.in index aba9d82..b4a27e9 100644 --- a/configure.in +++ b/configure.in @@ -64,6 +64,7 @@ AC_PROG_LN_S AC_LIBTOOL_WIN32_DLL AM_PROG_LIBTOOL AC_PROG_MAKE_SET +PKG_PROG_PKG_CONFIG dnl ========================================================================== @@ -246,12 +247,30 @@ AC_ARG_WITH(expat, [ --with-expat=DIR Use Expat in DIR AC_ARG_WITH(expat-includes, [ --with-expat-includes=DIR Use Expat includes in DIR], expat_includes=$withval, expat_includes=yes) AC_ARG_WITH(expat-lib, [ --with-expat-lib=DIR Use Expat library in DIR], expat_lib=$withval, expat_lib=yes) +# if none of expat,expat-includes,expat-libs are specified, +# pkg-config is referred. +if test "$expat" = "yes" -a "$expat_includes" = "yes" -a "$expat_lib" = "yes" +then + PKG_CHECK_MODULES(expat, expat, [ + expat=`${PKG_CONFIG} --variable=prefix expat` + expat_includes="pkg-config" + expat_lib="pkg-config" + AC_MSG_WARN([expat in ${expat} will be used]) + ],[ + AC_MSG_WARN([pkg-config cannot find expat]) + ] + ) +fi + if test "$enable_libxml2" != "yes"; then case "$expat" in no) ;; *) case "$expat_includes" in + pkg-config) + EXPAT_CFLAGS=`${PKG_CONFIG} --cflags expat` + ;; yes) case "$expat" in yes) @@ -269,6 +288,9 @@ if test "$enable_libxml2" != "yes"; then ;; esac case "$expat_lib" in + pkg-config) + EXPAT_LIBS=`${PKG_CONFIG} --libs expat` + ;; yes) case "$expat" in yes) @@ -317,8 +339,8 @@ if test "$enable_libxml2" != "yes"; then expat=no ;; yes) - AC_CHECK_FUNCS(XML_SetDoctypeDeclHandler) - case "$ac_cv_func_XML_SetDoctypeDeclHandler" in + AC_CHECK_LIB(expat, XML_SetDoctypeDeclHandler) + case "$ac_cv_lib_expat_XML_SetDoctypeDeclHandler" in yes) HAVE_EXPAT=1 AC_SUBST(HAVE_EXPAT) @@ -355,8 +377,6 @@ fi AC_ARG_ENABLE(libxml2, [ --enable-libxml2 Use libxml2 instead of Expat]) -PKG_PROG_PKG_CONFIG - if test "$enable_libxml2" = "yes" -o "$expat" = "no"; then PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6]) AC_DEFINE_UNQUOTED(ENABLE_LIBXML2,1,[Use libxml2 instead of Expat])
I guess that would be sufficient to rely on pkgconfig only and get rid of the old code there.
Revised configure.in. that should works enough. if one wants the old behavior, they could set EXPAT_CFLAGS and EXPAT_LIBS to skip pkgconfig checks.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.