[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: automake and autoconf
From: |
Gary V . Vaughan |
Subject: |
Re: automake and autoconf |
Date: |
Fri, 1 Jun 2001 22:16:56 +0100 |
On Thursday 31 May 2001 7:47 pm, Dan Miner wrote:
> Hello,
Hello Dan,
> I've been reading the autoconf book and I find it quite useful; however,
> I've hit a wall and can't seem to wrap my head around it.
Glad you like the book.
> Quick layout
>
> proj/Makefile.am
> proj/configure.in
> proj/lib1/Makefile.am
> proj/lib1/src/Makefile.am
> etc.
>
> I am retrofitting a company project to use these tools (and my first try at
> using these tools). I have *very* simple macros defined for gathering
> paths to "third-party" libraries and simple thread library checking.
>
> However, I need to define _REENTRANT in the Makefile.am of each */src
> directory. I would like to define this in the top level Makefile.am
> (proj/Makefile.am).
>
> When I try this (using AC_SUBST to "export" to the others), I find there
> variable has not retained its value.
>
> Is there any way to "export" an variable defined in automake down to deeper
> levels? Do I just use make's .export or the autoconf cache?
I am not sure I understand what it is that you are trying to do, but it
sounds as though you are trying to get the Makefiles to do autoconf's job.
Or perhaps you are using CPPFLAGS (which is for your users to set at compile
time), instead of AM_CPPFLAGS?
If this is something that you want your users to determine, then they can
simply build the project with:
make CPPFLAGS=-D_REENTRANT
Alternatively you can add that flag to each Makefile.am as follows:
AM_CPPFLAGS = -D_REENTRANT
Or if you want to set it conditionally based on tests at configure time, then
you should add this to configure.in (before the final AC_OUTPUT):
REENTRANT_FLAG=
if test $ac_cv_my_reentrancy_test_result" = xyes; then
REENTRANT_FLAG=-D_REENTRANT
fi
AC_SUBST(REENTRANT_FLAG)
Having done that, to make the substitution happen in the Makefiles, you would
add the following to each Makefile.am:
AM_CPPFLAGS = @REENTRANT_FLAG@
Finally, if you want to have some boilerplate read by each sub-makefile, you
could have a Make.Rules file in the top of the source tree (containing the
line above, plus any other stuff you want copied to every Makefile), and then
add this line to each Makefile.am that needs the boilerplate:
include $(top_srcdir)/Make.Rules
Hopefully, some or all of this relates to the problem you are describing...
Cheers,
Gary.
--
())_. Gary V. Vaughan gary@(oranda.demon.co.uk|gnu.org)
( '/ Research Scientist http://www.oranda.demon.co.uk ,_())____
/ )= GNU Hacker http://www.gnu.org/software/libtool \' `&
`(_~)_ Tech' Author http://sources.redhat.com/autobook =`---d__/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: automake and autoconf,
Gary V . Vaughan <=