From 21832029366d53df9f74d04c6902fbf47ff682fc Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Tue, 2 Dec 2014 00:27:03 +0100 Subject: [PATCH] xml: check that libxml-2 is really usable --- m4/xml2.m4 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/m4/xml2.m4 b/m4/xml2.m4 index 57d8755f..df040603 100644 --- a/m4/xml2.m4 +++ b/m4/xml2.m4 @@ -15,6 +15,25 @@ AC_DEFUN([lldp_CHECK_XML2], [ AC_MSG_RESULT([found!]) ]) + # Check if the library is usable + _save_flags="$CFLAGS" + _save_libs="$LIBS" + CFLAGS="$CFLAGS ${XML2_CFLAGS}" + LIBS="$LIBS ${XML2_LIBS}" + AC_MSG_CHECKING([whether libxml-2 work as expected]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([ +@%:@include +@%:@include +],[ + xmlDocPtr doc; + xmlTextWriterPtr xw = xmlNewTextWriterDoc(&doc, 0); + return (xw != NULL); +])],[AC_MSG_RESULT(yes)],[ +AC_MSG_RESULT(no) +AC_MSG_ERROR([*** unable to use libxml-2])]) + CFLAGS="$_save_flags" + LIBS="$_save_libs" + AC_SUBST([XML2_LIBS]) AC_SUBST([XML2_CFLAGS]) AC_DEFINE_UNQUOTED([USE_XML], 1, [Define to indicate to enable XML support]) -- 2.39.5