Hi,

This has now come up in several GNU packages. How can a package specify
that the default CFLAGS should be something different than "-g -O2" - when gcc
is used and does accept these flags?

- GNU clisp prefers
  "-g -O2 -W -Wswitch -Wcomment -Wpointer-arith -Wimplicit -Wreturn-type 
-Wno-sign-compare"
- GNU teseq prefers
  "-g -O2 -Wall -ansi -pedantic-errors"
  see <http://lists.gnu.org/archive/html/bug-teseq/2008-08/msg00005.html>
- The issue has come up before, see
  <http://lists.gnu.org/archive/html/autoconf/2006-04/msg00045.html>
  Ralf Wildenhues said:
  "In general, overridability is more important than the special-casing."

But autoconf still hardwires this logic in _AC_PROG_CC_G:

---------------------------------------------
elif test $ac_cv_prog_cc_g = yes; then
  if test "$GCC" = yes; then
    CFLAGS="-g -O2"
  else
    CFLAGS="-g"
  fi
else
  if test "$GCC" = yes; then
    CFLAGS="-O2"
  else
    CFLAGS=
  fi
fi
---------------------------------------------

Could this be made customizable somehow? Either through a variable that the
developer could set in his configure.ac before the invocation of AC_PROG_CC,
or through a macro which he could redefine in his configure.ac?

The rationale for making this customizable per package is that the set of
warning options that yields the maximum benefit (= best adherence to the
package's coding conventions and minimum number of false warnings) depends
on the package's source code.

Bruno



Reply via email to