Merge Monty
[m6w6/libmemcached] / m4 / pandora_ensure_gcc_version.m4
1 dnl Copyright (C) 2009 Sun Microsystems
2 dnl This file is free software; Sun Microsystems
3 dnl gives unlimited permission to copy and/or distribute it,
4 dnl with or without modifications, as long as this notice is preserved.
5
6 dnl If the user is on a Mac and didn't ask for a specific compiler
7 dnl You're gonna get 4.2.
8 AC_DEFUN([PANDORA_MAC_GCC42],
9 [AS_IF([test "$GCC" = "yes"],[
10 AS_IF([test "$host_vendor" = "apple" -a "x${ac_cv_env_CC_set}" = "x"],[
11 AS_IF([test -f /usr/bin/gcc-4.2],
12 [
13 CPP="/usr/bin/gcc-4.2 -E"
14 CC=/usr/bin/gcc-4.2
15 CXX=/usr/bin/g++-4.2
16 ])
17 ])
18 ])
19 ])
20
21 dnl
22 AC_DEFUN([PANDORA_ENSURE_GCC_VERSION],[
23 AC_REQUIRE([PANDORA_MAC_GCC42])
24 AC_CACHE_CHECK([if GCC is recent enough], [ac_cv_gcc_recent],
25 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
26 #if !defined(__GNUC__) || (__GNUC__ < 4) || ((__GNUC__ >= 4) && (__GNUC_MINOR__ < 1))
27 # error GCC is Too Old!
28 #endif
29 ]])],
30 [ac_cv_gcc_recent=yes],
31 [ac_cv_gcc_recent=no])])
32 AS_IF([test "$ac_cv_gcc_recent" = "no" -a "$host_vendor" = "apple"],
33 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]))
34 AS_IF([test "$ac_cv_gcc_recent" = "no"],
35 AC_MSG_ERROR([Your version of GCC is too old. At least version 4.1 is required]))
36 ])