[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Obeying users CFLAGS
From: |
Ralf Wildenhues |
Subject: |
Re: Obeying users CFLAGS |
Date: |
Thu, 12 Jun 2008 09:02:29 +0200 |
User-agent: |
Mutt/1.5.17+20080114 (2008-01-14) |
Hello Tim,
* Tim Post wrote on Thu, Jun 12, 2008 at 06:53:29AM CEST:
>
> I have noticed that if the CFLAGS environment is not set, @CFLAGS@ is
> expanded to -g -O2 Is this expected behavior?
Yes, that is documented in
<http://www.gnu.org/software/autoconf/manual/html_node/C-Compiler.html>.
> Also, I see that AC_PROG_CXX ensures that the compiler actually works,
> but AC_PROG_CC doesn't seem to do this.
The first macro invoked, of AC_PROG_{CC,CXX,F77,FC} does this.
> Is there a default macro to
> ensure that gcc actually works with the given CFLAGS setting? I'd like
> to be sure that flags I set don't conflict with whatever happens to be
> in CFLAGS.
Well, if you as a user set './configure CFLAGS=...' then that is not
overridden: the user is assumed to be always right. If you as a
developer want to modify CFLAGS in configure.ac, then I suggest you do
so only if the user hasn't set it. You can find this out with
test "${CFLAGS+set}" = set
before AC_PROG_CC, and modifying CFLAGS in that case, preferably after
the AC_PROG_CC invocation so that you get the -g/-O2 testing done by
this macro. To find out whether your flags work you could just try to
compile or link a simple test program (see AC_COMPILE_IFELSE).
HTH. Cheers,
Ralf