[commit: ghc] ghc-7.2: Os X: With Xcode 4, check for gcc-4.2 also in the setup for binary distributions (3b4747f)
Ian Lynagh
igloo at earth.li
Wed Aug 3 16:58:47 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : ghc-7.2
http://hackage.haskell.org/trac/ghc/changeset/3b4747f996c0078f94a0053f09d3c5024ca40e8a
>---------------------------------------------------------------
commit 3b4747f996c0078f94a0053f09d3c5024ca40e8a
Author: Manuel M T Chakravarty <chak at cse.unsw.edu.au>
Date: Mon Aug 1 11:57:43 2011 +1000
Os X: With Xcode 4, check for gcc-4.2 also in the setup for binary distributions
>---------------------------------------------------------------
distrib/configure.ac.in | 31 ++++++++++++++++++++++++++++++-
1 files changed, 30 insertions(+), 1 deletions(-)
diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in
index facba91..a378004 100644
--- a/distrib/configure.ac.in
+++ b/distrib/configure.ac.in
@@ -50,7 +50,36 @@ AC_PATH_PROG(SedCmd,gsed sed,sed)
#
dnl ** How to invoke gcc/cpp **
#
-FP_ARG_WITH_PATH_GNU_PROG([CC], [gcc])
+if test "$TargetOS_CPP" = "darwin"
+then
+ AC_MSG_CHECKING(XCode version)
+ XCodeVersion=`xcodebuild -version | grep Xcode | sed "s/Xcode //"`
+ # Old XCode versions don't actually give the XCode version
+ if test "$XCodeVersion" = ""
+ then
+ AC_MSG_RESULT(not found (too old?))
+ else
+ AC_MSG_RESULT($XCodeVersion)
+ XCodeVersion1=`echo "$XCodeVersion" | sed 's/\..*//'`
+changequote(, )dnl
+ XCodeVersion2=`echo "$XCodeVersion" | sed 's/[^.]*\.\([^.]*\).*/\1/'`
+changequote([, ])dnl
+ AC_MSG_NOTICE(XCode version component 1: $XCodeVersion1)
+ AC_MSG_NOTICE(XCode version component 2: $XCodeVersion2)
+ fi
+fi
+
+dnl ** Which gcc to use?
+dnl --------------------------------------------------------------
+if test "$TargetOS_CPP" = "darwin" &&
+ test "$XCodeVersion1" -ge 4
+then
+ # From Xcode 4, use 'gcc-4.2' to force the use of the gcc legacy backend (instead of the LLVM
+ # backend)
+ FP_ARG_WITH_PATH_GNU_PROG([CC], [gcc-4.2])
+else
+ FP_ARG_WITH_PATH_GNU_PROG([CC], [gcc])
+fi
export CC
WhatGccIsCalled="$CC"
AC_SUBST(WhatGccIsCalled)
More information about the Cvs-ghc
mailing list