From: Monty Taylor Date: Sat, 20 Jun 2009 17:17:52 +0000 (-0700) Subject: Fixed C99 checks for older OSes. X-Git-Tag: 0.31~14^2~6 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=a563bcd2aa6dd90c6540a9ce3784a86e2f562956;p=m6w6%2Flibmemcached Fixed C99 checks for older OSes. --- diff --git a/configure.ac b/configure.ac index 86700a5e..3e54756e 100644 --- a/configure.ac +++ b/configure.ac @@ -53,8 +53,6 @@ else building_from_bzr=no fi -AC_PROG_CC -AC_PROG_CC_C99 AC_PROG_CXX ACX_USE_SYSTEM_EXTENSIONS @@ -62,11 +60,14 @@ ACX_USE_SYSTEM_EXTENSIONS AC_PROG_CPP AM_PROG_CC_C_O +FORCE_MAC_GCC42 +dnl Once we can use a modern autoconf, we can use this +dnl AC_PROG_CC_C99 + AC_C_BIGENDIAN AC_C_CONST AC_HEADER_TIME AC_TYPE_SIZE_T -AC_TYPE_SSIZE_T AC_FUNC_MALLOC AC_FUNC_REALLOC @@ -105,6 +106,11 @@ AS_IF([test "$ac_cv_prog_cc_c99" != "no"], # First check for gcc and g++ if test "$GCC" = "yes" then + + dnl Once we can use a modern autoconf, we can replace the std=gnu99 here + dnl with using AC_CC_STD_C99 above + CC="${CC} -std=gnu99" + CFLAGS="-ggdb3 ${CFLAGS}" CXXFLAGS="-ggdb3 ${CXXFLAGS}" @@ -116,6 +122,10 @@ then fi if test "x$SUNCC" = "xyes" then + dnl Once we can use a modern autoconf, we can replace the -xc99=all here + dnl with using AC_CC_STD_C99 above + CC="${CC} -xc99=all" + CFLAGS="-g -mt ${CFLAGS}" CXXFLAGS="-xlang=c99 -g -mt -compat=5 -library=stlport4 -template=no%extdef ${CXXFLAGS}" diff --git a/m4/check_gcc_version.m4 b/m4/check_gcc_version.m4 new file mode 100644 index 00000000..e38e3000 --- /dev/null +++ b/m4/check_gcc_version.m4 @@ -0,0 +1,30 @@ +AC_DEFUN([FORCE_MAC_GCC42], + [AS_IF([test "$GCC" = "yes"],[ + dnl If you're on a Mac, and you didn't ask for a specific compiler + dnl You're gonna get 4.2. + AS_IF([test "$host_vendor" = "apple" -a "x${ac_cv_env_CC_set}" = "x"],[ + AS_IF([test -f /usr/bin/gcc-4.2], + [ + CPP="/usr/bin/gcc-4.2 -E" + CC=/usr/bin/gcc-4.2 + CXX=/usr/bin/g++-4.2 + ]) + ]) + ]) +]) + +AC_DEFUN([CHECK_GCC_VERSION],[ + AC_REQUIRE([FORCE_MAC_GCC42]) + AC_CACHE_CHECK([if GCC is recent enough], [ac_cv_gcc_recent], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#if !defined(__GNUC__) || (__GNUC__ < 4) || ((__GNUC__ >= 4) && (__GNUC_MINOR__ < 1)) +# error GCC is Too Old! +#endif + ]])], + [ac_cv_gcc_recent=yes], + [ac_cv_gcc_recent=no])]) + AS_IF([test "$ac_cv_gcc_recent" = "no" -a "$host_vendor" = "apple"], + 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])) + AS_IF([test "$drizzle_cv_gcc_recent" = "no"], + AC_MSG_ERROR([Your version of GCC is too old. At least version 4.1 is required])) +])