Default +universal variant for configure-based ports

Vincent Lefevre vincent-opdarw at vinc17.org
Mon Feb 26 04:12:23 PST 2007


On 2007-02-26 20:51:26 +0900, Paul Guyot wrote:
> On Feb 26, 2007, at 19:45, Vincent Lefevre wrote:
> >On 2007-02-26 13:45:09 +0900, Paul Guyot wrote:
> >>* you can add -O -g if the port requires it with just:
> >>configure.universal_cflags-append	-O -g
> >
> >Why isn't -O (equivalent to -O1) used by default?
> >
> >It is regarded as stable by Apple (since it is in the tech note)
> >and is better than the default -O0 (no optimization).

First note that when I said "the default -O0", this is the default for
the *compiler* (here, gcc), not for the "configure" script. This is
important below...

> I think you might be over-interpreting Apple's choice with -O (and - 
> g). Most configure-based software know how to configure their  
> optimization options for both PPC and Intel  builds and if they  
> don't, then the portfile needs to fix it anyway, even for non- 
> universal builds. Unless I missed something....

I think so. Many ports don't redefine CFLAGS, so that a default CFLAGS
will be set up by configure in the Makefile, and in general, a -O option
(-O1 or -O2 or ...) is added there. In fact, "-g -O2" seems to be the
default set up by autoconf when CFLAGS isn't defined. If a portfile
defines CFLAGS (e.g. via the universal variant), then I think you will
no longer have the autoconf default. Here's an example (with Mutt):

* If I configure Mutt without CFLAGS set, then I get in the Makefile
  generated by configure:

    CFLAGS = -Wall -pedantic -g -O2

* If I configure Mutt with ./configure CFLAGS="-Wall", then I get in
  the Makefile generated by configure:

    CFLAGS = -Wall -pedantic -Wall

Note: Mutt's configure.in adds "-Wall -pedantic", but you can see
the default "-g -O2" that comes from autoconf.

Now, I don't know if "-g -O2" is magically added by MacPorts internals.
I haven't tried the trunk.

-- 
Vincent Lefèvre <vincent at vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)



More information about the macports-dev mailing list