--- src/build-data/cc/clang.txt.orig	2017-10-01 23:00:00.000000000 -0700
+++ src/build-data/cc/clang.txt	2017-12-27 09:09:02.000000000 -0700
@@ -15,8 +15,8 @@
 
 makefile_style unix
 
-lib_opt_flags "-O2"
-check_opt_flags "-O2"
+lib_opt_flags "__MACPORTS_OPT_FLAG__"
+check_opt_flags "__MACPORTS_OPT_FLAG__"
 shared_flags "-fPIC"
 debug_flags -g
 no_debug_flags "-finline-functions"
@@ -38,7 +38,8 @@
 </mach_opt>
 
 <mach_abi_linking>
-x86_64  -> "-m64"
+x86_64  -> "-arch x86_64"
+x86_32  -> "-arch i386"
 mips32  -> "-mabi=32"
 mipsn32  -> "-mabi=n32"
 mips64  -> "-mabi=64"
@@ -46,7 +47,8 @@
 s390x   -> "-m64"
 sparc32 -> "-m32 -mno-app-regs"
 sparc64 -> "-m64 -mno-app-regs"
-ppc64   -> "-m64"
+ppc32   -> "-arch ppc"
+ppc64   -> "-arch ppc64"
 
 # This should probably be used on most/all targets, but the docs are incomplete
 openbsd -> "-pthread"
@@ -54,4 +56,5 @@
 dragonfly -> "-pthread"
 netbsd  -> "-pthread -D_NETBSD_SOURCE"
 qnx     -> "-fexceptions -D_QNX_SOURCE"
+darwin  -> "-stdlib=__MACPORTS_CXX_STDLIB__"
 </mach_abi_linking>
--- src/build-data/cc/gcc.txt.orig	2017-10-01 23:00:00.000000000 -0700
+++ src/build-data/cc/gcc.txt	2017-12-27 09:13:27.000000000 -0700
@@ -15,8 +15,8 @@
 
 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"
+lib_opt_flags "__MACPORTS_OPT_FLAG__"
+check_opt_flags "__MACPORTS_OPT_FLAG__"
 shared_flags "-fPIC"
 debug_flags -g
 no_debug_flags "-finline-functions"
@@ -94,13 +94,15 @@
 
 # The 'linking' bit means "use this for both compiling *and* linking"
 <mach_abi_linking>
-x86_64  -> "-m64"
+x86_32  -> "-arch i386"
+x86_64  -> "-arch x86_64"
 mips64  -> "-mabi=64"
 s390    -> "-m31"
 s390x   -> "-m64"
 sparc32 -> "-m32 -mno-app-regs"
 sparc64 -> "-m64 -mno-app-regs"
-ppc64   -> "-m64"
+ppc32   -> "-arch ppc"
+ppc64   -> "-arch ppc64"
 ppc64le -> "-m64"
 
 # This should probably be used on most/all targets, but the docs are unclear
