This is the patch that I'm currently using to get Configure.pl to ignore
-arch flags in the Perl 5 config on Darwin.
Index: config/init/defaults.pm
===================================================================
--- config/init/defaults.pm     (revision 26775)
+++ config/init/defaults.pm     (working copy)
@@ -72,6 +72,15 @@
     # to their 'use English' names as documented in 'perlvar'.)
     $conf->data->set_p5( OSNAME => $^O );
 
+    my $p5_ccflags = $Config{ccflags};
+    my $p5_ldflags = $Config{ldflags};
+    my $p5_lddlflags = $Config{lddlflags};
+    if ($^O eq 'darwin') {
+       $p5_ccflags =~ s/-arch (?:i386|ppc(?:64)?|x86_64)\b//g;
+       $p5_ldflags =~ s/-arch (?:i386|ppc(?:64)?|x86_64)\b//g;
+       $p5_lddlflags =~ s/-arch (?:i386|ppc(?:64)?|x86_64)\b//g;
+    }
+
     # We need a Glossary somewhere!
     $conf->data->set(
         debugging => $conf->options->get('debugging') ? 1 : 0,
@@ -82,7 +91,7 @@
         # Compiler -- used to turn .c files into object files.
         # (Usually cc or cl, or something like that.)
         cc      => $Config{cc},
-        ccflags => $Config{ccflags},
+        ccflags => $p5_ccflags,
         ccwarn  => exists( $Config{ccwarn} ) ? $Config{ccwarn} : '',
 
         # Flags used to indicate this object file is to be compiled
@@ -104,7 +113,7 @@
         # Perl5's Configure doesn't distinguish linking from loading, so
         # make a reasonable guess at defaults.
         link      => $Config{cc},
-        linkflags => $Config{ldflags},
+        linkflags => $p5_ldflags,
 
         # Linker Flags to have this binary work with the shared and dynamically
         # loadable libraries we're building.  On HP-UX, for example, we need to
@@ -115,16 +124,16 @@
         # modules. Often $cc on Unix-ish systems, but apparently sometimes
         # it's ld.
         ld      => $Config{ld},
-        ldflags => $Config{ldflags},
+        ldflags => $p5_ldflags,
 
         # Some operating systems (e.g. Darwin) distinguish between shared
         # libraries and modules that can be dynamically loaded.  Flags to tell
         # ld to build a shared library, e.g.  -shared for GNU ld.
-        ld_share_flags => $Config{lddlflags},
+        ld_share_flags => $p5_lddlflags,
 
         # Flags to tell ld to build a dynamically loadable module, e.g.
         # -shared for GNU ld.
-        ld_load_flags => $Config{lddlflags},
+        ld_load_flags => $p5_lddlflags,
 
         libs => $Config{libs},
 

Reply via email to