2006-05-22 Ralf Wildenhues Revert these two patches: 2006-04-06 Eric Blake * lib/autoconf/lang.m4 (_AC_COMPILER_EXEEXT_O): Inside cache check, s/ac_exeext/ac_cv_exeext/. Fixes regression introduced 2006-04-01. 2006-04-01 Stepan Kasal Clean up _AC_COMPILER_EXEEXT* macros. * lib/autoconf/lang.m4 (_AC_COMPILER_EXEEXT_DEFAULT): Don't try to detect exeext, it will be done by _AC_COMPILER_EXEEXT_O; just set ac_file to the name of the default output file and call _AC_COMPILER_EXEEXT_WORKS. Move the definition of ac_files and the initial `rm' of the candidate files... (_AC_COMPILER_EXEEXT): ... here and simplify them. Moreover, use the same list in subsequent `rm' calls, and for the temporary redefinition of ac_clean_files; call _AC_COMPILER_OBJEXT at the end, and don't call the other _AC_COMPILER_EXEEXT_* macros directly, use... (_AC_COMPILER_EXEEXT_TESTS): ... this new macro. (_AC_COMPILER_EXEEXT_O): Don't export ac_cv_exeext, it's not needed (or no longer needed) by libtool. Make it a cache check. (_AC_COMPILER_EXEEXT_CROSS): Remove the comment, it was obviously copied here by mistake. (AC_NO_EXECUTABLES): Redefine _AC_COMPILER_EXEEXT_TESTS, not _AC_COMPILER_EXEEXT. * lib/autoconf/c.m4 (AC_PROG_CC, AC_PROG_CXX, AC_PROG_OBJC): Do not call _AC_COMPILER_OBJEXT directly. * lib/autoconf/fortran.m4 (_AC_PROG_FC): Likewise. Index: lib/autoconf/c.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/c.m4,v retrieving revision 1.226 diff -u -r1.226 c.m4 --- lib/autoconf/c.m4 20 May 2006 15:49:27 -0000 1.226 +++ lib/autoconf/c.m4 22 May 2006 18:32:47 -0000 @@ -548,6 +548,7 @@ _AC_EVAL([$ac_compiler -V >&AS_MESSAGE_LOG_FD]) m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl +m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl _AC_LANG_COMPILER_GNU GCC=`test $ac_compiler_gnu = yes && echo yes` _AC_PROG_CC_G @@ -775,6 +776,7 @@ _AC_EVAL([$ac_compiler -V >&AS_MESSAGE_LOG_FD]) m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl +m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl _AC_LANG_COMPILER_GNU GXX=`test $ac_compiler_gnu = yes && echo yes` _AC_PROG_CXX_G @@ -937,6 +939,7 @@ _AC_EVAL([$ac_compiler -V >&AS_MESSAGE_LOG_FD]) m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl +m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl _AC_LANG_COMPILER_GNU GOBJC=`test $ac_compiler_gnu = yes && echo yes` _AC_PROG_OBJC_G Index: lib/autoconf/fortran.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/fortran.m4,v retrieving revision 1.207 diff -u -r1.207 fortran.m4 --- lib/autoconf/fortran.m4 20 May 2006 05:39:03 -0000 1.207 +++ lib/autoconf/fortran.m4 22 May 2006 18:32:47 -0000 @@ -370,6 +370,7 @@ rm -f a.out m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl +m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl # If we don't use `.F' as extension, the preprocessor is not run on the # input file. (Note that this only needs to work for GNU compilers.) ac_save_ext=$ac_ext Index: lib/autoconf/lang.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/lang.m4,v retrieving revision 1.180 diff -u -r1.180 lang.m4 --- lib/autoconf/lang.m4 6 Apr 2006 18:34:24 -0000 1.180 +++ lib/autoconf/lang.m4 22 May 2006 18:32:47 -0000 @@ -378,10 +378,11 @@ AC_BEFORE([$0], [_AC_COMPILER_EXEEXT]) AC_BEFORE([$0], [AC_LINK_IFELSE]) -m4_define([_AC_COMPILER_EXEEXT_TESTS], -[if AC_TRY_EVAL(ac_link); then +m4_define([_AC_COMPILER_EXEEXT], +[AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) +if AC_TRY_EVAL(ac_link); then ac_no_link=no - ]m4_defn([_AC_COMPILER_EXEEXT_TESTS])[ + ]m4_defn([_AC_COMPILER_EXEEXT])[ else ac_no_link=yes # Setting cross_compile will disable run tests; it will @@ -474,32 +475,61 @@ # of exeext. AC_MSG_CHECKING([for _AC_LANG compiler default output file name]) ac_link_default=`echo "$ac_link" | sed ['s/ -o *conftest[^ ]*//']` +# +# List of possible output files, starting from the most likely. +# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) +# only as a last resort. b.out is created by i960 compilers. +ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' +# +# The IRIX 6 linker writes into existing files which may not be +# executable, retaining their permissions. Remove them first so a +# subsequent execution test works. +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + _AC_COMPILER_EXEEXT_REJECT ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles AS_IF([AC_TRY_EVAL(ac_link_default)], -[for ac_file in $ac_outfiles a.* conftest.* NO +[# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +for ac_file in $ac_files do test -f "$ac_file" || continue case $ac_file in - _AC_COMPILER_EXEEXT_REJECT ) ;; - * ) break;; + _AC_COMPILER_EXEEXT_REJECT ) + ;; + [[ab]].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : ['[^.]*\(\..*\)']` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; esac -done -AS_IF([test "$ac_file" = NO], [AC_MSG_FAILURE([no output file found])]) -], +done], [_AC_MSG_LOG_CONFTEST AC_MSG_FAILURE([_AC_LANG compiler cannot create executables], 77)]) +ac_exeext=$ac_cv_exeext AC_MSG_RESULT([$ac_file]) -_AC_COMPILER_EXEEXT_WORKS -# Clean up; list also $ac_file, in case it matched a wildcard entry. -rm -f $ac_outfiles $ac_file ])# _AC_COMPILER_EXEEXT_DEFAULT # _AC_COMPILER_EXEEXT_WORKS # ------------------------- -# Called from _AC_COMPILER_EXEEXT_DEFAULT. m4_define([_AC_COMPILER_EXEEXT_WORKS], -[# Check that the compiler produces executables we can run. If not, either +[# Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. AC_MSG_CHECKING([whether the _AC_LANG compiler works]) # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 @@ -523,53 +553,40 @@ # _AC_COMPILER_EXEEXT_CROSS # ------------------------- m4_define([_AC_COMPILER_EXEEXT_CROSS], -[AC_MSG_CHECKING([whether we are cross compiling]) +[# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +AC_MSG_CHECKING([whether we are cross compiling]) AC_MSG_RESULT([$cross_compiling]) ])# _AC_COMPILER_EXEEXT_CROSS # _AC_COMPILER_EXEEXT_O # --------------------- -# Check for the extension used when `-o foo'. Compute ac_cv_exeext. -# +# Check for the extension used when `-o foo'. Try to see if ac_cv_exeext, +# as computed by _AC_COMPILER_EXEEXT_DEFAULT is OK. m4_define([_AC_COMPILER_EXEEXT_O], -[AC_CACHE_CHECK([for suffix of executables], ac_cv_exeext, - [AS_IF([AC_TRY_EVAL(ac_link)], - [# If both `conftest.exe' and `conftest' are `present' (well, observable), - # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will - # work properly (i.e., refer to `conftest.exe'), while it won't with `rm'. - for ac_file in conftest.exe conftest conftest.* NO; do - test -f "$ac_file" || continue - case $ac_file in - _AC_COMPILER_EXEEXT_REJECT ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : ['[^.]*\(\..*\)']` - break;; - * ) break;; - esac - done - AS_IF([test "$ac_file" = NO], - [AC_MSG_FAILURE([cannot compute suffix of executables: no output file found])]) - # Clean up; list also $ac_file, in case it matched conftest.*. - rm -f $ac_outfiles $ac_file - ], - [AC_MSG_FAILURE([cannot compute suffix of executables: cannot compile and link]) - ]) - ]) -AC_SUBST([EXEEXT], [$ac_cv_exeext])dnl -ac_exeext=$EXEEXT +[AC_MSG_CHECKING([for suffix of executables]) +AS_IF([AC_TRY_EVAL(ac_link)], +[# If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + _AC_COMPILER_EXEEXT_REJECT ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : ['[^.]*\(\..*\)']` + export ac_cv_exeext + break;; + * ) break;; + esac +done], + [AC_MSG_FAILURE([cannot compute suffix of executables: cannot compile and link])]) +rm -f conftest$ac_cv_exeext +AC_MSG_RESULT([$ac_cv_exeext]) ])# _AC_COMPILER_EXEEXT_O -# _AC_COMPILER_EXEEXT_TESTS -# ------------------------- -# Calls all of the above _AC_COMPILER_EXEEXT_* tests. -# This macro is modified by the AC_NO_EXECUTABLES hack. -m4_define([_AC_COMPILER_EXEEXT_TESTS], -[_AC_COMPILER_EXEEXT_DEFAULT -_AC_COMPILER_EXEEXT_CROSS -_AC_COMPILER_EXEEXT_O]) - - # _AC_COMPILER_EXEEXT # ------------------- # Check for the extension used for executables. It compiles a test @@ -583,33 +600,18 @@ # Must be run before _AC_COMPILER_OBJEXT because _AC_COMPILER_EXEEXT_DEFAULT # checks whether the compiler works. m4_define([_AC_COMPILER_EXEEXT], -[ -# List of possible output files. We want to start from the most likely, -# but we have to check foo.exe before foo, because Cygwin `test -f' looks -# also for foo.exe. b.out is created by i960 compilers. -# As a last resort, we also try wildcards: `conftest.*' and `a.*'. -# But we are not allowed to rm a.*, and we do not want always remove -# conftest.*, so we will list them literally, when appropriate. -ac_outfiles="a_out.exe a.out conftest.exe conftest a.exe b.out" - -# The IRIX 6 linker writes into existing files which may not be -# executable, retaining their permissions. Remove them first so a -# subsequent execution test works. -rm -f $ac_outfiles conftest.* - -AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) - +[AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $ac_outfiles" - -# The following tests should remove their output except files matching conftest.*. -_AC_COMPILER_EXEEXT_TESTS - +ac_clean_files="$ac_clean_files a.out a.exe b.out" +_AC_COMPILER_EXEEXT_DEFAULT +_AC_COMPILER_EXEEXT_WORKS +rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save - -_AC_COMPILER_OBJEXT - -rm -f conftest.* +_AC_COMPILER_EXEEXT_CROSS +_AC_COMPILER_EXEEXT_O +rm -f conftest.$ac_ext +AC_SUBST([EXEEXT], [$ac_cv_exeext])dnl +ac_exeext=$EXEEXT ])# _AC_COMPILER_EXEEXT @@ -625,7 +627,8 @@ # it includes. So do it by hand. m4_define([_AC_COMPILER_OBJEXT], [AC_CACHE_CHECK([for suffix of object files], ac_cv_objext, -[rm -f conftest.o conftest.obj +[AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) +rm -f conftest.o conftest.obj AS_IF([AC_TRY_EVAL(ac_compile)], [for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; @@ -636,7 +639,8 @@ esac done], [_AC_MSG_LOG_CONFTEST -AC_MSG_FAILURE([cannot compute suffix of object files: cannot compile])])]) +AC_MSG_FAILURE([cannot compute suffix of object files: cannot compile])]) +rm -f conftest.$ac_cv_objext conftest.$ac_ext]) AC_SUBST([OBJEXT], [$ac_cv_objext])dnl ac_objext=$OBJEXT ])# _AC_COMPILER_OBJEXT