Re: [PATCH 3/3] Use pkg-config to check for libxml-2.0

Roumen Petrov <[email protected]> Sun, 16 Sep 2012 19:05:10 +0300
Newsgroups gmane.comp.gnome.lib.xslt
Message-ID <[email protected]>
Thierry Reding wrote:
> pkg-config is much better suited when cross-compiling than the various
> package-specific *-config scripts.
No way. Don't touch this part especially  in cross-compilation cases.


> Signed-off-by: Thierry Reding <[email protected]>
> ---
>   configure.ac | 113 ++---------------------------------------------------------
>   1 file changed, 2 insertions(+), 111 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 63e5a0a..96d1b0b 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -460,117 +460,8 @@ else
>   fi
>   AC_SUBST(WITH_DEBUGGER)
>   
> -dnl
> -dnl The following new parameters were added to offer
> -dnl the ability to specify the location of the libxml
> -dnl library during linking and compilation.
> -dnl
> -dnl original work - Mathieu Lacage 30/03/2000
> -dnl some tweaking - David Härdeman 30/10/2001
> -dnl
> -
> -LIBXML_CONFIG_PREFIX=""
> -LIBXML_SRC=""
> -
> -AC_ARG_WITH(libxml-prefix,
> -        [  --with-libxml-prefix=[PFX]		Specify location of libxml config],
> -	LIBXML_CONFIG_PREFIX=$withval
> -)
> -
> -AC_ARG_WITH(libxml-include-prefix,
> -        [  --with-libxml-include-prefix=[PFX]	Specify location of libxml headers],
> -        LIBXML_CFLAGS="-I$withval"
> -)
> -
> -AC_ARG_WITH(libxml-libs-prefix,
> -        [  --with-libxml-libs-prefix=[PFX]	Specify location of libxml libs],
> -        LIBXML_LIBS="-L$withval"
> -)
> -
> -AC_ARG_WITH(libxml-src,
> -	[  --with-libxml-src=[DIR]              For libxml thats not installed yet (sets all three above)],
> -	LIBXML_SRC="$withval"
> -)
> -AC_SUBST(LIBXML_SRC)
> -
> -dnl
> -dnl where is xml2-config
> -dnl
> -
> +PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= $LIBXML_REQUIRED_VERSION)
>   AC_SUBST(LIBXML_REQUIRED_VERSION)
> -AC_MSG_CHECKING(for libxml libraries >= $LIBXML_REQUIRED_VERSION)
> -if test "x$LIBXML_CONFIG_PREFIX" != "x"
> -then
> -	XML_CONFIG=${LIBXML_CONFIG_PREFIX}/bin/xml2-config
> -else
> -	XML_CONFIG=xml2-config
> -fi
> -
> -dnl
> -dnl imported from libxml2, c.f. #77827
> -dnl
> -if test "${GCC}" != "yes" ; then
> -    case "${host}" in
> -          *-*-hpux* )
> -	       CFLAGS="${CFLAGS} -Wp,-H30000"
> -	       ;;
> -          *-dec-osf* )
> -               CFLAGS="${CFLAGS} -ieee"
> -               ;;
> -    esac
> -else
> -    CFLAGS="${CFLAGS} -Wall"
> -    case "${host}" in
> -          alpha*-*-linux* )
> -	       CFLAGS="${CFLAGS} -mieee"
> -	       ;;
> -	  alpha*-*-osf* )
> -	       CFLAGS="${CFLAGS} -mieee"
> -	       ;;
> -    esac
> -fi
> -
> -dnl
> -dnl Override other variables if LIBXML_SRC is set
> -dnl
> -
> -if test "x$LIBXML_SRC" != "x"
> -then
> -	CWD=`pwd`
> -	if cd $LIBXML_SRC
> -	then
> -		SRC_DIR=`pwd`
> -		XML_CONFIG=${SRC_DIR}/xml2-config
> -		LIBXML_CFLAGS="-I${SRC_DIR}/include"
> -		LIBXML_LIBS="-L${SRC_DIR}"
> -		cd $CWD
> -	else
> -		AC_MSG_ERROR([libxml source dir not found (${LIBXML_SRC}), typo?])
> -	fi
> -fi
> -
> -dnl
> -dnl make sure xml2-config is executable,
> -dnl test version and init our variables
> -dnl
> -
> -if ${XML_CONFIG} --libs print > /dev/null 2>&1
> -then
> -	XMLVERS=`$XML_CONFIG --version`
> -	if test VERSION_TO_NUMBER(echo $XMLVERS) -ge VERSION_TO_NUMBER(echo $LIBXML_REQUIRED_VERSION)
> -	then
> -		AC_MSG_RESULT($XMLVERS found)
> -	else
> -		AC_MSG_ERROR(Version $XMLVERS found. You need at least libxml2 $LIBXML_REQUIRED_VERSION for this version of libxslt)
> -	fi
> -	LIBXML_LIBS="$LIBXML_LIBS `$XML_CONFIG --libs`"
> -	if test "x$LIBXML_SRC" = "x"; then
> -		LIBXML_CFLAGS="$LIBXML_CFLAGS `$XML_CONFIG --cflags`"
> -	fi
> -else
> -	AC_MSG_ERROR([Could not find libxml2 anywhere, check ftp://xmlsoft.org/.])
> -fi
> -
>   
>   AC_SUBST(CFLAGS)
>   AC_SUBST(CPPFLAGS)
> @@ -595,7 +486,7 @@ fi
>   
>   if test "$with_plugins" = "yes" ; then
>     AC_MSG_CHECKING([libxml2 module support])
> -  WITH_MODULES="`$XML_CONFIG --modules`"
> +  WITH_MODULES="`$PKG_CONFIG --variable=modules libxml-2.0`"
>     if test "${WITH_MODULES}" = "1"; then
>       AC_MSG_RESULT(yes)
>     else

Roumen