tests: don't use C instead of C++ compiler on case-insensitive platforms
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 11 Jul 2012 12:36:13 +0000 (14:36 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 12 Jul 2012 18:38:46 +0000 (20:38 +0200)
commit1bc5acb2df2fdf297bc101f36589ab9f932647bf
tree937ca5260e1060826047199f13a510ef8f6f2236
parent65e7ac8c3556d1895ee597811856710143cfc4ac
tests: don't use C instead of C++ compiler on case-insensitive platforms

This change fixes automake bug#11893 and bug#10766.

On at least Cygwin and Mac OS X 10.7, the file system where the system
compilers are located can be case-insensitive, so that looking for a
program named 'CC' might actually find the C compiler in /usr/bin/cc.

Now, the Automake configure script looks for a C++ compiler named 'CC'
before looking for more obvious names like c++ or g++ (that is done to
increase testsuite "coverage in the wild", e.g., preferring, on Solaris,
the Sun Studio C++ compiler /usr/bin/CC over the GNU C++ compiler).

Since the checks done in AC_PROG_CXX are apparently not strict enough
to rule out C compilers like those from GCC or Clang (which are smart
enough to recognize if a file has a C++ extension, passing it to the
C++ front end) the testsuite might end up using a C compiler where a
C++ one is expected, with some subtle bad consequences.

* configure.ac: Don't look for a C++ compiler named 'CC' if the
"top-level" file system(s) (where /bin and /usr/bin are) are detected
to be case-insensitive.

Reported-by: Peter Rosin <peda@lysator.liu.se>
Reported-by: Max Horn <max@quendi.de>
Helped-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
configure.ac