e38e300034029b8319f2f45b1a7a8a6a5b42d0dc
[awesomized/libmemcached] / m4 / check_gcc_version.m4
1 AC_DEFUN([FORCE_MAC_GCC42],
2 [AS_IF([test "$GCC" = "yes"],[
3 dnl If you're on a Mac, and you didn't ask for a specific compiler
4 dnl You're gonna get 4.2.
5 AS_IF([test "$host_vendor" = "apple" -a "x${ac_cv_env_CC_set}" = "x"],[
6 AS_IF([test -f /usr/bin/gcc-4.2],
7 [
8 CPP="/usr/bin/gcc-4.2 -E"
9 CC=/usr/bin/gcc-4.2
10 CXX=/usr/bin/g++-4.2
11 ])
12 ])
13 ])
14 ])
15
16 AC_DEFUN([CHECK_GCC_VERSION],[
17 AC_REQUIRE([FORCE_MAC_GCC42])
18 AC_CACHE_CHECK([if GCC is recent enough], [ac_cv_gcc_recent],
19 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
20 #if !defined(__GNUC__) || (__GNUC__ < 4) || ((__GNUC__ >= 4) && (__GNUC_MINOR__ < 1))
21 # error GCC is Too Old!
22 #endif
23 ]])],
24 [ac_cv_gcc_recent=yes],
25 [ac_cv_gcc_recent=no])])
26 AS_IF([test "$ac_cv_gcc_recent" = "no" -a "$host_vendor" = "apple"],
27 AC_MSG_ERROR([Your version of GCC is too old. At least version 4.2 is required on OSX. You may need to install a version of XCode >= 3.1.2]))
28 AS_IF([test "$drizzle_cv_gcc_recent" = "no"],
29 AC_MSG_ERROR([Your version of GCC is too old. At least version 4.1 is required]))
30 ])