Commit 64568a94a0cde7ddd5313e43d7e3029dfc67b44a
1 parent
c4413330
Add macro to determine the gcc version.
Showing
1 changed file
with
64 additions
and
0 deletions
m4/ax_gcc_version.m4
0 → 100644
| 1 | +# =========================================================================== | |
| 2 | +# http://www.gnu.org/software/autoconf-archive/ax_gcc_version.html | |
| 3 | +# =========================================================================== | |
| 4 | +# | |
| 5 | +# SYNOPSIS | |
| 6 | +# | |
| 7 | +# AX_GCC_VERSION | |
| 8 | +# | |
| 9 | +# DESCRIPTION | |
| 10 | +# | |
| 11 | +# This macro retrieves the gcc version and returns it in the GCC_VERSION | |
| 12 | +# variable if available, an empty string otherwise. | |
| 13 | +# | |
| 14 | +# LICENSE | |
| 15 | +# | |
| 16 | +# Copyright (c) 2009 Francesco Salvestrini <salvestrini@users.sourceforge.net> | |
| 17 | +# | |
| 18 | +# This program is free software; you can redistribute it and/or modify it | |
| 19 | +# under the terms of the GNU General Public License as published by the | |
| 20 | +# Free Software Foundation; either version 2 of the License, or (at your | |
| 21 | +# option) any later version. | |
| 22 | +# | |
| 23 | +# This program is distributed in the hope that it will be useful, but | |
| 24 | +# WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 25 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | |
| 26 | +# Public License for more details. | |
| 27 | +# | |
| 28 | +# You should have received a copy of the GNU General Public License along | |
| 29 | +# with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 30 | +# | |
| 31 | +# As a special exception, the respective Autoconf Macro's copyright owner | |
| 32 | +# gives unlimited permission to copy, distribute and modify the configure | |
| 33 | +# scripts that are the output of Autoconf when processing the Macro. You | |
| 34 | +# need not follow the terms of the GNU General Public License when using | |
| 35 | +# or distributing such scripts, even though portions of the text of the | |
| 36 | +# Macro appear in them. The GNU General Public License (GPL) does govern | |
| 37 | +# all other use of the material that constitutes the Autoconf Macro. | |
| 38 | +# | |
| 39 | +# This special exception to the GPL applies to versions of the Autoconf | |
| 40 | +# Macro released by the Autoconf Archive. When you make and distribute a | |
| 41 | +# modified version of the Autoconf Macro, you may extend this special | |
| 42 | +# exception to the GPL to apply to your modified version as well. | |
| 43 | + | |
| 44 | +#serial 8 | |
| 45 | + | |
| 46 | +AC_DEFUN([AX_GCC_VERSION], [ | |
| 47 | + GCC_VERSION="" | |
| 48 | + AX_CHECK_COMPILE_FLAG([-dumpversion], | |
| 49 | + [ax_gcc_version_option=yes], | |
| 50 | + [ax_gcc_version_option=no]) | |
| 51 | + | |
| 52 | + AS_IF([test "x$GCC" = "xyes"],[ | |
| 53 | + AS_IF([test "x$ax_gcc_version_option" != "xno"],[ | |
| 54 | + AC_CACHE_CHECK([gcc version],[ax_cv_gcc_version],[ | |
| 55 | + ax_cv_gcc_version="`$CC -dumpversion`" | |
| 56 | + AS_IF([test "x$ax_cv_gcc_version" = "x"],[ | |
| 57 | + ax_cv_gcc_version="" | |
| 58 | + ]) | |
| 59 | + ]) | |
| 60 | + GCC_VERSION=$ax_cv_gcc_version | |
| 61 | + ]) | |
| 62 | + ]) | |
| 63 | + AC_SUBST([GCC_VERSION]) | |
| 64 | +]) | ... | ... |