I have a big autotools project, and one part of codes in the subdirectory use g++-4.9 to compile, others use g++8.2.
My question is how to compile the whole project with different version of g++.
I've see some related question is to change a different g++ compiler, and general answers are to set environment variables or make options.
However, my issue is to compile with both g++8.2 and g++4.9 in same time.
I expect there are some solutions to set Makefile.am like :
noinst_PROGRAMS=foo bar
foo_CXX_COMPILER=/usr/bin/g++-4.9
bar_CXX_COMPILER=/usr/bin/g++-8.2
EDIT:
More Details that I've tried :
- The third-party library in the sub-project will show a lot of warnings "auto_ptris deprecated" when compiling withg++-4.9 -std=c++11, but without any error and executing well.
- It compiled well with no error and warning with g++-4.9 -std=c++98.
- It yells many errors "undefined reference to ..." when I compile with g++-8.2, even if I add the flag-std=c++98.
I guess this is because g++-8.2 compiler cannot recognize auto_ptr usage! 
I prefer to use only one compiler which makes the problem simply! But, if the case cannot be allowed to use only one, I would want to know how to set up Makefile.am with different two compilers, or any best way to solve this compilation problem !
 
     
     
    