aboutsummaryrefslogtreecommitdiff
path: root/config/gcc-version.m4
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2004-12-02 11:09:36 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2004-12-02 11:09:36 +0000
commitafefada0ebb12c3da64ba876049bcb931788099d (patch)
tree2e6c306cec88ced5e417e9f9bff97587308516f6 /config/gcc-version.m4
parent9ebd302d5e8eea40669bf9ffcda8fb428582bb7e (diff)
downloadgdb-afefada0ebb12c3da64ba876049bcb931788099d.zip
gdb-afefada0ebb12c3da64ba876049bcb931788099d.tar.gz
gdb-afefada0ebb12c3da64ba876049bcb931788099d.tar.bz2
Introduce and use config/gcc-version.m4.
Diffstat (limited to 'config/gcc-version.m4')
-rw-r--r--config/gcc-version.m428
1 files changed, 28 insertions, 0 deletions
diff --git a/config/gcc-version.m4 b/config/gcc-version.m4
new file mode 100644
index 0000000..8de74bb
--- /dev/null
+++ b/config/gcc-version.m4
@@ -0,0 +1,28 @@
+dnl Usage: TL_AC_GCC_VERSION(TOPSRCDIR)
+dnl
+dnl Set up the variables:
+dnl
+dnl gcc_version_trigger: pathname of gcc's version.c, if available
+dnl gcc_version_full: full gcc version string
+dnl gcc_version: the first "word" in $gcc_version_full
+dnl
+dnl TOPSRCDIR is the top-level source directory.
+AC_DEFUN([TL_AC_GCC_VERSION],
+[
+changequote(,)dnl
+if test "${with_gcc_version_trigger+set}" = set; then
+ gcc_version_trigger=$with_gcc_version_trigger
+else
+ gcc_version_trigger=$1/gcc/version.c
+fi
+if test -f "${gcc_version_trigger}"; then
+ gcc_version_full=`grep version_string "${gcc_version_trigger}" | sed -e 's/.*"\([^"]*\)".*/\1/'`
+else
+ gcc_version_full=`$CC -v 2>&1 | sed -n 's/^gcc version //p'`
+fi
+gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
+changequote([,])dnl
+AC_SUBST(gcc_version_trigger)
+AC_SUBST(gcc_version_full)
+AC_SUBST(gcc_version)
+])dnl