Index: Portfile
===================================================================
--- Portfile	(revision 111066)
+++ Portfile	(working copy)
@@ -46,6 +46,14 @@
     configure.pre_args-append --build=${build_arch}-apple-darwin${os.major}
 }
 
+patchfiles PR-40478.patch
+
+post-patch {
+    # The patch I generated from GPL2 doesn't apply this hunk.
+    # TODO: Someone should roll this into PR-40478.patch
+    system "echo '#include \"../config-apple-verbatim.h\"' >> ${worksrcpath}/libcpp/config.in"
+}
+
 configure.dir       ${workpath}/build
 configure.cmd       ${worksrcpath}/configure
 configure.args      --enable-languages=c,c++,objc,obj-c++,lto,fortran,java \
Index: files/PR-40478.patch
===================================================================
--- files/PR-40478.patch	(revision 0)
+++ files/PR-40478.patch	(working copy)
@@ -0,0 +1,46 @@
+diff -Naurp gcc-5666.3.orig/config-apple-verbatim.h gcc-5666.3/config-apple-verbatim.h
+--- config-apple-verbatim.h	1969-12-31 16:00:00.000000000 -0800
++++ config-apple-verbatim.h	2013-09-14 07:55:08.000000000 -0700
+@@ -0,0 +1,13 @@
++#ifdef __APPLE__
++
++#undef SIZEOF_LONG
++#if __LP64__
++#define SIZEOF_LONG 8
++#else
++#define SIZEOF_LONG 4
++#endif
++
++#undef SIZEOF_VOID_P
++#define SIZEOF_VOID_P SIZEOF_LONG
++
++#endif
+diff -Naurp gcc-5666.3.orig/gcc/config.in gcc-5666.3/gcc/config.in
+--- gcc/config.in	2010-10-14 13:27:54.000000000 -0700
++++ gcc/config.in	2013-09-14 07:53:45.000000000 -0700
+@@ -1414,3 +1414,6 @@
+ #undef vfork
+ #endif
+ 
++#ifndef USED_FOR_TARGET
++#include "../config-apple-verbatim.h"
++#endif
+diff -Naurp gcc-5666.3.orig/libdecnumber/config.in gcc-5666.3/libdecnumber/config.in
+--- libdecnumber/config.in	2010-10-14 13:24:11.000000000 -0700
++++ libdecnumber/config.in	2013-09-14 07:53:52.000000000 -0700
+@@ -74,3 +74,6 @@
+ 
+ /* Define to `long' if <sys/types.h> does not define. */
+ #undef off_t
++
++#include "../config-apple-verbatim.h"
++
+diff -Naurp gcc-5666.3.orig/libgomp/config.h.in gcc-5666.3/libgomp/config.h.in
+--- libgomp/config.h.in	2010-10-14 13:24:11.000000000 -0700
++++ libgomp/config.h.in	2013-09-14 07:53:27.000000000 -0700
+@@ -101,3 +101,5 @@
+ 
+ /* Version number of package */
+ #undef VERSION
++
++#include "../config-apple-verbatim.h"
