Discussion:
How can we run all tests using C++ specified compiler?
Jeffrey Walton
2018-08-04 22:17:40 UTC
Permalink
I'm testing different configurations of a C++ library. When I test on
AIX with XLC I am catching an error:

-bash-4.4$ OBJECT_MODE=64 CXX=xlC ./configure
checking for a BSD-compatible install... ./install-sh -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/home/noloader/cryptopp':
configure: error: C compiler cannot create executables
See `config.log' for more details
...

The problem is using the wrong compiler:

configure:3381: gcc conftest.c >&5
Assembler:
/tmp/cczCkD4X.s: line 9: Only .llong should be used for relocatable expressions.
configure:3385: $? = 1
configure:3423: result: no

Our configure.ac has AC_PROG_CXX after the various init's, and lacks
AC_PROG_CC. We don't do anything with the C compiler because we are a
C++ library.

How do we tell Autoconf to use the specified C++ compiler for all tests?

Thanks in advance.
Václav Haisman
2018-08-05 06:33:01 UTC
Permalink
Post by Jeffrey Walton
I'm testing different configurations of a C++ library. When I test on
-bash-4.4$ OBJECT_MODE=64 CXX=xlC ./configure
checking for a BSD-compatible install... ./install-sh -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: C compiler cannot create executables
See `config.log' for more details
...
configure:3381: gcc conftest.c >&5
/tmp/cczCkD4X.s: line 9: Only .llong should be used for relocatable expressions.
configure:3385: $? = 1
configure:3423: result: no
Our configure.ac has AC_PROG_CXX after the various init's, and lacks
AC_PROG_CC. We don't do anything with the C compiler because we are a
C++ library.
How do we tell Autoconf to use the specified C++ compiler for all tests?
Your Autoconf test needs to be wrapped around with AC_LANG_PUSH([C++]) and
AC_LANG_POP([C++]).
--
VH
Bob Friesenhahn
2018-08-05 13:06:15 UTC
Permalink
Post by Jeffrey Walton
Our configure.ac has AC_PROG_CXX after the various init's, and lacks
AC_PROG_CC. We don't do anything with the C compiler because we are a
C++ library.
How do we tell Autoconf to use the specified C++ compiler for all tests?
This might not work properly since Autoconf produces C code
for many of its standard tests and the C code might not compile/link
cleanly with a C++ compiler. While C++ encompasses C, it is also
stricter than ANSI C.

You would need to define CC to be the C++ compiler and hope for the
best.

Bob
--
Bob Friesenhahn
***@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
Loading...