Discussion:
AC_COMPILE_ELSEIF and AC_LINK_ELSEIF misdetections
Jeffrey Walton
2018-07-26 15:47:33 UTC
Permalink
Hi Everyone,

In case this can make it into the upcoming release...

AC_COMPILE_ELSEIF and AC_LINK_ELSEIF often misdetects which results in
bad configurations and broken compiles on AIX with XL C/C++ and
Solaris with SunCC. We found we can't use the macros.

We use the following string to detect bad results from running the
compiler, linker and assembler:

BAD_RESULT="fatal|error|unknown|unrecognized|illegal|not found|not
exist|cannot find"

For example, "illegal" is present because the SunCC compiler emits
"illegal option" for, say, -xarch=sha. At the moment Sun Studio 12.6
and SunCC does not provide the GCC equivalent to -msha. However an
AC_COMPILE_ELSEIF reports success when the illegal option is present.

Jeff
Zack Weinberg
2018-07-26 15:55:15 UTC
Permalink
Post by Jeffrey Walton
AC_COMPILE_ELSEIF and AC_LINK_ELSEIF often misdetects which results in
bad configurations and broken compiles on AIX with XL C/C++ and
Solaris with SunCC. We found we can't use the macros.
Could you please supply a short, self-contained configure.ac that
shows the problem? I don't think I understand the issue from your
description.

zw
Jeffrey Walton
2018-07-26 16:52:12 UTC
Permalink
Post by Zack Weinberg
Post by Jeffrey Walton
AC_COMPILE_ELSEIF and AC_LINK_ELSEIF often misdetects which results in
bad configurations and broken compiles on AIX with XL C/C++ and
Solaris with SunCC. We found we can't use the macros.
Could you please supply a short, self-contained configure.ac that
shows the problem? I don't think I understand the issue from your
description.
Yes. I can also supply SSH access to a Solaris 11.3 machine with SunCC
installed. I need authorized_keys file.

You can get access to AIX and the IBM XL C/C++ compiler on the GCC
compile farm at https://gcc.gnu.org/wiki/CompileFarm .

I did not state it, but the highest SunCC -xarch at the moment is
-xarch=aes. We are waiting for Sun to make -xarch=sha available. When
GCC -msha or SunCC -xarch=sha is available we enable SHA code paths
like https://github.com/weidai11/cryptopp/blob/master/sha-simd.cpp#L200
, which results in a failed compile on Soalris x86.

Here's what SunCC and illegal -xarch options looks like under Autotools:

$ autoreconf -f -i
...

$ CXX=/opt/developerstudio12.6/bin/CC ./configure
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... no
checking whether /opt/developerstudio12.6/bin/CC accepts -g... yes
checking for -xarch=sha... checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
yes

********************

And SunCC:

$ /opt/developerstudio12.6/bin/CC test.cxx -xarch=sha -o test.exe
CC: Warning: illegal use of -xarch option, illegal value ignored: sha
$ echo $?
0

********************

$ cat configure.ac
AC_INIT([Test], [1.0])
AC_PROG_CXX

SAVED_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="-xarch=sha"
AC_MSG_CHECKING([for -xarch=sha])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])]
)
CXXFLAGS="$SAVED_CXXFLAGS"

********************

And the test driver:

$ cat test.cxx
#include <xmmintrin.h>
int main (int argc, char* argv)
{
return 0;
}
Jeffrey Walton
2018-07-26 17:17:44 UTC
Permalink
Post by Zack Weinberg
Post by Jeffrey Walton
AC_COMPILE_ELSEIF and AC_LINK_ELSEIF often misdetects which results in
bad configurations and broken compiles on AIX with XL C/C++ and
Solaris with SunCC. We found we can't use the macros.
Could you please supply a short, self-contained configure.ac that
shows the problem? I don't think I understand the issue from your
description.
Here's the AIX equivalent using IBM XL C/C++. I'm working from GCC119
on the compile farm (gcc119.fsffrance.org).

$ cat configure.ac
AC_INIT([Test], [1.0])
AC_PROG_CXX

SAVED_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="-qrtti-nonsense"
AC_MSG_CHECKING([for -qrtti-nonsense])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])]
)
CXXFLAGS="$SAVED_CXXFLAGS"

And the result:

$ CXX=xlC ./configure
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... no
checking whether xlC accepts -g... yes
checking for -qrtti-nonsense... checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
yes

And an XLC test program:

$ cat test.cxx
int main (int argc, char* argv)
{
return 0;
}

And the result:

$ xlC -qrtti-nonsense test.cxx -o test.exe
1540-5200 (W) The option "rtti-nonsense" is not supported.

$ echo $?
0

Loading...