define local keyword globally in a macports config My main target is to globally enable all ports to compile with macports-clang-3.4 and use libc++ instead of libstdc++.

For example when working with one port I need to set configure.compiler=macports-clang-3.4 and configure.cxx_stdlib=c++11 to the command line. But how I can set this variables via macports configuration globally so that any invocation of port would automatically use my defaults? variants.conf accepts only variants and no keywords and macports.conf only includes global keywords.
I'm assuming you're on a system &lt; Mavericks because otherwise libc++ and a recent clang would already be your default and forcing it wouldn't make a lot of sense.

Use MacPorts trunk (or wait for the 2.3 release) and set the following options in $prefix/etc/macports.conf:


cxx_stdlib libc++
buildfromsource always
delete_la_files yes


If you use Xcode >= 4.2 I wouldn't bother changing the default compiler, since system clang is already the preferred MacPorts compiler and some ports specifically change that if that doesn't work (which might break if you force it to be a different compiler). If a port doesn't work with your version of system clang, but will work with a newer clang, ports will usually automatically choose a macports-clang instead.

If you use Xcode &lt; 4.2, add default_compilers macports-clang-3.4 macports-clang-3.3 macports-llvm-gcc-4.2 apple-gcc-4.2 to your macports.conf. Note that doing this is entirely unsupported, deliberately undocumented, and if it breaks you get to keep the pieces.

You need to reinstall all your ports after doing that.