pandora_ensure_gcc_version.m4 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. dnl If the user is on a Mac and didn't ask for a specific compiler
  6. dnl You're gonna get 4.2.
  7. AC_DEFUN([PANDORA_MAC_GCC42],
  8. [AS_IF([test "$GCC" = "yes"],[
  9. AS_IF([test "$host_vendor" = "apple" -a "x${ac_cv_env_CC_set}" = "x"],[
  10. host_os_version=`echo ${host_os} | perl -ple 's/^\D+//g;s,\..*,,'`
  11. AS_IF([test "$host_os_version" -lt 10],[
  12. AS_IF([test -f /usr/bin/gcc-4.2],
  13. [
  14. CPP="/usr/bin/gcc-4.2 -E"
  15. CC=/usr/bin/gcc-4.2
  16. CXX=/usr/bin/g++-4.2
  17. ])
  18. ])
  19. ])
  20. ])
  21. ])
  22. dnl
  23. AC_DEFUN([PANDORA_ENSURE_GCC_VERSION],[
  24. AC_REQUIRE([PANDORA_MAC_GCC42])
  25. AC_CACHE_CHECK([if GCC is recent enough], [ac_cv_gcc_recent],
  26. [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  27. #if !defined(__GNUC__) || (__GNUC__ < 4) || ((__GNUC__ >= 4) && (__GNUC_MINOR__ < 1))
  28. # error GCC is Too Old!
  29. #endif
  30. ]])],
  31. [ac_cv_gcc_recent=yes],
  32. [ac_cv_gcc_recent=no])])
  33. AS_IF([test "$ac_cv_gcc_recent" = "no" -a "$host_vendor" = "apple"],
  34. 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]))
  35. AS_IF([test "$ac_cv_gcc_recent" = "no"],
  36. AC_MSG_ERROR([Your version of GCC is too old. At least version 4.1 is required]))
  37. ])