From 1ab1bec9087762dbd01f2b4907311f463f95ea46 Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Wed, 30 Sep 2009 10:19:06 +0200 Subject: [PATCH] Strip all -arch flags from Perl and Ruby The system provided Perl and Ruby libraries adds -arch flags since they were built as universal binaries. This causes Vim to build with these flags which is undesirable (the default should be to only build for the native architecture). The solution is to strip any -arch flags from Perl and Ruby. A universal binary can be built by using the --with-archs configure flag. --- src/configure | 15 ++++++++++----- src/configure.in | 20 ++++++++++++++------ 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/configure b/src/configure index 56db1453d5..31f75aed4e 100755 --- a/src/configure +++ b/src/configure @@ -4864,6 +4864,11 @@ echo "${ECHO_T}OK" >&6; } perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \ -e 'ccdlflags' | sed -e 's/-bE:perl.exp//'` + if test "x$MACOSX" = "xyes"; then + perllibs=`echo "$perllibs" | sed -e 's/-arch[^-]*//g'` + perlcppflags=`echo "$perlcppflags" | sed -e 's/-arch[^-]*//g'` + fi + { echo "$as_me:$LINENO: checking if compile and link flags for Perl are sane" >&5 echo $ECHO_N "checking if compile and link flags for Perl are sane... $ECHO_C" >&6; } cflags_save=$CFLAGS @@ -5740,12 +5745,12 @@ echo "${ECHO_T}$rubyhdrdir" >&6; } RUBY_LIBS="$librubyarg $RUBY_LIBS" fi rubyldflags=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG["LDFLAGS"]'` - if test "X$rubyldflags" != "X"; then - rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'` - if test "X$rubyldflags" != "X"; then - LDFLAGS="$rubyldflags $LDFLAGS" - fi + if test "x$MACOSX" = "xyes"; then + rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch[^-]*//g'` fi + if test "X$rubyldflags" != "X"; then + LDFLAGS="$rubyldflags $LDFLAGS" + fi RUBY_SRC="if_ruby.c" RUBY_OBJ="objects/if_ruby.o" RUBY_PRO="if_ruby.pro" diff --git a/src/configure.in b/src/configure.in index fc925ea5db..2bcc32f324 100644 --- a/src/configure.in +++ b/src/configure.in @@ -573,6 +573,14 @@ if test "$enable_perlinterp" = "yes"; then perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \ -e 'ccdlflags' | sed -e 's/-bE:perl.exp//'` + if test "x$MACOSX" = "xyes"; then + dnl Perl on Mac OS X 10.5 and later adds "-arch" flags but these + dnl should only be included if requested by passing --with-archs + dnl to configure, so strip these flags first (if present) + perllibs=`echo "$perllibs" | sed -e 's/-arch[[^-]]*//g'` + perlcppflags=`echo "$perlcppflags" | sed -e 's/-arch[[^-]]*//g'` + fi + dnl check that compiling a simple program still works with the flags dnl added for Perl. AC_MSG_CHECKING([if compile and link flags for Perl are sane]) @@ -987,15 +995,15 @@ if test "$enable_rubyinterp" = "yes"; then RUBY_LIBS="$librubyarg $RUBY_LIBS" fi rubyldflags=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LDFLAGS"]]'` - if test "X$rubyldflags" != "X"; then + if test "x$MACOSX" = "xyes"; then dnl Ruby on Mac OS X 10.5 and later adds "-arch" flags but these - dnl should only be included if requested by passing --with-mac-arch + dnl should only be included if requested by passing --with-archs dnl to configure, so strip these flags first (if present) - rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'` - if test "X$rubyldflags" != "X"; then - LDFLAGS="$rubyldflags $LDFLAGS" - fi + rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch[[^-]]*//g'` fi + if test "X$rubyldflags" != "X"; then + LDFLAGS="$rubyldflags $LDFLAGS" + fi RUBY_SRC="if_ruby.c" RUBY_OBJ="objects/if_ruby.o" RUBY_PRO="if_ruby.pro"