Refactor configure.ac's: Define FIND_GCC() in aclocal.m4
authorIan Lynagh <igloo@earth.li>
Tue, 2 Aug 2011 23:53:57 +0000 (00:53 +0100)
committerIan Lynagh <igloo@earth.li>
Tue, 2 Aug 2011 23:53:57 +0000 (00:53 +0100)
aclocal.m4
configure.ac
distrib/configure.ac.in

index dc94791..d798eb5 100644 (file)
@@ -1607,4 +1607,22 @@ AC_DEFUN([XCODE_VERSION],[
     fi
 ])
 
+# FIND_GCC()
+# --------------------------------
+# Finds where gcc is
+AC_DEFUN([FIND_GCC],[
+    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)
+])
+
 # LocalWords:  fi
index 2045a15..29185d3 100644 (file)
@@ -426,18 +426,7 @@ AC_SUBST([SplitObjsBroken])
 
 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)
+FIND_GCC()
 
 dnl ** Which ld to use?
 dnl --------------------------------------------------------------
index 72fb712..ce51c27 100644 (file)
@@ -51,18 +51,7 @@ XCODE_VERSION()
 
 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)
+FIND_GCC()
 
 FP_GCC_VERSION
 AC_PROG_CPP