autoconf
[Top][All Lists]
Advanced

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

Re: LD not precious?


From: Philip A. Prindeville
Subject: Re: LD not precious?
Date: Thu, 14 Jan 2010 12:35:59 -0800
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20091112 Fedora/3.0-2.8.b4.fc11 Thunderbird/3.0b4

On 01/14/2010 12:10 PM, Ralf Wildenhues wrote:
> Hi Philip,
> 
> * Philip A. Prindeville wrote on Thu, Jan 14, 2010 at 02:43:49AM CET:
>> Silly question, but I was working on a particular project
>> (dahdi-tools) and I noticed that the value of LD that was passed to
>> "configure" didn't get saved into "makeopts".
>>
>> I hacked the configure.ac file as:
> [...]
>> +AC_SUBST(LD)
>> +
> [...]
>> and this seems to work, but this left me wondering why "LD" isn't a
>> precious variable, just like "CC" is.
> 
> First off, a naming nit: in the Autoconf lingo, AC_SUBST makes a
> variable be "substituted", i.e., occurrences of @LD@ in <file>.in for
> <file> listed in an AC_CONFIG_FILES macro are replaced by config.status
> with the value of $LD.  "Precious" variables on the other hand are those
> substituted variables which are also saved and restored for an eventual
> `./config.status --recheck' triggering another configure run.
> 
> Now, by default, LD is neither precious nor substituted, because
> nowadays the linker is rarely needed directly: most packages come by
> with using the compiler driver for linking, who then calls the linker.
> 
> Libtool, by the way, uses $LD sometimes, and AC_PROG_LIBTOOL causes $LD
> to be substituted.
> 
>> Looking at the contents of /usr/share/autoconf/autoconf/ for autoconf
>> 2.63, I'm not seeing \<LD\> anywhere.
>>
>> Is that an oversight? I ask because in a cross-compilation
>> environment, getting CC and LD right are equally important.
> 
> Sure, but why would $LD be more important in cross compilation setups
> than in native ones?  The cross-compiler usually calls the right linker.
> 
> Cheers,
> Ralf

Because I'm encountering Makefiles that call $(LD) directly, and default LD to 
"ld" unless you explicitly override it (and not setting it to $(CC)).

Overriding it every time I call "make" is a pain, and besides, I have a 
Makefile macro that contains all the usual values that I pass into 
"./configure" (i.e. HOSTCC="gcc" CC="$(TARGET_CC)" CFLAGS="$(TARGET_CFLAGS)" 
LD="$(TARGET_LD)" LDFLAGS="$(TARGET_LDFLAGS)" etc).

So specifying it during "configure" and then having "make all" and "make 
install" not need to have LD="$(TARGET_LD)" passed in would be a win.

-Philip







reply via email to

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