3 # Setup variables for the compiler
5 # COMPILTER_TYPE is the major type of compiler. Currently gcc and clang support
6 # automatic detetion. Other compiler types can be shoe-horned in, but require explicit
7 # setting of the compiler type. The compiler type can also be set explicitly if, say,
8 # you install gcc as clang...
10 # COMPILER_VERSION is a numeric constant equal to major * 10000 + minor * 100 + tiny. It
11 # too can be overriden on the command line. When testing it, be sure to make sure that you
12 # are limiting the test to a specific compiler. Testing against 30300 for gcc likely isn't
13 # what you wanted (since versions of gcc prior to 4.2 likely have no prayer of working).
15 # COMPILER_FEATURES will contain one or more of the following, based on compiler support
16 # for that feature: c++11 (supports full (or nearly full) C++11 programming environment).
18 # This file may be included multiple times, but only has effect the first time.
21 .if !target(__<bsd.compiler.mk>__)
22 __<bsd.compiler.mk>__:
24 _v!= ${CC} --version 2>/dev/null || echo 0.0.0
25 .if !defined(COMPILER_TYPE)
28 . elif ${CC:T:M*clang*}
37 .error Unable to determine compiler type for ${CC}. Consider setting COMPILER_TYPE.
40 .if !defined(COMPILER_VERSION)
41 COMPILER_VERSION!=echo ${_v:M[1-9].[0-9]*} | awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}'
45 .if ${COMPILER_TYPE} == "clang" || \
46 (${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40800)
47 COMPILER_FEATURES= c++11
52 .endif # !target(__<bsd.compiler.mk>__)