From 75760d5c71f9984d6b5cdea0784ceb9911289c4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Tue, 25 Feb 2020 21:05:16 +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 --- configure.in.in | 247 ++++++++++++++++++++++++------------------------ 1 file changed, 125 insertions(+), 122 deletions(-) diff --git a/configure.in.in b/configure.in.in index e7dceea1..b258738e 100644 --- a/configure.in.in +++ b/configure.in.in @@ -40,144 +40,147 @@ dnl the ability to specify the location of the libxml dnl library during linking and compilation. dnl Mathieu Lacage 30/03/2000 dnl -LIBXML_PREFIX="" -AC_ARG_WITH(libxml-prefix, - [ --with-libxml-prefix=[PFX] Specify location of libxml], - LIBXML_PREFIX="$withval" -) - -if test "x${LIBXML_PREFIX}" != "x" -then - AC_MSG_RESULT(Using a libxml prefix of ${LIBXML_PREFIX}) -fi - - -AC_SUBST(LIBXML_LIBS) -dnl Test for libxml2 version -XML_CONFIG="xml2-config" -AC_MSG_CHECKING(for libxml libraries >= "2.6.0") -XML_WARNING="" -if test "x$LIBXML_PREFIX" != "x" -then - if ${LIBXML_PREFIX}/bin/xml2-config --libs print > /dev/null 2>&1 - then - XML_CONFIG=${LIBXML_PREFIX}/bin/xml2-config - else - XML_WARNING="1" - XML_CONFIG=xml2-config - fi -fi +KDE_PKG_CHECK_MODULES(LIBXML, libxml-2.0, + have_libxml=yes, have_libxml=no) -AC_DEFUN([VERSION_TO_NUMBER], -[`$1 | sed -e 's/libxml //' | $AWK 'BEGIN { FS = "."; } { printf "%d", - ([$]1* 1000 + [$]2) * 1000 + [$]3;}'`]) +if test "x$have_libxml" != "xyes"; then + LIBXML_PREFIX="" + AC_ARG_WITH(libxml-prefix, + [ --with-libxml-prefix=[PFX] Specify location of libxml], + LIBXML_PREFIX="$withval" + ) -dnl -dnl test version and init our variables -dnl -if test "x$XML_CONFIG" != "x" -then - vers=VERSION_TO_NUMBER($XML_CONFIG --version) - if test "$vers" -lt VERSION_TO_NUMBER(echo "2.6.0") - then - CXXFLAGS="$CXXFLAGS -DLIBXML_2_5" - AC_MSG_RESULT(not found - assuming 2.5.x) - else - AC_MSG_RESULT(found) - fi - LIBXML_LIBS="`$XML_CONFIG --libs`" - LIBXML_CFLAGS="`$XML_CONFIG --cflags`" - LIBXML_PREFIX="$XML_CONFIG --prefix" -else - AC_MSG_ERROR(Could not find libxml2 anywhere, check ftp://xmlsoft.org/.) -fi + if test "x${LIBXML_PREFIX}" != "x" + then + AC_MSG_RESULT(Using a libxml prefix of ${LIBXML_PREFIX}) + fi + + dnl Test for libxml2 version + XML_CONFIG="xml2-config" + AC_MSG_CHECKING(for libxml libraries >= "2.6.0") + XML_WARNING="" + if test "x$LIBXML_PREFIX" != "x" + then + if ${LIBXML_PREFIX}/bin/xml2-config --libs print > /dev/null 2>&1 + then + XML_CONFIG=${LIBXML_PREFIX}/bin/xml2-config + else + XML_WARNING="1" + XML_CONFIG=xml2-config + fi + fi + + AC_DEFUN([VERSION_TO_NUMBER], + [`$1 | sed -e 's/libxml //' | $AWK 'BEGIN { FS = "."; } { printf "%d", + ([$]1* 1000 + [$]2) * 1000 + [$]3;}'`]) + + dnl + dnl test version and init our variables + dnl + if test "x$XML_CONFIG" != "x" + then + vers=VERSION_TO_NUMBER($XML_CONFIG --version) + if test "$vers" -lt VERSION_TO_NUMBER(echo "2.6.0") + then + CXXFLAGS="$CXXFLAGS -DLIBXML_2_5" + AC_MSG_RESULT(not found - assuming 2.5.x) + else + AC_MSG_RESULT(found) + fi + LIBXML_LIBS="`$XML_CONFIG --libs`" + LIBXML_CFLAGS="`$XML_CONFIG --cflags`" + LIBXML_PREFIX="$XML_CONFIG --prefix" + else + AC_MSG_ERROR(Could not find libxml2 anywhere, check ftp://xmlsoft.org/.) + fi -if test "x${XML_WARNING}" != "x" -then - AC_MSG_RESULT( -!!Warning!! using xml2-config in default path -) + if test "x${XML_WARNING}" != "x" + then + AC_MSG_RESULT( + !!Warning!! using xml2-config in default path + ) + fi fi -LIBXML_PREFIX_DIR="`$XML_CONFIG --prefix`" - -AC_SUBST(XML_CONFIG) -AC_SUBST(LIBXML_PREFIX) AC_SUBST(LIBXML_LIBS) AC_SUBST(LIBXML_CFLAGS) -LIBXSLT_PREFIX="" -AC_ARG_WITH(libxslt-prefix, - [ --with-libxslt-prefix=[PFX] Specify location of libxslt], - LIBXSLT_PREFIX="$withval" -) - -if test "x${LIBXSLT_PREFIX}" != "x" -then - AC_MSG_RESULT(Using a libxslt prefix of ${LIBXSLT_PREFIX}) -fi - -dnl -dnl find libxslt -dnl -XSLT_CONFIG="xslt-config" -XSLT_WARNING="" -AC_SUBST(LIBXSLT_REQUIRED_VERSION) -AC_MSG_CHECKING(for libxslt libraries >= $LIBXSLT_REQUIRED_VERSION) -if test "x$LIBXSLT_PREFIX" != "x" -then - if ${LIBXSLT_PREFIX}/bin/xslt-config --libs print > /dev/null 2>&1 - then - XSLT_CONFIG=${LIBXSLT_PREFIX}/bin/xslt-config - else - XSLT_WARNING="1" - XSLT_CONFIG=xslt-config - fi -fi +KDE_PKG_CHECK_MODULES(LIBXSLT, libexslt, + have_libexslt=yes, have_libexslt=no) -AC_DEFUN([VERSION_TO_NUMBER], -[`$1 | sed -e 's/libxslt //' | $AWK 'BEGIN { FS = "."; } { printf "%d", - ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`]) +if test "x$have_libexslt" != "xyes"; then + LIBXSLT_PREFIX="" + AC_ARG_WITH(libxslt-prefix, + [ --with-libxslt-prefix=[PFX] Specify location of libxslt], + LIBXSLT_PREFIX="$withval" + ) -dnl -dnl test version and init our variables -dnl -if test "x$XSLT_CONFIG" != "x" -then - vers=VERSION_TO_NUMBER($XSLT_CONFIG --version) - if test "$vers" -ge VERSION_TO_NUMBER(echo $LIBXSLT_REQUIRED_VERSION) - then - LIBXSLT_LIBS="-lexslt `$XSLT_CONFIG --libs`" - LIBXSLT_CFLAGS="`$XSLT_CONFIG --cflags`" - AC_MSG_RESULT(found) - if test "x$LIBXSLT_PREFIX" != "x" - then - AC_MSG_RESULT( -Don't forget to make sure that ${LIBXSLT_PREFIX}/lib has been added - to your LD_LIBRARY_PATH environment variable) + if test "x${LIBXSLT_PREFIX}" != "x" + then + AC_MSG_RESULT(Using a libxslt prefix of ${LIBXSLT_PREFIX}) + fi + + dnl + dnl find libxslt + dnl + XSLT_CONFIG="xslt-config" + XSLT_WARNING="" + AC_SUBST(LIBXSLT_REQUIRED_VERSION) + AC_MSG_CHECKING(for libxslt libraries >= $LIBXSLT_REQUIRED_VERSION) + if test "x$LIBXSLT_PREFIX" != "x" + then + if ${LIBXSLT_PREFIX}/bin/xslt-config --libs print > /dev/null 2>&1 + then + XSLT_CONFIG=${LIBXSLT_PREFIX}/bin/xslt-config + else + XSLT_WARNING="1" + XSLT_CONFIG=xslt-config + fi + fi + + + AC_DEFUN([VERSION_TO_NUMBER], + [`$1 | sed -e 's/libxslt //' | $AWK 'BEGIN { FS = "."; } { printf "%d", + ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`]) + + dnl + dnl test version and init our variables + dnl + if test "x$XSLT_CONFIG" != "x" + then + vers=VERSION_TO_NUMBER($XSLT_CONFIG --version) + if test "$vers" -ge VERSION_TO_NUMBER(echo $LIBXSLT_REQUIRED_VERSION) + then + LIBXSLT_LIBS="-lexslt `$XSLT_CONFIG --libs`" + LIBXSLT_CFLAGS="`$XSLT_CONFIG --cflags`" + AC_MSG_RESULT(found) + if test "x$LIBXSLT_PREFIX" != "x" + then + AC_MSG_RESULT( + Don't forget to make sure that ${LIBXSLT_PREFIX}/lib has been added + to your LD_LIBRARY_PATH environment variable) + else + LIBXSLT_PREFIX="$XSLT_CONFIG --prefix" + fi + else + AC_MSG_ERROR(You need at least libxslt $LIBXSLT_REQUIRED_VERSION for this + version of xsldbg) + fi else - LIBXSLT_PREFIX="$XSLT_CONFIG --prefix" - fi - else - AC_MSG_ERROR(You need at least libxslt $LIBXSLT_REQUIRED_VERSION for this - version of xsldbg) - fi -else - AC_MSG_ERROR(Could not find libxslt anywhere, check - ftp://xmlsoft.org/XSLT/.) -fi + AC_MSG_ERROR(Could not find libxslt anywhere, check + ftp://xmlsoft.org/XSLT/.) + fi -if test "x${XSLT_WARNING}" != "x" -then - AC_MSG_RESULT( -!!Warning!! using xslt-config in default path -) + if test "x${XSLT_WARNING}" != "x" + then + AC_MSG_RESULT( + !!Warning!! using xslt-config in default path + ) + fi fi -AC_SUBST(XSLT_CONFIG) -AC_SUBST(LIBXSLT_PREFIX) AC_SUBST(LIBXSLT_LIBS) AC_SUBST(LIBXSLT_CFLAGS)