Chris@10: dnl @synopsis AX_GCC_VERSION(MAJOR, MINOR, PATCHLEVEL, [ACTION-SUCCESS], [ACTION-FAILURE]) Chris@10: dnl @summary check wither gcc is at least version MAJOR.MINOR.PATCHLEVEL Chris@10: dnl @category InstalledPackages Chris@10: dnl Chris@10: dnl Check whether we are using gcc and, if so, whether its version Chris@10: dnl is at least MAJOR.MINOR.PATCHLEVEL Chris@10: dnl Chris@10: dnl ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on Chris@10: dnl success/failure. Chris@10: dnl Chris@10: dnl @version 2005-05-30 Chris@10: dnl @license GPLWithACException Chris@10: dnl @author Steven G. Johnson and Matteo Frigo. Chris@10: AC_DEFUN([AX_GCC_VERSION], Chris@10: [ Chris@10: AC_REQUIRE([AC_PROG_CC]) Chris@10: AC_CACHE_CHECK(whether we are using gcc $1.$2.$3 or later, ax_cv_gcc_$1_$2_$3, Chris@10: [ Chris@10: ax_cv_gcc_$1_$2_$3=no Chris@10: if test "$GCC" = "yes"; then Chris@10: dnl The semicolon after "yes" below is to pacify NeXT's syntax-checking cpp. Chris@10: AC_EGREP_CPP(yes, [ Chris@10: #ifdef __GNUC__ Chris@10: # if (__GNUC__ > $1) || (__GNUC__ == $1 && __GNUC_MINOR__ > $2) \ Chris@10: || (__GNUC__ == $1 && __GNUC_MINOR__ == $2 && __GNUC_PATCHLEVEL__ >= $3) Chris@10: yes; Chris@10: # endif Chris@10: #endif Chris@10: ], [ax_cv_gcc_$1_$2_$3=yes]) Chris@10: fi Chris@10: ]) Chris@10: if test "$ax_cv_gcc_$1_$2_$3" = yes; then Chris@10: m4_default([$4], :) Chris@10: else Chris@10: m4_default([$5], :) Chris@10: fi Chris@10: ]) Chris@10: