[Top][All Lists]

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

Re: Using @bindir@ etc. in C headers

From: Florian Weimer
Subject: Re: Using @bindir@ etc. in C headers
Date: Fri, 05 Jun 2020 17:35:39 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

* Michael Orlitzky:

> On 6/5/20 6:57 AM, Florian Weimer wrote:
>> I would like to define macros containing the standard paths, like this:
>> #define BINDIR "@bindir@"
>> It does not work due to this code in lib/autoconf/general.m4 (which
>> appears to be predate DESTDIR support):
>> ...
>> Is there are generally approved way to work around this?  The manual
>> tells us to use -D preprocessor arguments, but I'd prefer the
>> explicitness of defining the macros via a header file.
> The autoconf manual's "Installation Directory Variables" section says
> the following...
>   Similarly, you should not rely on AC_CONFIG_FILES to replace datadir
>   and friends in your shell scripts and other files; instead, let make
>   manage their replacement. For instance Autoconf ships templates of its
>   shell scripts ending with `.in', and uses a makefile snippet similar
>   to the following to build scripts like autoheader and autom4te:
>      edit = sed \
>              -e 's|@datadir[@]|$(pkgdatadir)|g' \
>              -e 's|@prefix[@]|$(prefix)|g'
>      autoheader autom4te: Makefile
>              rm -f $@ $@.tmp
>              $(edit) '$(srcdir)/$' >$@.tmp
>              chmod +x $@.tmp
>              chmod a-w $@.tmp
>              mv $@.tmp $@
>      autoheader: $(srcdir)/
>      autom4te: $(srcdir)/
> Not very aesthetically pleasing, but it gets the job done.

It would like to get config.status expansion going, among other things.
It's nice to consolidate these things in a single place, and avoid
scattering such constructs and several places.

What do you think about this?

dnl LIBC_SUBST_EXPANDED(VAR) creates a substitution variable
dnl VAR_expanded with the shell-expanded value of VAR.  In this context,
dnl ${exec_prefix} is expanded to the empty string.
[exec_prefix= eval $1_expanded="${$1}"

And then towards the end of



reply via email to

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