Add libxml2 and libxslt detection using pkg-config.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/10/head
Slávek Banko 4 years ago
parent 5aa6174ec9
commit 75760d5c71
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -40,26 +40,28 @@ dnl the ability to specify the location of the libxml
dnl library during linking and compilation. dnl library during linking and compilation.
dnl Mathieu Lacage 30/03/2000 dnl Mathieu Lacage 30/03/2000
dnl dnl
LIBXML_PREFIX=""
AC_ARG_WITH(libxml-prefix, KDE_PKG_CHECK_MODULES(LIBXML, libxml-2.0,
have_libxml=yes, have_libxml=no)
if test "x$have_libxml" != "xyes"; then
LIBXML_PREFIX=""
AC_ARG_WITH(libxml-prefix,
[ --with-libxml-prefix=[PFX] Specify location of libxml], [ --with-libxml-prefix=[PFX] Specify location of libxml],
LIBXML_PREFIX="$withval" LIBXML_PREFIX="$withval"
) )
if test "x${LIBXML_PREFIX}" != "x" if test "x${LIBXML_PREFIX}" != "x"
then then
AC_MSG_RESULT(Using a libxml prefix of ${LIBXML_PREFIX}) AC_MSG_RESULT(Using a libxml prefix of ${LIBXML_PREFIX})
fi fi
AC_SUBST(LIBXML_LIBS)
dnl Test for libxml2 version dnl Test for libxml2 version
XML_CONFIG="xml2-config" XML_CONFIG="xml2-config"
AC_MSG_CHECKING(for libxml libraries >= "2.6.0") AC_MSG_CHECKING(for libxml libraries >= "2.6.0")
XML_WARNING="" XML_WARNING=""
if test "x$LIBXML_PREFIX" != "x" if test "x$LIBXML_PREFIX" != "x"
then then
if ${LIBXML_PREFIX}/bin/xml2-config --libs print > /dev/null 2>&1 if ${LIBXML_PREFIX}/bin/xml2-config --libs print > /dev/null 2>&1
then then
XML_CONFIG=${LIBXML_PREFIX}/bin/xml2-config XML_CONFIG=${LIBXML_PREFIX}/bin/xml2-config
@ -67,17 +69,17 @@ then
XML_WARNING="1" XML_WARNING="1"
XML_CONFIG=xml2-config XML_CONFIG=xml2-config
fi fi
fi fi
AC_DEFUN([VERSION_TO_NUMBER], AC_DEFUN([VERSION_TO_NUMBER],
[`$1 | sed -e 's/libxml //' | $AWK 'BEGIN { FS = "."; } { printf "%d", [`$1 | sed -e 's/libxml //' | $AWK 'BEGIN { FS = "."; } { printf "%d",
([$]1* 1000 + [$]2) * 1000 + [$]3;}'`]) ([$]1* 1000 + [$]2) * 1000 + [$]3;}'`])
dnl dnl
dnl test version and init our variables dnl test version and init our variables
dnl dnl
if test "x$XML_CONFIG" != "x" if test "x$XML_CONFIG" != "x"
then then
vers=VERSION_TO_NUMBER($XML_CONFIG --version) vers=VERSION_TO_NUMBER($XML_CONFIG --version)
if test "$vers" -lt VERSION_TO_NUMBER(echo "2.6.0") if test "$vers" -lt VERSION_TO_NUMBER(echo "2.6.0")
then then
@ -89,44 +91,46 @@ then
LIBXML_LIBS="`$XML_CONFIG --libs`" LIBXML_LIBS="`$XML_CONFIG --libs`"
LIBXML_CFLAGS="`$XML_CONFIG --cflags`" LIBXML_CFLAGS="`$XML_CONFIG --cflags`"
LIBXML_PREFIX="$XML_CONFIG --prefix" LIBXML_PREFIX="$XML_CONFIG --prefix"
else else
AC_MSG_ERROR(Could not find libxml2 anywhere, check ftp://xmlsoft.org/.) AC_MSG_ERROR(Could not find libxml2 anywhere, check ftp://xmlsoft.org/.)
fi fi
if test "x${XML_WARNING}" != "x" if test "x${XML_WARNING}" != "x"
then then
AC_MSG_RESULT( AC_MSG_RESULT(
!!Warning!! using xml2-config in default path !!Warning!! using xml2-config in default path
) )
fi
fi fi
LIBXML_PREFIX_DIR="`$XML_CONFIG --prefix`"
AC_SUBST(XML_CONFIG)
AC_SUBST(LIBXML_PREFIX)
AC_SUBST(LIBXML_LIBS) AC_SUBST(LIBXML_LIBS)
AC_SUBST(LIBXML_CFLAGS) AC_SUBST(LIBXML_CFLAGS)
LIBXSLT_PREFIX=""
AC_ARG_WITH(libxslt-prefix, KDE_PKG_CHECK_MODULES(LIBXSLT, libexslt,
have_libexslt=yes, have_libexslt=no)
if test "x$have_libexslt" != "xyes"; then
LIBXSLT_PREFIX=""
AC_ARG_WITH(libxslt-prefix,
[ --with-libxslt-prefix=[PFX] Specify location of libxslt], [ --with-libxslt-prefix=[PFX] Specify location of libxslt],
LIBXSLT_PREFIX="$withval" LIBXSLT_PREFIX="$withval"
) )
if test "x${LIBXSLT_PREFIX}" != "x" if test "x${LIBXSLT_PREFIX}" != "x"
then then
AC_MSG_RESULT(Using a libxslt prefix of ${LIBXSLT_PREFIX}) AC_MSG_RESULT(Using a libxslt prefix of ${LIBXSLT_PREFIX})
fi fi
dnl dnl
dnl find libxslt dnl find libxslt
dnl dnl
XSLT_CONFIG="xslt-config" XSLT_CONFIG="xslt-config"
XSLT_WARNING="" XSLT_WARNING=""
AC_SUBST(LIBXSLT_REQUIRED_VERSION) AC_SUBST(LIBXSLT_REQUIRED_VERSION)
AC_MSG_CHECKING(for libxslt libraries >= $LIBXSLT_REQUIRED_VERSION) AC_MSG_CHECKING(for libxslt libraries >= $LIBXSLT_REQUIRED_VERSION)
if test "x$LIBXSLT_PREFIX" != "x" if test "x$LIBXSLT_PREFIX" != "x"
then then
if ${LIBXSLT_PREFIX}/bin/xslt-config --libs print > /dev/null 2>&1 if ${LIBXSLT_PREFIX}/bin/xslt-config --libs print > /dev/null 2>&1
then then
XSLT_CONFIG=${LIBXSLT_PREFIX}/bin/xslt-config XSLT_CONFIG=${LIBXSLT_PREFIX}/bin/xslt-config
@ -134,18 +138,18 @@ then
XSLT_WARNING="1" XSLT_WARNING="1"
XSLT_CONFIG=xslt-config XSLT_CONFIG=xslt-config
fi fi
fi fi
AC_DEFUN([VERSION_TO_NUMBER], AC_DEFUN([VERSION_TO_NUMBER],
[`$1 | sed -e 's/libxslt //' | $AWK 'BEGIN { FS = "."; } { printf "%d", [`$1 | sed -e 's/libxslt //' | $AWK 'BEGIN { FS = "."; } { printf "%d",
([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`]) ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`])
dnl dnl
dnl test version and init our variables dnl test version and init our variables
dnl dnl
if test "x$XSLT_CONFIG" != "x" if test "x$XSLT_CONFIG" != "x"
then then
vers=VERSION_TO_NUMBER($XSLT_CONFIG --version) vers=VERSION_TO_NUMBER($XSLT_CONFIG --version)
if test "$vers" -ge VERSION_TO_NUMBER(echo $LIBXSLT_REQUIRED_VERSION) if test "$vers" -ge VERSION_TO_NUMBER(echo $LIBXSLT_REQUIRED_VERSION)
then then
@ -155,7 +159,7 @@ then
if test "x$LIBXSLT_PREFIX" != "x" if test "x$LIBXSLT_PREFIX" != "x"
then then
AC_MSG_RESULT( AC_MSG_RESULT(
Don't forget to make sure that ${LIBXSLT_PREFIX}/lib has been added Don't forget to make sure that ${LIBXSLT_PREFIX}/lib has been added
to your LD_LIBRARY_PATH environment variable) to your LD_LIBRARY_PATH environment variable)
else else
LIBXSLT_PREFIX="$XSLT_CONFIG --prefix" LIBXSLT_PREFIX="$XSLT_CONFIG --prefix"
@ -164,20 +168,19 @@ Don't forget to make sure that ${LIBXSLT_PREFIX}/lib has been added
AC_MSG_ERROR(You need at least libxslt $LIBXSLT_REQUIRED_VERSION for this AC_MSG_ERROR(You need at least libxslt $LIBXSLT_REQUIRED_VERSION for this
version of xsldbg) version of xsldbg)
fi fi
else else
AC_MSG_ERROR(Could not find libxslt anywhere, check AC_MSG_ERROR(Could not find libxslt anywhere, check
ftp://xmlsoft.org/XSLT/.) ftp://xmlsoft.org/XSLT/.)
fi fi
if test "x${XSLT_WARNING}" != "x" if test "x${XSLT_WARNING}" != "x"
then then
AC_MSG_RESULT( AC_MSG_RESULT(
!!Warning!! using xslt-config in default path !!Warning!! using xslt-config in default path
) )
fi
fi fi
AC_SUBST(XSLT_CONFIG)
AC_SUBST(LIBXSLT_PREFIX)
AC_SUBST(LIBXSLT_LIBS) AC_SUBST(LIBXSLT_LIBS)
AC_SUBST(LIBXSLT_CFLAGS) AC_SUBST(LIBXSLT_CFLAGS)

Loading…
Cancel
Save