[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Some CXX tag tests only work with C

From: Bob Friesenhahn
Subject: Some CXX tag tests only work with C
Date: Mon, 3 Feb 2003 10:16:26 -0600 (CST)

This is more information regarding the bug reported yesterday.  I
thought that the user was perhaps mis-using libtool, but in fact, it
appears that some CXX tag tests are run with CC set to CXX, but they
will only pass if CC is set to the C compiler.  C++ compilers are
apparently not supposed to allow a recursive call to main().

I am also sending this report to the Autoconf bugs list because it
seems to me that when a request is made to test for 'main' that
Autoconf should recognize that special case, and should output a
different test program.

> Did you force configure to use the CC (C++ compiler) by setting some
> environment variables? It seems that normally configure uses a plain
> C compiler for these tests and gets confused if they are executed
> using a C++ compiler. The compiler used for these tests is
> independent on which compiler is used later on to compile the real
> program (pstoedit).

This is incorrect. In configure, line 17392-5, the compiler used for the
tests is clearly set to the C++ compiler:
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS 
conftest.$ac_ext $LIBS >&5'

I configured as follows (on Sun with Forte 7):
env CC=/dpi/forte7/bin/cc CXX='/dpi/forte7/bin/CC -norunpath' CXXFLAGS='-O2 
-I/dpi/include' LDFLAGS=-L/dpi/lib ./configure --prefix=/dpi --datadir=/dpi/lib 

Configure calls the generated test file "conftest.cc", obviously a C++ source.
The results from config.log are:
configure:17680: checking for main in -ldl
configure:17705: /dpi/forte7/bin/CC -norunpath -o conftest -O2 -I/dpi/include  
-L/dpi/lib conftest.cc -ldl   >&5
"configure", line 17716: Error: Cannot have a recursive call of main().
1 Error(s) detected.
configure:17708: $? = 1
configure: failed program was:
| #line 17687 "configure"
| /* confdefs.h.  */
| #define PACKAGE_NAME "pstoedit"
| #define PACKAGE_TARNAME "pstoedit"
| #define PACKAGE_VERSION "3.33"
| #define PACKAGE_STRING "pstoedit 3.33"
| #define PACKAGE_BUGREPORT "address@hidden"
| #define PACKAGE "pstoedit"
| #define VERSION "3.33"
| #ifdef __cplusplus
| #include <stdlib.h>
| #endif
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define HAVE_DIRENT_H 1
| /* end confdefs.h.  */
| int
| main ()
| {
| main ();
|   ;
|   return 0;
| }
configure:17726: result: no

reply via email to

[Prev in Thread] Current Thread [Next in Thread]