Use PKG_CHECK_MODULES to detect the libxml2 and libxslt libraries

This commit is contained in:
Hugh McMaster 2020-02-27 21:15:44 +11:00 committed by Zane U. Ji
parent 9f11c05c27
commit 6ac593095d
2 changed files with 7 additions and 37 deletions

View File

@ -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],

View File

@ -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)