autoconf
[Top][All Lists]
Advanced

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

Re: including autoconf paths in source


From: Ralf Corsepius
Subject: Re: including autoconf paths in source
Date: Fri, 12 Dec 2008 13:47:57 +0100

On Fri, 2008-12-12 at 06:22 -0500, Thomas Dickey wrote:
> On Thu, 11 Dec 2008, Jan Engelhardt wrote:
> 
> >
> > On Thursday 2008-12-11 21:38, Monty Taylor wrote:
> >
> >> Hey all,
> >>
> >> I'm wondering if there is a best practice for getting paths such as
> >> locaeldir or datadir into source code. As it stands now in the Makefile
> >> I've got:
> >>
> >> prefix= /usr/local
> >> datarootdir= ${prefix}/share
> >> localedir = ${datarootdir}/locale
> >>
> >> To get localedir into a source file, I've got a section in Makefile.am 
> >> like:
> >>
> >> DEFS = -DLOCALEDIR="\"$(localedir)\"" @DEFS@
> >
> > This is the preferred solution indeed. Not that I see a need for @DEFS@
> > though:
> 
> One of the problems with the "preferred solution" is that it's not trivial
> to pass the flags through a script

One way: Generating such files at "make-time" (not at configure-time):

foo.sh: foo.sh.in Makefile
        sed -e "s,address@hidden@],$(localedir)," \
        < $(srcdir)/foo.in > foo.sh
        chmod +x foo.sh.in

>  (for example, a wrapper for a 
> compiler, or test-application).  Putting them in the generated config.h
> doesn't run into that problem.
Only if done properly.

You need to make sure these are expanded correctly and are invariant to
"make-time" environment variable changes.

Ralf






reply via email to

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