On Thu, 2006-07-20 at 16:08 +0200, Bruno Haible wrote: > Hi, > > The autoconf manual describes CFLAGS like this: > > "Variable: CFLAGS > Debugging and optimization options for the C compiler. If it is > not set in the environment when `configure' runs, the default > value is set when you call `AC_PROG_CC' (or empty if you don't). > `configure' uses this variable when compiling programs to test for > C features." > > Based on this text, in a Makefile.in of mine, I use CFLAGS for .c to .o > compilation, but not for linking. Because debugging and optimization > flags are useless for linking. This assumption is wrong. Such flags can affect linking, e.g. pull different startup files, different run time libraries and imply different linker flags (consider profiling).
> But the GNU standards say: > "`CFLAGS' should be used in every invocation of the C compiler, both > those which do compilation and those which do linking." > > Now it makes a difference. A user on Solaris/x86_64 tried to use > > CC=cc CFLAGS=-xarch=amd64 > > and it didn't work with my Makefile.in. Is the user supposed to use such > setting? Or does he need to use > > CC="cc -xarch=amd64" It depends on what -xarch=... does. The fundamental question would be: "Which component of a toolchain does a flag affect/is a flag processed by"? There exist cases where first form is needed and there exist cases where the latter form is needed and there exists a fairly large grey zone inbetween. Ralf