From 6ac593095da32dea9f9cac8f2bfd6f22f01d7a4e Mon Sep 17 00:00:00 2001 From: Hugh McMaster Date: Thu, 27 Feb 2020 21:15:44 +1100 Subject: [PATCH] Use PKG_CHECK_MODULES to detect the libxml2 and libxslt libraries --- configure.ac | 39 ++++----------------------------------- src/Makefile.am | 5 +++-- 2 files changed, 7 insertions(+), 37 deletions(-) diff --git a/configure.ac b/configure.ac index 0ce29db..b4dfcdf 100755 --- a/configure.ac +++ b/configure.ac @@ -17,12 +17,12 @@ AC_PROG_INSTALL AC_LIBTOOL_DLOPEN AC_PROG_LIBTOOL +PKG_PROG_PKG_CONFIG + CPPFLAGS="$CPPFLAGS -Wall -g -fexceptions" CXXFLAGS?= WXCONFIG=wx-config -LIBXMLCONFIG=xml2-config -LIBXSLTCONFIG=xslt-config AC_ARG_WITH(wx-config, [[ --with-wx-config=FILE Use the given path to wx-config when determining @@ -59,39 +59,8 @@ else AC_MSG_ERROR([wxWidgets 2.8.0 or newer is required]) fi -# Check for libxml2 -libxmlversion=0 - -AC_DEFUN([LIBXML2TEST], -[ - AC_REQUIRE([AC_PROG_AWK]) - AC_MSG_CHECKING([libxml2]) - if libxmlversion=`$LIBXMLCONFIG --version`; then - AC_MSG_RESULT([$libxmlversion]) - else - AC_MSG_RESULT([not found]) - AC_MSG_ERROR([libxml2.]) - fi]) - -# Call XML2 TEST func -LIBXML2TEST - -# Check for libxslt -libxsltversion=0 - -AC_DEFUN([LIBXSLTTEST], -[ - AC_REQUIRE([AC_PROG_AWK]) - AC_MSG_CHECKING([libxslt]) - if libxsltversion=`$LIBXSLTCONFIG --version`; then - AC_MSG_RESULT([$libxsltversion]) - else - AC_MSG_RESULT([not found]) - AC_MSG_ERROR([libxslt]) - fi]) - -# Call XSLT TEST func -LIBXSLTTEST +PKG_CHECK_MODULES([XML2], [libxml-2.0]) +PKG_CHECK_MODULES([XSLT], [libxslt]) AC_ARG_ENABLE(debug, [ --enable-debug, Enable debug build], diff --git a/src/Makefile.am b/src/Makefile.am index d844e02..7b0c81c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -82,7 +82,8 @@ xmlcopyeditor_LDADD = $(WX_LIBS) \ $(ASPELL_LIBS) \ $(ENCHANT_LIBS) \ $(GTK_LIBS) \ - -lexpat -lxslt -lxml2 -lpcre -lxerces-c + $(XSLT_LIBS) \ + -lexpat -lpcre -lxerces-c nobase_dist_xmlcopyeditor_DATA = $(srcdir)/catalog/catalog \ $(srcdir)/dtd/*.* \ @@ -132,5 +133,5 @@ EXTRA_DIST = \ $(srcdir)/xmlcopyeditor.rc \ $(srcdir)/xmlschemaparser.cpp -AM_CPPFLAGS = -I/usr/include/libxml2 $(ENCHANT_CFLAGS) $(GTK_CFLAGS) +AM_CPPFLAGS = $(XML2_CFLAGS) $(ENCHANT_CFLAGS) $(GTK_CFLAGS)