merge from gcc
[binutils.git] / config / gcc-version.m4
blob8de74bb2a6321e90e6451bbce180c512e7059dc6
1 dnl Usage: TL_AC_GCC_VERSION(TOPSRCDIR)
2 dnl
3 dnl Set up the variables:
4 dnl
5 dnl     gcc_version_trigger: pathname of gcc's version.c, if available
6 dnl     gcc_version_full: full gcc version string
7 dnl     gcc_version: the first "word" in $gcc_version_full
8 dnl
9 dnl TOPSRCDIR is the top-level source directory.
10 AC_DEFUN([TL_AC_GCC_VERSION],
12 changequote(,)dnl
13 if test "${with_gcc_version_trigger+set}" = set; then
14   gcc_version_trigger=$with_gcc_version_trigger
15 else
16   gcc_version_trigger=$1/gcc/version.c
18 if test -f "${gcc_version_trigger}"; then
19   gcc_version_full=`grep version_string "${gcc_version_trigger}" | sed -e 's/.*"\([^"]*\)".*/\1/'`
20 else
21   gcc_version_full=`$CC -v 2>&1 | sed -n 's/^gcc version //p'`
23 gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
24 changequote([,])dnl
25 AC_SUBST(gcc_version_trigger)
26 AC_SUBST(gcc_version_full)
27 AC_SUBST(gcc_version)
28 ])dnl