autoconf
[Top][All Lists]
Advanced

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

Re: Question about CFLAGS


From: Bob Friesenhahn
Subject: Re: Question about CFLAGS
Date: Wed, 16 Apr 2008 11:24:08 -0500 (CDT)

On Wed, 16 Apr 2008, Sérgio Durigan Júnior wrote:
In general a configure script should never modify CFLAGS.  But flags
like -m64 that select a completely different ABI should better be put in
CC, not CFLAGS.

I will second the above statement.

Does that mean that CFLAGS is a variable only for the user? Well, let's
say that, for some strong reason, the configure is actually modifying
it. What would be the correct behaviour in this case? FYI, I'm talking
specifically about Python's build system, which uses 3 internal
variables ($BASECFLAGS, $OPT and $EXTRA_CFLAGS), but strangely ignores
the value of CFLAGS provided by the user. It's causing some troubles,
and we're trying to fix it. More information can be found at
http://bugs.python.org/issue1628484 .

That would seem to be a bug in Python's configure script. When it comes to the variables listed at the tail of configure's --help output:

Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  CPP         C preprocessor
  CXX         C++ compiler command
  CXXFLAGS    C++ compiler flags
  CXXCPP      C++ preprocessor
  F77         Fortran 77 compiler command
  FFLAGS      Fortran 77 compiler flags
  FC          Fortran compiler command
  FCFLAGS     Fortran compiler flags

user provided options should always be treated with respect and should be honored in such a way that the user provided options will have most useful effect. For example, if you add -I options to CPPFLAGS, then the user-provided portion should be prepended so that the user can use CPPFLAGS to override a default inclusion. For CFLAGS, the user provided part should likely be appended so that the user can override the defaults.

If a package is using Automake, then it is useful to take advantage of AM_ prefixed variables in order to taint user-provided input as little as possible.

Regardless, I seem to have built a 64-bit version of Python in an environment which defaults to 32-bits by defining 'CC' rather than 'CFLAGS'.

Bob
======================================
Bob Friesenhahn
address@hidden, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/

reply via email to

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