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

index 680e0a8..dc94791 100644 (file)
@@ -1581,4 +1581,30 @@ LIBRARY_[]translit([$1], [-], [_])[]_VERSION=`grep -i "^version:" libraries/${di
 AC_SUBST(LIBRARY_[]translit([$1], [-], [_])[]_VERSION)
 ])
 
+# XCODE_VERSION()
+# --------------------------------
+# Gets the version number of XCode, if on a Mac
+AC_DEFUN([XCODE_VERSION],[
+    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?))
+            XCodeVersion1=0
+            XCodeVersion2=0
+        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
+])
+
 # LocalWords:  fi
index ce9b522..2045a15 100644 (file)
@@ -403,26 +403,7 @@ then
     fi
 fi
 
-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?))
-        XCodeVersion1=0
-        XCodeVersion2=0
-    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
+XCODE_VERSION()
 
 SplitObjsBroken=NO
 if test "$TargetOS_CPP" = "darwin"
index a378004..72fb712 100644 (file)
@@ -47,27 +47,7 @@ dnl ** Find the path to sed **
 #
 AC_PATH_PROG(SedCmd,gsed sed,sed)
 
-#
-dnl ** How to invoke gcc/cpp **
-#
-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
+XCODE_VERSION()
 
 dnl ** Which gcc to use?
 dnl --------------------------------------------------------------