Index: gcc43/Portfile
===================================================================
--- gcc43/Portfile	(revision 111066)
+++ gcc43/Portfile	(working copy)
@@ -60,7 +60,11 @@
 depends_skip_archcheck-append gcc_select ld64 cctools
 license_noconflict  gmp mpfr
 
-patchfiles          Make-lang.in.diff darwin10.diff i386_multilib.diff ppc_fde_encoding.diff
+patchfiles          Make-lang.in.diff \
+                    darwin10.diff \
+                    i386_multilib.diff \
+                    ppc_fde_encoding.diff \
+                    PR-40478.patch
 
 set major           4.3
 
Index: gcc43/files/PR-40478.patch
===================================================================
--- gcc43/files/PR-40478.patch	(revision 0)
+++ gcc43/files/PR-40478.patch	(working copy)
@@ -0,0 +1,69 @@
+commit ff5dbc242ff2f1ba9e6d99d695df9b803adcd734
+Author: Lawrence Velázquez <larryv@alum.mit.edu>
+Date:   Sat Sep 14 14:24:00 2013 -0400
+
+    Fix broken universal build on Leopard.
+    
+    Patch by jeremyhu. See https://trac.macports.org/ticket/40478.
+
+diff --git config-apple-verbatim.h config-apple-verbatim.h
+new file mode 100644
+index 0000000..1ef40be
+--- /dev/null
++++ config-apple-verbatim.h
+@@ -0,0 +1,14 @@
++#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 --git gcc/config.in gcc/config.in
+index c61ce52..55c7e8d 100644
+--- gcc/config.in
++++ gcc/config.in
+@@ -1517,3 +1517,6 @@
+ #undef vfork
+ #endif
+ 
++#ifndef USED_FOR_TARGET
++#include "../config-apple-verbatim.h"
++#endif
+diff --git libcpp/config.in libcpp/config.in
+index 5d52ec1..73e8d03 100644
+--- libcpp/config.in
++++ libcpp/config.in
+@@ -283,3 +283,5 @@
+ 
+ /* Define to `int' if <sys/types.h> does not define. */
+ #undef ssize_t
++
++#include "../config-apple-verbatim.h"
+diff --git libdecnumber/config.in libdecnumber/config.in
+index b25b9e9..91afde4 100644
+--- libdecnumber/config.in
++++ libdecnumber/config.in
+@@ -78,3 +78,5 @@
+ 
+ /* Define to `long' if <sys/types.h> does not define. */
+ #undef off_t
++
++#include "../config-apple-verbatim.h"
+diff --git libgomp/config.h.in libgomp/config.h.in
+index a80176f..adc3c8b 100644
+--- libgomp/config.h.in
++++ libgomp/config.h.in
+@@ -114,3 +114,5 @@
+ 
+ /* Version number of package */
+ #undef VERSION
++
++#include "../config-apple-verbatim.h"
Index: gcc44/Portfile
===================================================================
--- gcc44/Portfile	(revision 111066)
+++ gcc44/Portfile	(working copy)
@@ -61,7 +61,8 @@
 depends_skip_archcheck-append gcc_select ld64 cctools
 license_noconflict  gmp mpfr
 
-patchfiles          ppc_fde_encoding.diff
+patchfiles          ppc_fde_encoding.diff \
+                    PR-40478.patch
 
 set major           4.4
 
Index: gcc44/files/PR-40478.patch
===================================================================
--- gcc44/files/PR-40478.patch	(revision 0)
+++ gcc44/files/PR-40478.patch	(working copy)
@@ -0,0 +1,69 @@
+commit 4e6b4f895b82759a969dce143252047d98f7350f
+Author: Lawrence Velázquez <larryv@alum.mit.edu>
+Date:   Sat Sep 14 14:21:31 2013 -0400
+
+    Fix broken universal build on Leopard.
+    
+    Patch by jeremyhu. See https://trac.macports.org/ticket/40478.
+
+diff --git config-apple-verbatim.h config-apple-verbatim.h
+new file mode 100644
+index 0000000..1ef40be
+--- /dev/null
++++ config-apple-verbatim.h
+@@ -0,0 +1,14 @@
++#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 --git gcc/config.in gcc/config.in
+index ea43afb..3b95722 100644
+--- gcc/config.in
++++ gcc/config.in
+@@ -1618,3 +1618,6 @@
+ #undef vfork
+ #endif
+ 
++#ifndef USED_FOR_TARGET
++#include "../config-apple-verbatim.h"
++#endif
+diff --git libcpp/config.in libcpp/config.in
+index 5d52ec1..73e8d03 100644
+--- libcpp/config.in
++++ libcpp/config.in
+@@ -283,3 +283,5 @@
+ 
+ /* Define to `int' if <sys/types.h> does not define. */
+ #undef ssize_t
++
++#include "../config-apple-verbatim.h"
+diff --git libdecnumber/config.in libdecnumber/config.in
+index b25b9e9..91afde4 100644
+--- libdecnumber/config.in
++++ libdecnumber/config.in
+@@ -78,3 +78,5 @@
+ 
+ /* Define to `long' if <sys/types.h> does not define. */
+ #undef off_t
++
++#include "../config-apple-verbatim.h"
+diff --git libgomp/config.h.in libgomp/config.h.in
+index 88bae83..e4b589f 100644
+--- libgomp/config.h.in
++++ libgomp/config.h.in
+@@ -126,3 +126,5 @@
+ 
+ /* Version number of package */
+ #undef VERSION
++
++#include "../config-apple-verbatim.h"
Index: gcc45/Portfile
===================================================================
--- gcc45/Portfile	(revision 111066)
+++ gcc45/Portfile	(working copy)
@@ -69,7 +69,8 @@
 depends_skip_archcheck-append gcc_select ld64 cctools
 license_noconflict  gmp mpfr ppl libmpc
 
-patchfiles          ppc_fde_encoding.diff
+patchfiles          ppc_fde_encoding.diff \
+                    PR-40478.patch
 
 set major           4.5
 
Index: gcc45/files/PR-40478.patch
===================================================================
--- gcc45/files/PR-40478.patch	(revision 0)
+++ gcc45/files/PR-40478.patch	(working copy)
@@ -0,0 +1,69 @@
+commit f110bd3ae7af8cb3abb44934dedb3417ec2a5445
+Author: Lawrence Velázquez <larryv@alum.mit.edu>
+Date:   Sat Sep 14 14:18:51 2013 -0400
+
+    Fix broken universal build on Leopard.
+    
+    Patch by jeremyhu. See https://trac.macports.org/ticket/40478.
+
+diff --git config-apple-verbatim.h config-apple-verbatim.h
+new file mode 100644
+index 0000000..1ef40be
+--- /dev/null
++++ config-apple-verbatim.h
+@@ -0,0 +1,14 @@
++#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 --git gcc/config.in gcc/config.in
+index b7884a3..bf48806 100644
+--- gcc/config.in
++++ gcc/config.in
+@@ -1908,3 +1908,6 @@
+ #undef vfork
+ #endif
+ 
++#ifndef USED_FOR_TARGET
++#include "../config-apple-verbatim.h"
++#endif
+diff --git libcpp/config.in libcpp/config.in
+index 4c71ec3..9a58b10 100644
+--- libcpp/config.in
++++ libcpp/config.in
+@@ -283,3 +283,5 @@
+ 
+ /* Define to `int' if <sys/types.h> does not define. */
+ #undef ssize_t
++
++#include "../config-apple-verbatim.h"
+diff --git libdecnumber/config.in libdecnumber/config.in
+index 98dc67d..a1a344c 100644
+--- libdecnumber/config.in
++++ libdecnumber/config.in
+@@ -92,3 +92,5 @@
+ 
+ /* Define to `long int' if <sys/types.h> does not define. */
+ #undef off_t
++
++#include "../config-apple-verbatim.h"
+diff --git libgomp/config.h.in libgomp/config.h.in
+index c88660a..7fda9d4 100644
+--- libgomp/config.h.in
++++ libgomp/config.h.in
+@@ -129,3 +129,5 @@
+ 
+ /* Version number of package */
+ #undef VERSION
++
++#include "../config-apple-verbatim.h"
Index: gcc46/Portfile
===================================================================
--- gcc46/Portfile	(revision 111066)
+++ gcc46/Portfile	(working copy)
@@ -54,7 +54,9 @@
 depends_skip_archcheck-append gcc_select ld64 cctools
 license_noconflict  gmp mpfr ppl libmpc
 
-patchfiles          gcc-4.6-cloog_lang_c.patch enable_libstdcxx_time_yes.patch
+patchfiles          gcc-4.6-cloog_lang_c.patch \
+                    enable_libstdcxx_time_yes.patch \
+                    PR-40478.patch
 
 set major           4.6
 
Index: gcc46/files/PR-40478.patch
===================================================================
--- gcc46/files/PR-40478.patch	(revision 0)
+++ gcc46/files/PR-40478.patch	(working copy)
@@ -0,0 +1,69 @@
+commit 025efa8b4e6db20f308a3b4f7608b618b2b54ece
+Author: Lawrence Velázquez <larryv@alum.mit.edu>
+Date:   Sat Sep 14 14:11:44 2013 -0400
+
+    Fix broken universal build on Leopard.
+    
+    Patch by jeremyhu. See https://trac.macports.org/ticket/40478.
+
+diff --git config-apple-verbatim.h config-apple-verbatim.h
+new file mode 100644
+index 0000000..1ef40be
+--- /dev/null
++++ config-apple-verbatim.h
+@@ -0,0 +1,14 @@
++#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 --git gcc/config.in gcc/config.in
+index 584ec65..f6d4065 100644
+--- gcc/config.in
++++ gcc/config.in
+@@ -1976,3 +1976,6 @@
+ #undef vfork
+ #endif
+ 
++#ifndef USED_FOR_TARGET
++#include "../config-apple-verbatim.h"
++#endif
+diff --git libcpp/config.in libcpp/config.in
+index 05542fe..e7be80c 100644
+--- libcpp/config.in
++++ libcpp/config.in
+@@ -349,3 +349,5 @@
+ /* Define to the type of an unsigned integer type wide enough to hold a
+    pointer, if such a type exists, and if the system does not define it. */
+ #undef uintptr_t
++
++#include "../config-apple-verbatim.h"
+diff --git libdecnumber/config.in libdecnumber/config.in
+index 98dc67d..a1a344c 100644
+--- libdecnumber/config.in
++++ libdecnumber/config.in
+@@ -92,3 +92,5 @@
+ 
+ /* Define to `long int' if <sys/types.h> does not define. */
+ #undef off_t
++
++#include "../config-apple-verbatim.h"
+diff --git libgomp/config.h.in libgomp/config.h.in
+index 14c7e2a..d69e3f5 100644
+--- libgomp/config.h.in
++++ libgomp/config.h.in
+@@ -133,3 +133,5 @@
+ 
+ /* Version number of package */
+ #undef VERSION
++
++#include "../config-apple-verbatim.h"
Index: gcc47/Portfile
===================================================================
--- gcc47/Portfile	(revision 111066)
+++ gcc47/Portfile	(working copy)
@@ -54,7 +54,10 @@
 depends_skip_archcheck-append gcc_select ld64 cctools
 license_noconflict  gmp mpfr ppl libmpc
 
-patchfiles          ppc_fde_encoding.diff gcc-PR-53453.patch enable_libstdcxx_time_yes.patch
+patchfiles          ppc_fde_encoding.diff \
+                    gcc-PR-53453.patch \
+                    enable_libstdcxx_time_yes.patch \
+                    PR-40478.patch
 
 set major           4.7
 
Index: gcc47/files/PR-40478.patch
===================================================================
--- gcc47/files/PR-40478.patch	(revision 0)
+++ gcc47/files/PR-40478.patch	(working copy)
@@ -0,0 +1,69 @@
+commit b55ce4cea135d02f427ec76a8255c472364d0a82
+Author: Lawrence Velázquez <larryv@alum.mit.edu>
+Date:   Sat Sep 14 13:40:31 2013 -0400
+
+    Fix broken universal build on Leopard.
+    
+    Patch by jeremyhu. See https://trac.macports.org/ticket/40478.
+
+diff --git config-apple-verbatim.h config-apple-verbatim.h
+new file mode 100644
+index 0000000..1ef40be
+--- /dev/null
++++ config-apple-verbatim.h
+@@ -0,0 +1,14 @@
++#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 --git gcc/config.in gcc/config.in
+index 2e632b2..f931f23 100644
+--- gcc/config.in
++++ gcc/config.in
+@@ -2029,3 +2029,6 @@
+ #undef vfork
+ #endif
+ 
++#ifndef USED_FOR_TARGET
++#include "../config-apple-verbatim.h"
++#endif
+diff --git libcpp/config.in libcpp/config.in
+index 05542fe..e7be80c 100644
+--- libcpp/config.in
++++ libcpp/config.in
+@@ -349,3 +349,5 @@
+ /* Define to the type of an unsigned integer type wide enough to hold a
+    pointer, if such a type exists, and if the system does not define it. */
+ #undef uintptr_t
++
++#include "../config-apple-verbatim.h"
+diff --git libdecnumber/config.in libdecnumber/config.in
+index 98dc67d..a1a344c 100644
+--- libdecnumber/config.in
++++ libdecnumber/config.in
+@@ -92,3 +92,5 @@
+ 
+ /* Define to `long int' if <sys/types.h> does not define. */
+ #undef off_t
++
++#include "../config-apple-verbatim.h"
+diff --git libgomp/config.h.in libgomp/config.h.in
+index 14c7e2a..d69e3f5 100644
+--- libgomp/config.h.in
++++ libgomp/config.h.in
+@@ -133,3 +133,5 @@
+ 
+ /* Version number of package */
+ #undef VERSION
++
++#include "../config-apple-verbatim.h"
