add atexit (#4456)
[ghc-hetmet.git] / configure.ac
index a0e0021..a8d535f 100644 (file)
@@ -288,7 +288,7 @@ checkOS "$TargetOS"
 
 # Verify that the installed (bootstrap) GHC is capable of generating
 # code for the requested build platform.
-if test "$build" != "$bootstrap_target"
+if test "$BuildPlatform" != "$bootstrap_target"
 then
     echo "This GHC (${WithGhc}) does not generate code for the build platform"
     echo "   GHC target platform    : $bootstrap_target"
@@ -296,6 +296,10 @@ then
     exit 1
 fi
 
+echo "GHC build  : $BuildPlatform"
+echo "GHC host   : $HostPlatform"
+echo "GHC target : $TargetPlatform"
+
 AC_SUBST(BuildPlatform)
 AC_SUBST(HostPlatform)
 AC_SUBST(TargetPlatform)
@@ -414,6 +418,41 @@ FP_ARG_WITH_PATH_GNU_PROG([NM], [nm])
 NmCmd="$NM"
 AC_SUBST([NmCmd])
 
+SplitObjsBroken=NO
+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?))
+        SplitObjsBroken=YES
+    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)
+        # Split objects is broken (#4013) with XCode < 3.2
+        if test "$XCodeVersion1" -lt 3
+        then
+            SplitObjsBroken=YES
+        else
+            if test "$XCodeVersion1" -eq 3
+            then
+                if test "$XCodeVersion2" -lt 2
+                then
+                    SplitObjsBroken=YES
+                fi
+            fi
+        fi
+    fi
+fi
+AC_SUBST([SplitObjsBroken])
+
 dnl ** Mac OS X: explicit deployment target
 dnl --------------------------------------------------------------
 AC_ARG_WITH([macosx-deployment-target],
@@ -874,7 +913,7 @@ if grep '   ' compiler/ghc.cabal.in 2>&1 >/dev/null; then
    AC_MSG_ERROR([compiler/ghc.cabal.in contains tab characters; please remove them])
 fi
 
-AC_CONFIG_FILES([mk/config.mk mk/install.mk mk/project.mk compiler/ghc.cabal ghc/ghc-bin.cabal utils/runghc/runghc.cabal ghc.spec extra-gcc-opts docs/users_guide/ug-book.xml docs/users_guide/ug-ent.xml docs/index.html libraries/prologue.txt distrib/ghc.iss distrib/configure.ac distrib/MacOS/installer-scripts/create-links distrib/MacOS/installer-scripts/Uninstaller distrib/MacOS/GHC-system.pmdoc/index.xml])
+AC_CONFIG_FILES([mk/config.mk mk/install.mk mk/project.mk compiler/ghc.cabal ghc/ghc-bin.cabal utils/runghc/runghc.cabal ghc.spec extra-gcc-opts docs/users_guide/ug-book.xml docs/users_guide/ug-ent.xml docs/index.html libraries/prologue.txt distrib/ghc.iss distrib/configure.ac])
 AC_CONFIG_COMMANDS([mk/stamp-h],[echo timestamp > mk/stamp-h])
 AC_OUTPUT