[Top][All Lists]

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

How to test compiler and create messaged based on version of gcc?

From: Dr. David Kirkby
Subject: How to test compiler and create messaged based on version of gcc?
Date: Thu, 06 Aug 2009 00:50:02 +0100
User-agent: Thunderbird (X11/20090218)

I'm working on the Sage open source maths project

Sage is only supported if gcc is used, but the hope it to support the Sun compiler when running Solaris.

The following are known about the sage build process.

* Sage has NEVER been successfully built with any compiler other than gcc.
* gcc < 3.4.0 will not build Sage, as it is too old.
* gcc 4.0.0 does not build Sage - it is too buggy.
* gcc 4.0.1 or later should we hope work.

I wish to write a file in which

1) I determine if the compiler (either found because CC is defined, or found by the configure script), is gcc or not.

If the compiler is not gcc, I wish to continue, but issue a warning that only the use of gcc is supported

2) IF the compiler is gcc, then issue appropriate warnings being buggy (4.0.0) or too old (<3.4.0). For gcc >= 4.0.1, I just want to output a message saying the compiler is ok.

I found a macro to determine the gcc version.;a=blob_plain;f=m4/ax_gcc_version.m4

Can anyone show my how I can determine if the compiler is gcc in the configure script, so that the configure script makes checks on the version if it is gcc?

I'm looking for something like this, which is a mix of C/autoconf. Sorry, I don't know autoconf much, as I am just trying to learn to use it.

if (compiler == gcc) {
  if (versions < 3.4.0)
AC_MSG_ERROR([ Your compiler is too old. Use at least gcc 3.4.0, but not 4.0.0)]
  else if (version == 4.0.0)
     AC_MSG_ERROR([gcc 4.0.0 is too buggy. Please use another compiler)]
} else
  AC_MSG_WARN([Sage has only ever been built with the GNU C compiler.])

reply via email to

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