2005-08-31 Stepan Kasal * 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 top the name of the default output file. 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. (_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. Index: lib/autoconf/lang.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/lang.m4,v retrieving revision 1.171 diff -u -r1.171 lang.m4 --- lib/autoconf/lang.m4 14 May 2005 07:00:40 -0000 1.171 +++ lib/autoconf/lang.m4 31 Aug 2005 12:46:29 -0000 @@ -467,53 +467,20 @@ # 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)], [# 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 ) - ;; - [[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;; + _AC_COMPILER_EXEEXT_REJECT ) ;; + * ) break;; esac 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_DEFAULT @@ -545,37 +512,41 @@ # _AC_COMPILER_EXEEXT_CROSS # ------------------------- m4_define([_AC_COMPILER_EXEEXT_CROSS], -[# 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_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'. Try to see if ac_cv_exeext, -# as computed by _AC_COMPILER_EXEEXT_DEFAULT is OK. +# Check for the extension used when `-o foo'. Compute ac_cv_exeext. +# m4_define([_AC_COMPILER_EXEEXT_O], -[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_CACHE_CHECK([for suffix of executables], ac_cv_exeext, + [ + # Clean up before the test, keeping the existing conftest.$ac_ext. + # List also $ac_file, the default output, in case it matches conftest.*. + rm -f $ac_rmfiles $ac_file + 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_exeext=`expr "$ac_file" : ['[^.]*\(\..*\)']` + break;; + * ) break;; + esac + done + ], + [AC_MSG_FAILURE([cannot compute suffix of executables: cannot compile and link]) + ]) + ]) +AC_SUBST([EXEEXT], [$ac_cv_exeext])dnl +ac_exeext=$EXEEXT ])# _AC_COMPILER_EXEEXT_O @@ -592,18 +563,33 @@ # Must be run before _AC_COMPILER_OBJEXT because _AC_COMPILER_EXEEXT_DEFAULT # checks whether the compiler works. m4_define([_AC_COMPILER_EXEEXT], -[AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) +[ +# 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. +# Use wildcards as a last resort. +ac_rmfiles="a_out.exe a.out conftest.exe conftest a.exe b.out a.*" +ac_files="$ac_rmfiles conftest.*" + +# 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_files + +AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) + ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" +ac_clean_files="$ac_clean_files $ac_rmfiles" +# Yes, this has made the list redundant, but who cares? + _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_EXEEXT_CROSS _AC_COMPILER_EXEEXT_O -rm -f conftest.$ac_ext -AC_SUBST([EXEEXT], [$ac_cv_exeext])dnl -ac_exeext=$EXEEXT +# Final cleanup: +rm -f $ac_files + +ac_clean_files=$ac_clean_files_save ])# _AC_COMPILER_EXEEXT