From d9ccc00e4e34d7b3b427efef4dc7906318b5030c Mon Sep 17 00:00:00 2001
From: Boris Kolpackov <borisk@apache.org>
Date: Tue, 16 Sep 2008 08:35:53 +0000
Subject: [PATCH] Add support for generating pkgconfig file. Patch by Jay
 Berkenbilt (XERCESC-1824).

git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@695767 13f79535-47bb-0310-9956-ffa450edef68
---
 Makefile.am    |  3 +++
 configure.ac   | 17 ++++++++++++++---
 xerces-c.pc.in | 10 ++++++++++
 3 files changed, 27 insertions(+), 3 deletions(-)
 create mode 100644 xerces-c.pc.in

diff --git a/Makefile.am b/Makefile.am
index de2ce8ea5..82a224660 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,6 +13,9 @@ ACLOCAL_AMFLAGS = -I m4
 
 CLEANFILES = test-results.log
 
+pkgconfigdir = @pkgconfigdir@
+pkgconfig_DATA= xerces-c.pc
+
 check:
 	-rm -f test-results.log
 	export PATH=${abs_top_builddir}/samples:${abs_top_builddir}/tests:"${PATH}" && export XERCESC_NLS_HOME=${abs_top_builddir}/src/.libs && cd ${top_srcdir} && perl scripts/sanityTest.pl 2>&1 | ${SED} 's/ *[0-9][0-9]*  *ms */{timing removed}/' 1> ${abs_top_builddir}/test-results.log
diff --git a/configure.ac b/configure.ac
index 62024cbfc..d869bee0f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,7 +35,8 @@ AC_CONFIG_FILES([Makefile \
                  src/xercesc/util/MsgLoaders/ICU/resources/Makefile \
                  src/xercesc/util/MsgLoaders/MsgCatalog/Makefile \
                  tests/Makefile \
-                 samples/Makefile])
+                 samples/Makefile \
+		 xerces-c.pc])
 
 # Check the target system
 AC_CANONICAL_HOST
@@ -187,11 +188,21 @@ XERCES_TRANSCODER_SELECTION
 XERCES_MSGLOADER_SELECTION
 XERCES_FILEMGR_SELECTION
 
+# Allow the user to specify the pkgconfig directory.
+#
+AC_ARG_WITH(pkgconfigdir,
+	AC_HELP_STRING([--with-pkgconfigdir=DIR],
+	[Specify location of pkgconfig dir (default is libdir/pkgconfig)]),
+	[pkgconfigdir=${withval}],
+	[pkgconfigdir='${libdir}/pkgconfig'])
+
+AC_SUBST([pkgconfigdir])
 
 ######################################################
-# Define some namespace-protected macros for use in the publicly visible
-# XercesConfig.h file.
+# Define some namespace-protected macros for use in the
+# publicly visible XercesConfig.h file.
 ######################################################
+
 AC_DEFINE([XERCES_AUTOCONF], 1, [Define to true if autoconf is used in this configuration])
 
 AS_IF([test x$ac_cv_header_sys_types_h = xyes],
diff --git a/xerces-c.pc.in b/xerces-c.pc.in
new file mode 100644
index 000000000..d5926d097
--- /dev/null
+++ b/xerces-c.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: Xerces-C++
+Description: Validating XML parser library for C++
+Version: @VERSION@
+Libs: -L${libdir} -lxerces-c
+Cflags: -I${includedir}
-- 
GitLab