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

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

Ceriel Jacobs <cerieljacobs <at>> 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?

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

You can also edit the file

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

> - 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.


More information about the macports-users mailing list