autoconf
[Top][All Lists]
Advanced

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

AC_SUBST(CCLD)


From: Too, Justin A.
Subject: AC_SUBST(CCLD)
Date: Wed, 9 Feb 2011 13:50:00 -0800
User-agent: Microsoft-MacOutlook/14.0.0.100825

Hi,
I am using Autotools (Autoconf, Automake, Libtools):

Currently, I have CCLD set to $(CC). Using AC_SUBST, all Makefile's will 
contain this variable.

Config:
CC=gcc
CCLD="$(CC)"
AC_SUBST(CCLD)

Generated Makefiles:
CCLD = gcc

The problem, however, is that I use different compilers for certain 
directories. So, for example:

$ cd dir1/
$ gcc-4.1.2 –c –o helloworld.o helloworld.c
$ libtool --tag=CC —mode=link $(CCLD) -o helloworld.out helloworld.o

$ cd dir2/
$ gcc-3.3.6 –c –o helloworld.o helloworld.c
$ libtool —tag=CC —mode=link $(CCLD) -o helloworld.out helloworld.o

Then, the same $(CCLD) linker is being used for both directories, but I need to 
use the appropriate linkers
for each directory, i.e. gcc-4.1.2 and gcc-3.3.6.

Then, my question is: how can I set CCLD appropriately for different Makefiles 
so autoconf will generate the
appropriate Libtool link rules for my Makefiles? Or any other suggestions?

---

Alternatively, I've also tried this:

configure.in:
AM_CONDITIONAL(USING_ALTERNATE_COMPILER, [test "$alternate_compiler" != ""])

dir2/Makefile.am:
If USING_ALTERNATE_COMPILER
CCLD=gcc-3.3.6
endif

But then I get this automake warning:
CCLD was already defined in condition TRUE, which includes condition 
USING_ALTERNATE_COMPILER …

And the generated Makefile contains:

CCLD = gcc-3.3.6
CCLD = gcc

So, autoconf put its CCLD into the generated Makefile, basically ignoring my 
declaration of CCLD. Omitting the "if..endif" yields the correct result, I.e. 
One declaration of CCLD.

Thanks,
Justin


reply via email to

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