]> granicus.if.org Git - xz/commitdiff
Build: Create liblzma.pc in a src/liblzma/Makefile.am.
authorLasse Collin <lasse.collin@tukaani.org>
Mon, 9 Sep 2013 17:37:03 +0000 (20:37 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Mon, 9 Sep 2013 17:37:03 +0000 (20:37 +0300)
Previously it was done in configure, but doing that goes
against the Autoconf manual. Autoconf requires that it is
possible to override e.g. prefix after running configure
and that doesn't work correctly if liblzma.pc is created
by configure.

A potential downside of this change is that now e.g.
libdir in liblzma.pc is a standalone string instead of
being defined via ${prefix}, so if one overrides prefix
when running pkg-config the libdir won't get the new value.
I don't know if this matters in practice.

Thanks to Vincent Torri.

configure.ac
src/liblzma/Makefile.am

index 186a39bb81e43d36de6c3ebee332df5741f767fa..fb0a52cb8921661702ed2ddbd3bc2fec3ea3af66 100644 (file)
@@ -720,7 +720,6 @@ AC_CONFIG_FILES([
        po/Makefile.in
        lib/Makefile
        src/Makefile
-       src/liblzma/liblzma.pc
        src/liblzma/Makefile
        src/liblzma/api/Makefile
        src/xz/Makefile
index 70183616829521c3b730e167a2899baaf8b5a0fb..9ad021a24c7033ea161baa572c12075a3430dc26 100644 (file)
@@ -94,3 +94,23 @@ endif
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = liblzma.pc
 EXTRA_DIST += liblzma.pc.in
+
+pc_verbose = $(pc_verbose_@AM_V@)
+pc_verbose_ = $(pc_verbose_@AM_DEFAULT_V@)
+pc_verbose_0 = @echo "  PC      " $@;
+
+liblzma.pc: $(srcdir)/liblzma.pc.in
+       $(AM_V_at)rm -f $@
+       $(pc_verbose)sed \
+               -e 's,@prefix[@],$(prefix),g' \
+               -e 's,@exec_prefix[@],$(exec_prefix),g' \
+               -e 's,@libdir[@],$(libdir),g' \
+               -e 's,@includedir[@],$(includedir),g' \
+               -e 's,@PACKAGE_URL[@],$(PACKAGE_URL),g' \
+               -e 's,@PACKAGE_VERSION[@],$(PACKAGE_VERSION),g' \
+               -e 's,@PTHREAD_CFLAGS[@],$(PTHREAD_CFLAGS),g' \
+               -e 's,@LIBS[@],$(LIBS),g' \
+               < $< > $@ || { rm -f $@; exit 1; }
+
+clean-local:
+       rm -f liblzma.pc