Re: Obeying users CFLAGS

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

 



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


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux