bug-autoconf
[Top][All Lists]
Advanced

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

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


From: Ralf Wildenhues
Subject: Re: how to adjust default CFLAGS="-g -O2"?
Date: Thu, 21 Aug 2008 22:42:18 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hello,

* Eric Blake wrote on Thu, Aug 07, 2008 at 03:20:53AM CEST:
> According to Bruno Haible on 8/6/2008 4:41 PM:
> | 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?
>
> Hmm.  This is an interesting request, and seems doable.  I think it would
> be reasonable to see this in the user's configure.ac, just prior to
> AC_PROG_CC:
>
> AC_PROG_GCC_DEFAULT_FLAGS([-O2 -g -Wall])

> at which point, that string becomes the first set of CFLAGS tried for the
> compiler (if $CFLAGS is undefined), before falling back on "-g -O2" if it
> didn't work.

Oh, the ugliness of checking compiler flags.

One interesting aspect of implementing this is that the next GCC version
will ignore and may warn but will not fail upon unknown -Wno-* flags. [1]
Coping with this nicely in such a test isn't exactly trivial; as first
approximation, one could just ignore that issue.  Of course, there are
other compilers that even ignore all kinds of unknown switches (but do
warn about them).

> Anyone care to contribute a patch, even if only to add a line in the TODO
> file pointing to this thread?

I've pushed the patch below.

Cheers,
Ralf

[1] <http://thread.gmane.org/gmane.comp.gcc.patches/164070/focus=164077>

2008-08-21  Ralf Wildenhues  <address@hidden>

        * TODO: Add item for compiler default flags.
        Suggested by Bruno Haible.

diff --git a/TODO b/TODO
index 6993dce..368268c 100644
--- a/TODO
+++ b/TODO
@@ -42,6 +42,10 @@ even if they are slightly incompatible with C99.  The basic 
idea here
 is that AC_PROG_CC should disable pedanticisms and should enable
 extensions.
 
+Have a way to specify different default flags to try; see this thread
+for more information:
+<http://lists.gnu.org/archive/html/bug-autoconf/2008-08/msg00009.html>.
+
 
 * Later
 




reply via email to

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