[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using @bindir@ etc. in C headers
From: |
Michael Orlitzky |
Subject: |
Re: Using @bindir@ etc. in C headers |
Date: |
Fri, 5 Jun 2020 07:09:07 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 |
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)/$@.in' >$@.tmp
chmod +x $@.tmp
chmod a-w $@.tmp
mv $@.tmp $@
autoheader: $(srcdir)/autoheader.in
autom4te: $(srcdir)/autom4te.in
Not very aesthetically pleasing, but it gets the job done.
- Using @bindir@ etc. in C headers, Florian Weimer, 2020/06/05
- Re: Using @bindir@ etc. in C headers, Peter Johansson, 2020/06/05
- Re: Using @bindir@ etc. in C headers,
Michael Orlitzky <=
- Re: Using @bindir@ etc. in C headers, Florian Weimer, 2020/06/05
- Re: Using @bindir@ etc. in C headers, Nick Bowler, 2020/06/05
- Re: Using @bindir@ etc. in C headers, Florian Weimer, 2020/06/05
- Re: Using @bindir@ etc. in C headers, Nick Bowler, 2020/06/05
- Re: Using @bindir@ etc. in C headers, Florian Weimer, 2020/06/05
- Re: Using @bindir@ etc. in C headers, Perry Hutchison, 2020/06/05
- Re: Using @bindir@ etc. in C headers, Florian Weimer, 2020/06/05
- Re: Using @bindir@ etc. in C headers, Perry Hutchison, 2020/06/05
- Re: Using @bindir@ etc. in C headers, Florian Weimer, 2020/06/07