"Andy Falanga (afalanga)" <afala...@micron.com> writes: > From: Bob Friesenhahn [mailto:bfrie...@simple.dallas.tx.us]
>> I am not sure what the correct procedure is, but I packages I maintain >> (and many others) use autoconf to configure a templated "foo.pc.in" >> and then install it using Automake. > Hm ... now that sounds like a nice, workable, solution. One caution: there are some Autoconf macros out there that will do this for you, but the ones I've encountered are buggy. The one I've seen the most was taken from the Autoconf Macro Archive (not sure if the archive has subsequently been fixed), and has the bug that it includes all of CFLAGS and similar variables in your *.pc file. This is often very much the wrong thing to do. The macros I've seen also generate the file directly via configure. There are some drawbacks to generating it that way, specifically that you sometimes have to jump through weird hoops to either get variables to fully expand or to include every possible variable that some other variable may use as part of its value into the *.pc file. I instead generate the file from Makefile.am, which allows one to get make to fully expand all the variables for you, which avoids that problem. Here's an example from the remctl package: # pkg-config configuration for the library. pkgconfigdir = $(libdir)/pkgconfig nodist_pkgconfig_DATA = client/libremctl.pc # Substitute configured paths into the pkg-config configuration file. client/libremctl.pc: $(srcdir)/client/libremctl.pc.in sed -e 's![@]prefix[@]!$(prefix)!g' \ -e 's![@]exec_prefix[@]!$(exec_prefix)!g' \ -e 's![@]includedir[@]!$(includedir)!g' \ -e 's![@]libdir[@]!$(libdir)!g' \ -e 's![@]PACKAGE_VERSION[@]!$(PACKAGE_VERSION)!g' \ -e 's![@]GSSAPI_LDFLAGS[@]!$(GSSAPI_LDFLAGS)!g' \ -e 's![@]GSSAPI_LIBS[@]!$(GSSAPI_LIBS)!g' \ $(srcdir)/client/libremctl.pc.in > $@ CLEANFILES = client/libremctl.pc and then the template file is: prefix=@prefix@ exec_prefix=@exec_prefix@ includedir=@includedir@ libdir=@libdir@ Name: remctl Description: Remote authenticated command execution with ACLs URL: http://www.eyrie.org/~eagle/software/remctl/ Version: @PACKAGE_VERSION@ Cflags: -I${includedir} Libs: -L${libdir} -lremctl Libs.private: @GSSAPI_LDFLAGS@ @GSSAPI_LIBS@ -- Russ Allbery (ea...@eyrie.org) <http://www.eyrie.org/~eagle/>