Since you are using linux and gcc already, it might be nice to start using GNU autotools. Solving problems with portability of this type is one of the main goals of auto tuning.
In autotools, a file called config.h will be created with the set #defines, which indicates the presence or absence of certain functions in your environment. (In this case, AC_CXX_EXCEPTIONS
most likely you want to check.) Then you can use the #ifdef tags to make the preprocessor exclude code that you wrote specifically for compatibility with the old compiler whenever the configure script sees that they are not necessary.
The first time you use autotools, this is a slightly tough learning curve, but it is a one-time cost. They will make every future project that you embark on, much easier to set up. You will also want to check if your target machine supports autotools, and if so, which version of these tools is supported.
01d55 source share