bug-autoconf
[Top][All Lists]
Advanced

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

AC_PROG_CXX behaviour when no C++ compiler is found


From: Bruno Haible
Subject: AC_PROG_CXX behaviour when no C++ compiler is found
Date: Sun, 2 May 2010 21:18:42 +0200
User-agent: KMail/1.9.9

Hi,

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

Indeed, in an environment where no C++ compiler is found (I renamed /usr/bin/c++
and /usr/bin/g++):

This configure.ac
----------------------------------
AC_INIT
AC_PROG_CXX
AC_PROG_CC
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
----------------------------------
bails out:

  checking whether the C++ compiler works... no
  configure: error: in `/tmp':
  configure: error: C++ compiler cannot create executables
  See `config.log' for more details.

whereas this configure.ac
----------------------------------
AC_INIT
AC_PROG_CC
AC_PROG_CXX
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
----------------------------------
completes, yielding
$ grep CXX config.status 
S["ac_ct_CXX"]=""
S["CXXFLAGS"]=""
S["CXX"]="g++"

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.

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>

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.

Bruno




reply via email to

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