Using cxx11 PortGroup on < 10.9

Michael Dickens michaelld at macports.org
Mon Jan 25 08:04:40 PST 2016


We've had this discuss before, how to do C++11 for libstdc++ and libc++.

The cxx11 PortGroup implements C++11 compliance for libc++ only. It
errors out when using libstdc++.

What Mojca is asking is whether we can add an implementation for when
using libstdc++, and I am on board with agreeing on how to do this
change. It won't be perfect, since using libstdc++ has issues & will
require selecting a default compiler for building that is C++11
compliant; and, MacPorts provides no good way to add whitelist options
beyond variants in this case. Variants are what we used to do for
selecting a compiler suite, e.g., for various math ports.

I see no need to have port-by-port intervention; either one is using
libc++ or libstdc++, depending on host OS and user-select options. If
using the former, then just do what the cxx11 PortGroup does right now.

If using the latter, then do something like the following -- which I
admit is not perfect, but it should work for most ports:
{{{
# *clang* when using libstdc++ do not seem to support C++11;
# C++11 support seems to need GCC 4.7+ when using libstdc++;
# could use C++0x support on GCC4.[56], but just ignore it since
# there are newer compilers already in place as defaults.

# Blacklist GCC compilers not supporting C++11 and all CLANG.
# This is probably not necessary, but it's good practice.

compiler.blacklist-append *clang* {*gcc-3*} {*gcc-4.[0-6]}

# and whitelist those we do want to use. wish there were a better way.
# these will be used in the order provided.

compiler.whitelist macports-gcc-5 macports-gcc-4.9
}}}

My US$0.02. - MLD


More information about the macports-dev mailing list