autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Detecting compiler version number


From: Paul Eggert
Subject: Re: Detecting compiler version number
Date: Fri, 8 Feb 2002 12:50:05 -0800 (PST)

> From: "Dr. David Kirkby" <address@hidden>
> Date: Fri, 08 Feb 2002 19:28:57 +0000

> Is there a simple way of determining the version number of the
> compiler used to compile an application? I have written a benchmark,
> which for consistency of results should ideally always be compiled
> with the same compiler (gcc) and version (2.95.3).

If it's that simple, you can just use something like this:

AC_PROG_CC
if [ $GCC = yes ]; then
  gcc_version=`$CC --version`
else
  gcc_version=
fi
test "x$gcc_version" = x2.95.3 ||
  AC_MSG_WARN([For accurate results please use gcc 2.95.3])


> I'd also like the software to know of what it was compiled with, so
> that the datafile will indicate it was compiled with the wrong
> compiler.

Something like this, perhaps?

AC_DEFINE_UNQUOTED([GCC_VERSION], "$gcc_version",
                   [GCC version number, as a string; empty if not GCC])



reply via email to

[Prev in Thread] Current Thread [Next in Thread]