autoconf will accept a nonexistent compiler as the second one checked

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

 



[Retaining the CC: to 357369-forwarded@xxxxxxxxxxxxxxx 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: blp@xxxxxxxxxxxxxxx
web: http://benpfaff.org


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux