On 09/19/2012 05:53 PM, Vincent Torri wrote:
On Wed, Sep 19, 2012 at 9:46 AM, Russ Allbery<rra@xxxxxxxxxxxx> wrote:
Vincent Torri<vtorri@xxxxxxxxxxxx> writes:
But it seems that several projects use sed in their Makefile.am to use
the value of $libdir, $includedir, etc.. to generate their pc files. So
they have in foo.pc
libdir=${libdir}
So I would like to know the opinion of the autoconf dev about what the
correct way to generate pc file is.
Well, I'm not an Autoconf developer, so feel free to ignore this, but I've
been very happy with the following recipe. A *.pc.in file that looks
like:
prefix=@prefix@
exec_prefix=@exec_prefix@
includedir=@includedir@
libdir=@libdir@
Name:<name>
Description:<description>
URL:<url>
Version: @PACKAGE_VERSION@
Cflags: -I${includedir}
Libs: -L${libdir} -l<library>
Libs.private:<other-libs>
with the<...> bits replaced with whatever is appropriate for your
library, and then the following in Makefile.am (adjusting file paths
accordingly, of course:
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> $@
I know that way. I mentioned it (" But it seems that several projects
use sed in their Makefile.am etc..." See above)
My question is : which solution is the correct one, as they obviously
don't give the same result ?
The major difference compared with using AC_CONFIG_FILES is that the sed
version allows user to set e.g. prefix at make time.
./configure
make prefix=/opt
will work for Russ's method while it won't work using a simpler
AC_CONFIG_FILES approach. Not sure how important that behavior is for
you. But I if you care about GCS, I think the behavior is mandated there.
Cheers,
Peter
_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf