bug-autoconf
[Top][All Lists]
Advanced

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

how to adjust default CFLAGS="-g -O2"?


From: Bruno Haible
Subject: how to adjust default CFLAGS="-g -O2"?
Date: Thu, 7 Aug 2008 00:41:06 +0200
User-agent: KMail/1.5.4

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

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