Andy May
2018-06-01 08:59:19 UTC
Hi,
We have in configure.ac:
AX_CXX_COMPILE_STDCXX([11])
and when running configure on a Cray XC50 system with cray compiler we get
in config.log:
configure:3678: checking whether /opt/cray/pe/craype/2.5.14/bin/CC supports
C++11 features with +std=c++11
configure:3974: /opt/cray/pe/craype/2.5.14/bin/CC +std=c++11 -c -O3
conftest.cpp >&5
configure:3974: $? = 0
configure:3983: result: yes
i.e. it detects +std=c++11 as the required flag which is not the case, it's
in fact the next in the list involving -h:
for switch in -std=c++${alternative} +std=c++${alternative} "-h
std=c++${alternative}"; do
It appears that +s* options just get ignored and are assumed to be for the
linker, and in fact the compiler can pass the test then effectively with no
extra flags (it fails with -std=c++11 because -s* is not recognised). Of
course later when one tries to link with the modified CXX='CC +std=c++11'
there is trouble because the linker does not understand this.
I'm not sure how you handle the case of a flag which is silently accepted
by a compiler, and then causes trouble to the linker.
Is there a reason the macro does not first test with no extra flags? In
this case no flags are needed for C++11 support and it wouldn't then try
these flags. It would also provide a route for the user to specify flags
unknown to the macro via CXX='CC -new-flag' on the command line.
Many thanks,
Andy
We have in configure.ac:
AX_CXX_COMPILE_STDCXX([11])
and when running configure on a Cray XC50 system with cray compiler we get
in config.log:
configure:3678: checking whether /opt/cray/pe/craype/2.5.14/bin/CC supports
C++11 features with +std=c++11
configure:3974: /opt/cray/pe/craype/2.5.14/bin/CC +std=c++11 -c -O3
conftest.cpp >&5
configure:3974: $? = 0
configure:3983: result: yes
i.e. it detects +std=c++11 as the required flag which is not the case, it's
in fact the next in the list involving -h:
for switch in -std=c++${alternative} +std=c++${alternative} "-h
std=c++${alternative}"; do
It appears that +s* options just get ignored and are assumed to be for the
linker, and in fact the compiler can pass the test then effectively with no
extra flags (it fails with -std=c++11 because -s* is not recognised). Of
course later when one tries to link with the modified CXX='CC +std=c++11'
there is trouble because the linker does not understand this.
I'm not sure how you handle the case of a flag which is silently accepted
by a compiler, and then causes trouble to the linker.
Is there a reason the macro does not first test with no extra flags? In
this case no flags are needed for C++11 support and it wouldn't then try
these flags. It would also provide a route for the user to specify flags
unknown to the macro via CXX='CC -new-flag' on the command line.
Many thanks,
Andy