Skip to contentSkip to conversation

liblxc: Add pkg-config file

PATCH Matt Helsley 1 participant 1 message Jan 29, 2009 Kbuild

lore
Share & tools
lore
#0 lore raw

Add a pkg-config file which makes developing with liblxc easier. For example, if an unusual --prefix is used to install liblxc no special changes to Makefile rules are needed if pkg-config is used:

        gcc $(shell pkg-config --cflags) $(shell pkg-config --libs) -o my_lxc_prog my_lxc_prog.c
---
 Makefile.am  |    5 ++++-
 configure.in |    2 ++
 lxc.pc.in    |   15 +++++++++++++++
 3 files changed, 21 insertions(+), 1 deletion(-)
configure.in +2 -0
Index: lxc-0.5.2-mh/configure.in
===================================================================
@@ -14,6 +14,7 @@ AC_GNU_SOURCE
 AC_PROG_LIBTOOL
 AC_CHECK_PROG(SETCAP, setcap, yes, no)
 AC_CHECK_PROG(DOCBOOK, docbook2man, yes, no)
+PKG_PROG_PKG_CONFIG
 AM_CONDITIONAL(ENABLE_DOCBOOK, test x$DOCBOOK = xyes)
 AS_AC_EXPAND(BINDIR, $bindir)
 AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
@@ -52,6 +53,7 @@ AC_SUBST(LXC_MICRO_VERSION)
 AC_CONFIG_FILES([
         Makefile
 	lxc.spec
+ 	lxc.pc
         config/Makefile
 
         doc/Makefile
lxc.pc.in new file +15 -0
Index: lxc-0.5.2-mh/lxc.pc.in
===================================================================
@@ -0,0 +1,15 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+libexecdir=@libexecdir@
+includedir=@includedir@
+datadir=@datadir@
+
+localstatedir=@localstatedir@
+
+Name: lxc
+Description: Linux containers tools
+Version: @VERSION@
+Requires:
+Libs:
+Cflags:
Makefile.am +4 -1
Index: lxc-0.5.2-mh/Makefile.am
===================================================================
@@ -2,7 +2,10 @@
 
 SUBDIRS = doc src test etc scripts 
 DIST_SUBDIRS = config doc src test etc scripts
-EXTRA_DIST = lxc.spec CONTRIBUTING MAINTAINERS ChangeLog
+EXTRA_DIST = lxc.spec lxc.pc.in CONTRIBUTING MAINTAINERS ChangeLog
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = lxc.pc
 
 ChangeLog::
 	@touch ChangeLog