From cedc8081d6804399d7204c6e1677319e0eb12adf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Wed, 12 Feb 2020 16:52:22 +0100 Subject: [PATCH] Add libxml2 and libxslt detection using pkg-config. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko (cherry picked from commit b2a61b75bb5671b3aca0f9dbfe078de2a464a982) --- filters/xsltfilter/configure.in.in | 113 +++++++++++++++++------------ 1 file changed, 66 insertions(+), 47 deletions(-) diff --git a/filters/xsltfilter/configure.in.in b/filters/xsltfilter/configure.in.in index 5480adc0f..b4ea41f8a 100644 --- a/filters/xsltfilter/configure.in.in +++ b/filters/xsltfilter/configure.in.in @@ -1,62 +1,81 @@ +KDE_PKG_CHECK_MODULES(LIBXML, libxml-2.0, + have_libxml=yes, have_libxml=no) -KDE_FIND_PATH(xml2-config, XML_CONFIG, [${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin], [ - AC_MSG_WARN([Could not find libxml2 anywhere, check ftp://xmlsoft.org/ for libxml >= 2.4.8. (we also keep a version of it in tdesupport for CVS users' convience)]) - HELP_SUBDIR= -]) - -if test -n "$XML_CONFIG"; then - vers=`$XML_CONFIG --version 2>/dev/null | $SED -e 's/libxml //' | $AWK 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` - if test -n "$vers" && test "$vers" -ge 2004008 - then - LIBXML_LIBS="`$XML_CONFIG --libs`" - LIBXML_RPATH= - for args in $LIBXML_LIBS; do - case $args in - -L*) - LIBXML_RPATH="$LIBXML_RPATH $args" - ;; - esac - done - LIBXML_RPATH=`echo $LIBXML_RPATH | $SED -e "s/-L/-R/g"` - LIBXML_CFLAGS="`$XML_CONFIG --cflags`" +if test "x$have_libxml" != "xyes"; then + KDE_FIND_PATH(xml2-config, XML_CONFIG, [${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin], [ + AC_MSG_WARN([Could not find libxml2 anywhere, check ftp://xmlsoft.org/ for libxml >= 2.4.8. (we also keep a version of it in tdesupport for CVS users' convience)]) + HELP_SUBDIR= + ]) - KDE_FIND_PATH(xmllint, XMLLINT, [${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin], [XMLLINT=""]) - AC_DEFINE_UNQUOTED(XMLLINT, "$XMLLINT", [Defines the executable of xmllint]) - else - AC_MSG_WARN([You need at least libxml 2.4.8]) - HELP_SUBDIR= + if test -n "$XML_CONFIG"; then + vers=`$XML_CONFIG --version 2>/dev/null | $SED -e 's/libxml //' | $AWK 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` + if test -n "$vers" && test "$vers" -ge 2004008 + then + LIBXML_LIBS="`$XML_CONFIG --libs`" + LIBXML_CFLAGS="`$XML_CONFIG --cflags`" + have_libxml=yes + else + AC_MSG_WARN([You need at least libxml 2.4.8]) + HELP_SUBDIR= + fi fi fi -KDE_FIND_PATH(xslt-config, XSLT_CONFIG, [${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin], [ - AC_MSG_WARN([Could not find libxslt anywhere, check ftp://xmlsoft.org/ for libxslt >= 1.0.7. (we also keep a version of it in tdesupport for CVS users' convience)]) - HELP_SUBDIR= -]) +if test "x$have_libxml" = "xyes"; then + KDE_FIND_PATH(xmllint, XMLLINT, [${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin], [XMLLINT=""]) + AC_DEFINE_UNQUOTED(XMLLINT, "$XMLLINT", [Defines the executable of xmllint]) +fi -if test -n "$XSLT_CONFIG"; then - vers=`$XSLT_CONFIG --version 2>/dev/null | $AWK 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` - if test -n "$vers" && test "$vers" -ge 1000007; then - LIBXSLT_LIBS="`$XSLT_CONFIG --libs`" - LIBXSLT_RPATH= - for args in $LIBXSLT_LIBS; do - case $args in - -L*) - LIBXSLT_RPATH="$LIBXSLT_RPATH $args" - ;; - esac - done - LIBXSLT_RPATH=`echo $LIBXSLT_RPATH | $SED -e "s/-L/-R/g"` - LIBXSLT_CFLAGS="`$XSLT_CONFIG --cflags`" - else - AC_MSG_WARN([You need at least libxslt 1.0.7]) - HELP_SUBDIR= - fi +KDE_PKG_CHECK_MODULES(LIBXSLT, libxslt, + have_libxslt=yes, have_libxslt=no) + +if test "x$have_libxslt" != "xyes"; then + KDE_FIND_PATH(xslt-config, XSLT_CONFIG, [${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin], [ + AC_MSG_WARN([Could not find libxslt anywhere, check ftp://xmlsoft.org/ for libxslt >= 1.0.7. (we also keep a version of it in tdesupport for CVS users' convience)]) + HELP_SUBDIR= + ]) + + if test -n "$XSLT_CONFIG"; then + vers=`$XSLT_CONFIG --version 2>/dev/null | $AWK 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` + if test -n "$vers" && test "$vers" -ge 1000007; then + LIBXSLT_LIBS="`$XSLT_CONFIG --libs`" + LIBXSLT_CFLAGS="`$XSLT_CONFIG --cflags`" + have_libxslt=yes + else + AC_MSG_WARN([You need at least libxslt 1.0.7]) + HELP_SUBDIR= + fi + fi fi + if test ! "$USE_RPATH" = "yes"; then LIBXSLT_RPATH= LIBXML_RPATH= +else + if test "x$have_libxml" = "xyes"; then + LIBXML_RPATH= + for args in $LIBXML_LIBS; do + case $args in + -L*) + LIBXML_RPATH="$LIBXML_RPATH $args" + ;; + esac + done + LIBXML_RPATH=`echo $LIBXML_RPATH | $SED -e "s/-L/-R/g"` + fi + if test "x$have_libxslt" = "xyes"; then + LIBXSLT_RPATH= + for args in $LIBXSLT_LIBS; do + case $args in + -L*) + LIBXSLT_RPATH="$LIBXSLT_RPATH $args" + ;; + esac + done + LIBXSLT_RPATH=`echo $LIBXSLT_RPATH | $SED -e "s/-L/-R/g"` + fi fi AC_SUBST(LIBXSLT_LIBS)