[Expat-discuss] [PATCH] Add pkg-config support

Dan Nicholson dbn.lists at gmail.com
Mon Jul 2 22:33:52 CEST 2007


Hi,

This patch adds a pkg-config file for expat. Using pkg-config makes it
easy to link libexpat into your application:

cc `pkg-config --libs expat` -c -o foo foo.c

This has the values substituted from configure, and uses the expat_version()
macro to find the version number. That might not be the most robust way to
handle this. You must 'cvs add expat.pc.in' to get the whole patch.

--
Dan.

--- /dev/null	2007-06-29 06:21:44.613798959 -0700
+++ expat.pc.in	2007-07-02 11:45:39.000000000 -0700
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: expat
+Version: @VERSION@
+Description: expat XML parser
+Libs: -L${libdir} -lexpat
+Cflags: -I${includedir}
Index: .cvsignore
===================================================================
RCS file: /cvsroot/expat/expat/.cvsignore,v
retrieving revision 1.10
diff -p -u -r1.10 .cvsignore
--- .cvsignore	3 May 2007 19:54:50 -0000	1.10
+++ .cvsignore	2 Jul 2007 18:51:20 -0000
@@ -11,3 +11,4 @@ libtool
 expat.ncb
 expat.opt
 .project
+expat.pc
Index: configure.in
===================================================================
RCS file: /cvsroot/expat/expat/configure.in,v
retrieving revision 1.45
diff -p -u -r1.45 configure.in
--- configure.in	9 May 2007 13:26:48 -0000	1.45
+++ configure.in	2 Jul 2007 18:51:20 -0000
@@ -27,6 +27,8 @@ define([expat_version], ifdef([__gnu__],
                               [esyscmd(conftools/get-version.sh lib/expat.h)],
                               [2.0.x]))
 AC_INIT(expat, expat_version, expat-bugs at libexpat.org)
+VERSION=expat_version()
+AC_SUBST(VERSION)
 undefine([expat_version])
 
 AC_CONFIG_SRCDIR(Makefile.in)
@@ -144,7 +146,7 @@ AC_DEFINE([XML_DTD], 1,
 AC_DEFINE([XML_CONTEXT_BYTES], 1024,
           [Define to specify how much context to retain around the current parse point.])
 
-AC_CONFIG_FILES(Makefile)
+AC_CONFIG_FILES(Makefile expat.pc)
 AC_OUTPUT
 
 abs_srcdir="`cd $srcdir && pwd`"


More information about the Expat-discuss mailing list