gcc version number from autotools

Ian Lance Taylor iant@google.com
Wed Dec 20 17:11:00 GMT 2006


Bob Rossi <bob_rossi@cox.net> writes:

> What's the best way to get the gcc version number from an autotools
> project? I could start gcc and parse the output. Could I write a small
> program that checks some #define that has gcc's version number?

You can check __GNUC__, __GNUC_MINOR__, and __GNUC_PATCHLEVEL__.  Is
that the sort of thing you are looking for?

> If so, how far back does that work for?

__GNUC__ and __GNUC_MINOR__ have been around for a long time,
certainly since before gcc 3.0 (and, although I didn't check, probably
before gcc 2.0).  I believe that __GNUC_PATCHLEVEL__ was added in gcc
3.0.

Ian



More information about the Gcc-help mailing list