How to specify (default) compiler options and choose which compiler

Marcus Calhoun-Lopez mcalhoun at macports.org
Mon Feb 16 13:21:30 PST 2009


Ceriel Jacobs <cerieljacobs <at> gmail.com> writes:

> 
> My goal is to build speed optimised binaries for 10.5 Core2Duo: -fast - 
> march=nocona (-m64).
> 
> The -march=nocona requires gcc 4.2 or higher.
> The default on MacOS is still gcc 4.0.
> I know I can use ./port ... configure.compiler=gcc-4.2
> 
> Questions:
> - how to specify gcc 4.2 *by default* within MacPorts?

WARNING:
All of the things I am about to mention could very easily break
a MacPorts installation and should not be implemented lightly.

As far as I know, there is no configuration file in which these
values can be changed.

You could write a shell script which overrides the default values
port install $1
configure.compiler=gcc-4.2
configure.optflags=-fast
configure.m64=yes
configure.march=nocona

You can also edit the file
${prefix}/share/macports/Tcl/port1.0/portconfigure.tcl

These two actions only set the default value.
A Portfile can override your value as well.
In that case you would have to create your own local repository
(http://guide.macports.org/#development.local-repositories).

> - how to verify that binaries are actually build using gcc 4.2?
The only way I know of is to use verbose output and see if any other compiler is
being used.

-Marcus





More information about the macports-users mailing list