[PATCH v1 2/3] Harden configure.ac checks for libxml2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Modernize the libxml2 script to use PKG_PROG_PKG_CONFIG instead of
an ad hoc macro. This automates the population of AM_CPPFLAGS with
"-I/usr/include/libxml2" when it is needed.

Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
---
 aclocal/libxml2.m4           |   20 +++++++++++---------
 support/junction/Makefile.am |    2 --
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/aclocal/libxml2.m4 b/aclocal/libxml2.m4
index 5c399b2..8231553 100644
--- a/aclocal/libxml2.m4
+++ b/aclocal/libxml2.m4
@@ -1,15 +1,17 @@
 dnl Checks for libxml2.so
 AC_DEFUN([AC_LIBXML2], [
 
-  if test "$enable_junction" = yes; then
+  PKG_PROG_PKG_CONFIG([0.9.0])
+  AS_IF(
+    [test "$enable_junction" = "yes"],
+    [PKG_CHECK_MODULES([XML2], [libxml-2.0 >= 2.4],
+                       [LIBXML2="${XML2_LIBS}"
+                        AM_CPPFLAGS="${AM_CPPFLAGS} ${XML2_CFLAGS}"
+                        AC_DEFINE([HAVE_LIBXML2], [1],
+                                  [Define to 1 if you have and wish to use libxml2.])],
+                       [AC_MSG_ERROR([libxml2 not found.])])])
 
-    dnl look for the library; do not add to LIBS if found
-    AC_CHECK_LIB([xml2], [xmlParseFile], [LIBXML2=-lxml2],
-                 [AC_MSG_ERROR([libxml2 not found.])])
-    AC_SUBST(LIBXML2)
-
-    dnl XXX should also check for presence of xml headers
-
-  fi
+  AC_SUBST([AM_CPPFLAGS])
+  AC_SUBST(LIBXML2)
 
 ])dnl
diff --git a/support/junction/Makefile.am b/support/junction/Makefile.am
index 97e7426..be6958b 100644
--- a/support/junction/Makefile.am
+++ b/support/junction/Makefile.am
@@ -30,5 +30,3 @@ libjunction_la_SOURCES	= display.c export-cache.c junction.c \
 			  locations.c nfs.c path.c xml.c
 
 MAINTAINERCLEANFILES	= Makefile.in
-
-AM_CPPFLAGS		= -I. -I../include -I/usr/include/libxml2




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux