Hello everybody. I encountered the following strage behaviour in the latest stable autoconf (2.65, Debian package version 2.65-2), and it really seems a bug to me:
$ cat > configure.ac <<EOF AC_INIT AC_PROG_CC AC_PROG_F77 EOF $ autoconf $ ./configure CC=gcc F77=gfortran; echo rc=$? # works as expected checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no 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 ISO C89... none needed checking whether we are using the GNU Fortran 77 compiler... yes checking whether gfortran accepts -g... yes rc=0 $ ./configure CC=false F77=gfortran; echo rc=$? # fails as expected checking for gcc... false checking whether the C compiler works... no configure: error: in `/home/stefano/tmp': configure: error: C compiler cannot create executables See `config.log' for more details. rc=77 $ ./configure CC=gcc F77=false; echo rc=$? # doesn't fail! checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no 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 ISO C89... none needed checking whether we are using the GNU Fortran 77 compiler... no checking whether false accepts -g... no rc=0 -*-*- And a specular behaviour can be observed by swapping the AC_PROG_CC and AC_PROG_F77 macros in configure.ac: $ cat > configure.ac <<EOF AC_INIT AC_PROG_F77 AC_PROG_CC EOF $ autoconf $ ./configure CC=gcc F77=gfortran; echo rc=$? # works as expected checking whether the Fortran 77 compiler works... yes checking for Fortran 77 compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU Fortran 77 compiler... yes checking whether gfortran accepts -g... yes checking for gcc... gcc checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed rc=0 $ ./configure CC=gcc F77=false; echo rc=$? # fails as expected checking whether the Fortran 77 compiler works... no configure: error: in `/home/stefano/tmp': configure: error: Fortran 77 compiler cannot create executables See `config.log' for more details. rc=77 $ ./configure CC=false F77=gfortran; echo rc=$? # doesn't fail! checking whether the Fortran 77 compiler works... yes checking for Fortran 77 compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU Fortran 77 compiler... yes checking whether gfortran accepts -g... yes checking for gcc... false checking whether we are using the GNU C compiler... no checking whether false accepts -g... no checking for false option to accept ISO C89... unsupported rc=0 -*-*- Finally, I observed the same behaviour with the latest autoconf from Git master branch (2.65.35-a2889). -*-*-*- System details: Debian GNU/Linux squeeze/sid GNU m4: 1.4.13 Perl: v5.10.1 (Debian package version 5.10.1-8) GCC: 4.3.4 gfortran: 4.3.4 Let me know if you need the generated configure scripts and/or the config.log files. Regards, Stefano