On 04/13/2011 03:49 PM, Philip Prindeville wrote: > It is sometimes useful to be able to detect the compiler version (as in the > case of GCC 4.2 doing some fairly aggressive optimization that breaks fragile > code).
Thanks for the report. > > How about something like: > > AC_GCC_VERSION(VER, MATCHING-VERSION, [ NON-MATCHING-VERSION ]) Unfortunately, I don't think that a macro like this belongs in autoconf. Why not instead follow the autoconf philosophy of feature tests rather than version tests, and specifically compile a problematic program that gets miscompiled by broken compilers and changes OPTIMIZE in that case. For all you know, gcc 4.2 on one machine may have some vendor-specific patches that don't cause the same breakage that you are seeing with out-of-the-box gcc 4.2. Or, fix your code to be standards-compliant so that undefined code doesn't trip up a valid optimization; and if gcc is still miscompiling your program in your eyes, then report that as a bug to the gcc folks (who will help you either see where your program is non-compliant or will fix gcc to avoid the miscompilation). -- Eric Blake ebl...@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature