Hello, to add a few more data points here.
* Bruno Haible wrote on Sun, May 02, 2010 at 09:18:42PM CEST: > Ralf writes in > <http://lists.gnu.org/archive/html/bug-libtool/2010-05/msg00003.html>: > > AC_PROG_CXX does not abort the configure script if it not expanded > > before, say, AC_PROG_CC > IMO there are three problems with this behaviour: > > 1) It is surprising that AC_PROG_CXX behaves differently, depending on > whether AC_PROG_CC was run before. The thing to know is that it's not the AC_PROG_{CC,CXX,...} macro that fails, but the tests for object file/executable file extensions, which are only done for the first of the macros in the configure file. > 2) It is not documented in the autoconf manual, in the places where I > was looking: > > <http://www.gnu.org/software/autoconf/manual/html_node/Compilers-and-Preprocessors.html> > > <http://www.gnu.org/software/autoconf/manual/html_node/C_002b_002b-Compiler.html> There is a proposed patch to document this: <http://thread.gmane.org/gmane.comp.sysutils.autoconf.patches/7028> I was unwilling to accept it at the time, not sure whether we should rethink that. > 3) Suppose I wanted to use this "feature", and compile some C++ parts of my > program if and only if a C++ compiler is found. Then I would have to test > whether the variable ac_ct_CXX is empty (because CXX=g++ may indicate that > g++ was found or that no C++ compiler at all was found). But this variable > is undocumented. Yes, AC_PROG_{CXX,OBJC} both have the bug that they set the compiler variable $CXX/$OBJC to some value (g++/gcc) even when no compiler was found. We are not sure why this was done in AC_PROG_CXX, it certainly is a bug in AC_PROG_OBJC. Maybe we should just set them to 'false' in that case, also for AC_PROG_{F77,FC,CC}. Hmm, AC_PROG_CC does abort if $CC is empty, so that's another inconsistency. Maybe that one is useful however: very few projects make optional use of C. ac_ct_CXX is an internal detail that you should not rely on. It would be more useful to test whether the compiler works, e.g., <http://thread.gmane.org/gmane.comp.sysutils.autoconf.general/12680>. BTW, for OBJC and OBJCXX (patches were posted, but not accepted), a check for whether the compiler works is even more important than for the other compilers: it is quite common that gcc/g++ exist but the Objective languages have not been compiled in (or libraries cannot be found). In order to allow optional support for these languages in a package, the checking macros should have optional IF-FAILS arguments. Cheers, Ralf
