From: Vincent Bernat Date: Wed, 2 May 2012 06:12:03 +0000 (+0200) Subject: configure: don't test for XML2 linking, useless X-Git-Tag: 0.6.0~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f9f801e050ec2da656ee4f710e2b67b61ae07f3e;p=thirdparty%2Flldpd.git configure: don't test for XML2 linking, useless Just check for its presence with pkg-config and xml2-config. --- diff --git a/m4/xml2.m4 b/m4/xml2.m4 index 9e8686f1..57d8755f 100644 --- a/m4/xml2.m4 +++ b/m4/xml2.m4 @@ -4,31 +4,18 @@ AC_DEFUN([lldp_CHECK_XML2], [ - AC_PATH_TOOL([XML2_CONFIG], [xml2-config], [no]) - if test x"$XML2_CONFIG" = x"no"; then + PKG_CHECK_MODULES([XML2], [libxml-2.0], [], + [AC_MSG_CHECKING([presence of xml2-config]) + AC_PATH_TOOL([XML2_CONFIG], [xml2-config], [no]) + if test x"$XML2_CONFIG" = x"no"; then AC_MSG_ERROR([*** unable to find xml2-config]) - fi - XML2_LIBS=`${XML2_CONFIG} --libs` - XML2_CFLAGS=`${XML2_CONFIG} --cflags` + fi + XML2_LIBS=`${XML2_CONFIG} --libs` + XML2_CFLAGS=`${XML2_CONFIG} --cflags` + AC_MSG_RESULT([found!]) + ]) - _save_flags="$CFLAGS" - CFLAGS="$CFLAGS ${XML2_CFLAGS}" - AC_MSG_CHECKING([whether C compiler supports flag "${XML2_CFLAGS}" from libxml2]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([ -int main(void); -], -[ -{ - return 0; -} -])],[AC_MSG_RESULT(yes)],[ -AC_MSG_RESULT(no) -AC_MSG_ERROR([*** incorrect CFLAGS from xml2-config])]) - AC_CHECK_LIB([xml2], [xmlNewTextWriterDoc], [:], - [AC_MSG_ERROR([*** unable to use xml2])], ${XML2_LIBS}) AC_SUBST([XML2_LIBS]) AC_SUBST([XML2_CFLAGS]) AC_DEFINE_UNQUOTED([USE_XML], 1, [Define to indicate to enable XML support]) - - CFLAGS="$_save_flags" ])