autoconf
[Top][All Lists]
Advanced

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

Re: generating pc files


From: Bruce Korb
Subject: Re: generating pc files
Date: Thu, 20 Sep 2012 10:49:30 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120825 Thunderbird/15.0

On 09/19/12 11:03, Russ Allbery wrote:
> ...  I believe the method using sed is
> correct, and generating the file at Autoconf time is not as correct...

For my perspective, there really ought to be a simple macro that just
exports all the configured values to whatever external command anyone
wants to use.  e.g. always have all Makefile-s define this:

CONFIGURABLES = \
  prefix="$(prefix)" \
....

so that you can, for example, use this in any directory:

   $(CONFIGURABLES) $(SHELL) some-script

and have the right thing happen.  "some-script" can construct
a pc file or do any of many things much more easily than
using the embedded-in-a-makefile scripting syntax.
Constructing CONFIGURABLES yourself isn't rocket science, but
it is a nuisance.  The ax_create_pkgconfig_info.m4 file
is very complicated.  The "some-script" could be as simple as:

cat > ${package}.pc <<-  _EOF_
        # pkg-config information for AutoOpts ${version}
        #
        prefix="${prefix}"
        datarootdir="${datarootdir}"
        datadir="${datadir}"
        package="${package}"
        includedir="${includedir}"
        exec_prefix="${exec_prefix}"
        bindir="${bindir}"
        libdir="${libdir}"
        version="${version}"
        pkgdatadir="${pkgdatadir}"
        libs="${libs}"

        Name:           AutoOpts
        Description:    A semi-automated generated/library option parser
        URL:            http://www.gnu.org/software/autogen
        Version:        ${version}
        Libs:           ${ldflags}
        Cflags:         ${cflags}
        _EOF_

and all the variables are substituted properly before this "here-doc"
gets evaluated.



reply via email to

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