Re: Setting optimizations without violating autotools principles

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

 



On 07/07/2011 02:36 PM, Chris Stankevitz wrote:
> Q1: How do I specify that I want optimizations turned off?

As an end-user:

./configure CFLAGS='-O0'

As a package developer, you can't require optimizations off, but you can
suggest them as the default, by adding this to your configure.ac after
AC_INIT but prior to AC_PROG_CC:

: ${CFLAGS="-O0"}

This example is documented in the autoconf manual under AC_PROG_CC.

> 
> Q2: Does your answer for Q1 work even when I use AC_PROG_CC which places -02 in CFLAGS?

The end-user's selection always trumps the configure default.  And the
configure default is '-g' for non-gcc, and '-g -O2' for gcc, unless you
as the package developer used the configure.ac trick in Q1 to change it.

> Q3: Does your answer for Q1 violate this autotools principle:
> You should never redefine a user variable such as CFLAGS (http://tinyurl.com/3wkfdp5)

Nope.  As the package developer, you are only setting the default.  The
end user can always override you.

> 
> Q4: Does AC_PROG_CC violate this principle?

Nope - those are flags which the package developer uses no matter what
the user passes, _and_ which occur on the command line prior to $CFLAGS
(so the end user can _still_ override any flag that can be negated by
another option later on the command line).

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://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