bug-autoconf
[Top][All Lists]
Advanced

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

Autoconf 2.69 AC_PROG_CXX accepts plain C compilers


From: Peter De Wachter
Subject: Autoconf 2.69 AC_PROG_CXX accepts plain C compilers
Date: Wed, 5 Feb 2014 21:04:11 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

I was testing a C++ project of mine with older versions of GCC, and
mistakingly used the following command:
$ ./configure CXX=gcc-4.7

Autoconf didn't spot any problem:
> checking whether the C++ compiler works... yes
But of course gcc-4.7 doesn't know how to link a C++ program, so my
build failed.

The attached patch fixes this problem by changing the C++ null program
into:

int main() { (void) new int; return 0; }

Any C++ compiler, even an ancient one, should be able to pass that test,
but C compilers will fail. In GCC's case, the program will compile but
the link will fail because libc doesn't contain an 'operator new'.

Attachment: null_cxx_program.patch
Description: Text Data


reply via email to

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