Re: including autoconf paths in source

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

 



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,[@]localedir[@],$(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




_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux