.pc file should be generated at "make" time, not "configure" time

Ben Denckla bdenckla at oblong.com
Thu Jul 8 23:02:16 PDT 2010


In the man page for pkg-config, it is stated that "You would normally generate the [.pc] file using configure, of course, so that the prefix, etc. are set to the proper values."

This technique is described in more detail in the following post.

http://lists.freedesktop.org/archives/pkg-config/2007-August/000218.html
( http://tinyurl.com/34juv6v )

I think this is the standard, but arguably suboptimal way of doing it. 

In particular, to conform with GNU Coding Standards (GCS), 

http://www.gnu.org/prep/standards/standards.html#Directory-Variables 
( http://tinyurl.com/qvx5ke ), 

the prefix should be able to be set at configure *or* "make" time: 

"Installers are expected to override these values when calling make (e.g., make prefix=/usr install or configure (e.g., configure --prefix=/usr)." 

Thus, the .pc file should be generated at "make" time. 

For confirmation of this, as well as a suggested way to implement it, see the following section in the Autoconf manual: 

http://www.gnu.org/software/autoconf/manual/autoconf.html#Installation-Directory-Variables 
( http://tinyurl.com/329y48y ) 

"[...] when the user runs: ‘make’ she can still specify a different prefix from the one specified to configure, in which case, if needed, the package should hard code dependencies corresponding to the make-specified prefix." 

"[...] you should not rely on AC_CONFIG_FILES to replace bindir and friends in your shell scripts and other files; instead, let make manage their replacement." 

Would it make sense to update the man page with a nod this more flexible and standards-conformant technique? 

Ben Denckla


More information about the pkg-config mailing list