automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how should package config files be installed


From: Russ Allbery
Subject: Re: how should package config files be installed
Date: Wed, 01 Apr 2015 21:10:20 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

"Andy Falanga (afalanga)" <address@hidden> writes:
> From: Bob Friesenhahn [mailto:address@hidden

>> 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 'address@hidden@]!$(prefix)!g'                     \
            -e 'address@hidden@]!$(exec_prefix)!g'           \
            -e 'address@hidden@]!$(includedir)!g'             \
            -e 'address@hidden@]!$(libdir)!g'                     \
            -e 'address@hidden@]!$(PACKAGE_VERSION)!g'   \
            -e 'address@hidden@]!$(GSSAPI_LDFLAGS)!g'     \
            -e 'address@hidden@]!$(GSSAPI_LIBS)!g'           \
            $(srcdir)/client/libremctl.pc.in > $@

CLEANFILES = client/libremctl.pc

and then the template file is:

address@hidden@
address@hidden@
address@hidden@
address@hidden@

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 (address@hidden)              <http://www.eyrie.org/~eagle/>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]