autoconf
[Top][All Lists]
Advanced

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

autoconf will accept a nonexistent compiler as the second one checked


From: Ben Pfaff
Subject: autoconf will accept a nonexistent compiler as the second one checked
Date: Sun, 19 Mar 2006 12:22:05 -0800
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

[Retaining the CC: to address@hidden will make
for easier tracking of the bug report at Debian.]

Consider the following configure.ac:

----------------------------------------------------------------------
AC_PREREQ(2.50)
AC_INIT(test, 1.0)
AC_PROG_CC
AC_PROG_CXX
AC_OUTPUT
----------------------------------------------------------------------

If I invoke the generated ./configure in the following way, it
fails very quickly because "nonexistent" is not a program:
        CC=nonexistent ./configure
Here is the output:
        checking for gcc... nonexistent
        checking for C compiler default output file name... configure: error: C 
compiler cannot create executables
        See `config.log' for more details.

On the other hand, if I invoke it this way, it completely succeeds:
        CXX=nonexistent ./configure 
Here is the output:
        checking for gcc... gcc
        checking for C compiler default output file name... a.out
        checking whether the C compiler works... yes
        checking whether we are cross compiling... no
        checking for suffix of executables... 
        checking for suffix of object files... o
        checking whether we are using the GNU C compiler... yes
        checking whether gcc accepts -g... yes
        checking for gcc option to accept ANSI C... none needed
        checking whether we are using the GNU C++ compiler... no
        checking whether nonexistent accepts -g... no
        configure: creating ./config.status

The situation is reversed if the AC_PROG_CC and AC_PROG_CXX lines
are correspondingly reversed in the configure.ac.

The reason, as far as I can tell, is this line in AC_PROG_CC and
AC_PROG_CXX:
    m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
_AC_COMPILER_EXEEXT is what checks that the compiler really
exists and works, but it only gets run once per configure script,
not once per compiler.

I've tested this with Debian's Autoconf 2.59.  I don't think the
situation has changed in CVS, based on a brief look at the
source, but I haven't actually tested it.
-- 
Ben Pfaff 
email: address@hidden
web: http://benpfaff.org




reply via email to

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