macro_name GCC

binary_name g++

has_tr1 yes

compile_option "-c "
output_to_option "-o "
add_include_dir_option -I
add_lib_dir_option -L
add_lib_option -l

lang_flags "-D_REENTRANT -Wno-long-long"
warning_flags "-W -Wall"

maintainer_warning_flags "-Werror -Wall -Wextra -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wold-style-cast"

lib_opt_flags "-O3"
check_opt_flags "-O2"
shared_flags "-fPIC"
debug_flags -g
no_debug_flags "-finline-functions"

visibility_build_flags "-fvisibility=hidden"
visibility_attribute '__attribute__((visibility("default")))'

makefile_style unix

<so_link_flags>
# The default works for GNU ld and several other Unix linkers
default -> "$(CXX) -shared -fPIC -Wl,-soname,$(SONAME)"

# AIX doesn't seem to have soname support (weird...)
aix     -> "$(CXX) -shared -fPIC"

# OpenBSD doesn't use soname
openbsd -> "$(CXX) -shared -fPIC"

darwin  -> "$(CXX) -dynamiclib -fPIC -install_name $(LIBDIR)/$(SONAME)"
hpux    -> "$(CXX) -shared -fPIC -Wl,+h,$(SONAME)"
solaris -> "$(CXX) -shared -fPIC -Wl,-h,$(SONAME)"
</so_link_flags>

<mach_opt>
# Avoid using -march=i[345]86, instead tune for generic
i386        -> "-mtune=generic -momit-leaf-frame-pointer"
i486        -> "-mtune=generic -momit-leaf-frame-pointer"
i586        -> "-mtune=generic -momit-leaf-frame-pointer"

sandybridge -> "-march=corei7-avx -momit-leaf-frame-pointer"
atom32      -> "-march=atom -momit-leaf-frame-pointer"

# For recent GCC
nehalem     -> "-march=corei7 -momit-leaf-frame-pointer"
westmere    -> "-march=corei7 -maes -momit-leaf-frame-pointer"

# For older GCC
#nehalem      -> "-march=core2 -msse4.1 -msse4.2 -momit-leaf-frame-pointer"
#westmere     -> "-march=core2 -msse4.1 -msse4.2 -maes -momit-leaf-frame-pointer"

ppc601      -> "-mpowerpc -mcpu=601"
cellppu     -> "-mcpu=cell"
e500v2      -> "-mcpu=8548"

# No scheduler in GCC for anything after EV67
alpha-ev68  -> "-mcpu=ev67"
alpha-ev7   -> "-mcpu=ev67"

# The patch from Debian bug 594159 has this, don't know why though...
sh4         -> "-m4 -mieee"

# Default family options (SUBMODEL is substitued with the actual
# submodel name). Anything after the quotes is what should be
# *removed* from the submodel name before it's put into SUBMODEL.

alpha     -> "-mcpu=SUBMODEL" alpha-
arm       -> "-march=SUBMODEL"
superh    -> "-mSUBMODEL" sh
hppa      -> "-march=SUBMODEL" hppa
ia64      -> "-mtune=SUBMODEL"
m68k      -> "-mSUBMODEL"
mips32    -> "-mips1 -mcpu=SUBMODEL" mips32-
mips64    -> "-mips3 -mcpu=SUBMODEL" mips64-
ppc32     -> "-mcpu=SUBMODEL" ppc
ppc64     -> "-mcpu=SUBMODEL" ppc
sparc32   -> "-mcpu=SUBMODEL -Wa,-xarch=v8plus" sparc32-
sparc64   -> "-mcpu=v9 -mtune=SUBMODEL"
x86_32    -> "-march=SUBMODEL -momit-leaf-frame-pointer"
x86_64    -> "-march=SUBMODEL -momit-leaf-frame-pointer"
</mach_opt>

# The 'linking' bit means "use this for both compiling *and* linking"
<mach_abi_linking>
x86_64  -> "-m64"
mips64  -> "-mabi=64"
s390    -> "-m31"
s390x   -> "-m64"
sparc32 -> "-m32 -mno-app-regs"
sparc64 -> "-m64 -mno-app-regs"
ppc64   -> "-m64"

# This should probably be used on most/all targets, but the docs are unclear
openbsd   -> "-pthread"
freebsd   -> "-pthread"
dragonfly -> "-pthread"
netbsd    -> "-pthread -D_NETBSD_SOURCE"
qnx       -> "-fexceptions -D_QNX_SOURCE"
</mach_abi_linking>
