Remove dead pandora files.
[awesomized/libmemcached] / m4 / pandora_ensure_gcc_version.m4
1 dnl Copyright (C) 2009 Sun Microsystems, Inc.
2 dnl This file is free software; Sun Microsystems, Inc.
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 AC_DEFUN([_PANDORA_TRY_GCC],[
7 pushdef([Name],[translit([$1],[./-], [___])])
8 pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
9 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
10 AC_CHECK_PROGS([CC]NAME,[gcc$1])
11 AC_CHECK_PROGS([CXX]NAME,[g++$1])
12 AS_IF([test "x${CC]NAME[}" != "x" -a "x${ac_cv_env_CC_set}" = "x"],
13 [CC="${CC]NAME[}"])
14 AS_IF([test "x${CXX]NAME[}" != "x" -a "x${ac_cv_env_CCX_set}" = "x"],
15 [CXX="${CXX]NAME[}"])
16 AS_IF([test "x${CC]NAME[}" != "x" -a "x${ac_cv_env_CPP_set}" = "x"],
17 [CPP="${CC]NAME[} -E"])
18 ])
19
20 dnl If the user is on a Mac and didn't ask for a specific compiler
21 dnl You're gonna get 4.2.
22 AC_DEFUN([PANDORA_MAC_GCC42],
23 [AS_IF([test "$GCC" = "yes"],[
24 AS_IF([test "$host_vendor" = "apple" -a "x${ac_cv_env_CC_set}" = "x"],[
25 host_os_version=`echo ${host_os} | perl -ple 's/^\D+//g;s,\..*,,'`
26 AS_IF([test "$host_os_version" -lt 10],[
27 _PANDORA_TRY_GCC([-4.2])
28 ])
29 ])
30 ])
31 ])
32
33 dnl If the user is on CentOS or RHEL and didn't ask for a specific compiler
34 dnl You're gonna get 4.4 (forward compatible with 4.5)
35 AC_DEFUN([PANDORA_RH_GCC44],
36 [AS_IF([test "$GCC" = "yes"],[
37 AS_IF([test "x${ac_cv_env_CC_set}" = "x"],[
38 _PANDORA_TRY_GCC([44])
39 _PANDORA_TRY_GCC([45])
40 ])
41 ])
42 ])
43
44 dnl
45 AC_DEFUN([PANDORA_ENSURE_GCC_VERSION],[
46 AC_REQUIRE([PANDORA_MAC_GCC42])
47 AC_REQUIRE([PANDORA_RH_GCC44])
48 AS_IF([test "$GCC" = "yes"],[
49 AC_CACHE_CHECK([if GCC is recent enough], [ac_cv_gcc_recent],
50 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
51 #if !defined(__GNUC__) || (__GNUC__ < 4) || ((__GNUC__ >= 4) && (__GNUC_MINOR__ < 2))
52 # error GCC is Too Old!
53 #endif
54 ]])],
55 [ac_cv_gcc_recent=yes],
56 [ac_cv_gcc_recent=no])])
57 AS_IF([test "$ac_cv_gcc_recent" = "no" -a "$host_vendor" = "apple"],
58 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]))
59 AS_IF([test "$ac_cv_gcc_recent" = "no"],
60 AC_MSG_ERROR([Your version of GCC is too old. At least version 4.2 is required. On RHEL/CentOS systems this is found in the gcc44 and gcc44-c++ packages.]))
61 ])
62 ])