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