]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* acspecific.m4 (_AC_EXEEXT, _AC_OBJEXT): Make the two macros more
authorAkim Demaille <akim@epita.fr>
Thu, 30 Nov 2000 15:24:13 +0000 (15:24 +0000)
committerAkim Demaille <akim@epita.fr>
Thu, 30 Nov 2000 15:24:13 +0000 (15:24 +0000)
alike: a loop over a sorted list of possible files.
Don't cleanup on errors, the trap will do it.
Cleanup when there are no errors.
(_AC_EXEEXT): Use the empty string instead of `no' as the cached
value.
Be sure to prefer `.exe' to `' when the two are observable.
Suggested by Lars and Earnie.

ChangeLog
acspecific.m4
lib/autoconf/specific.m4

index 5fb9b46c63ac05b8dba5cdd73b16657897245afc..fe9e10742867b2d8542c9bd79be767922f035816 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2000-11-30  Akim Demaille  <akim@epita.fr>
+
+       * acspecific.m4 (_AC_EXEEXT, _AC_OBJEXT): Make the two macros more
+       alike: a loop over a sorted list of possible files.
+       Don't cleanup on errors, the trap will do it.
+       Cleanup when there are no errors.
+       (_AC_EXEEXT): Use the empty string instead of `no' as the cached
+       value.
+       Be sure to prefer `.exe' to `' when the two are observable.
+       Suggested by Lars and Earnie.
+
 2000-11-30  Akim Demaille  <akim@epita.fr>
 
        When using Cygwin, in spite of all their efforts, it may happen
index e46889d2d083942bf5d52cbadee710f476dcf903..48527b50598f81b695c0223ec94bfa5c12606b34 100644 (file)
@@ -1194,28 +1194,35 @@ AC_DEFUN([AC_OBJEXT],   [])
 # add .exe for Cygwin or mingw32.  Otherwise, it compiles a test
 # executable.  If this is called, the executable extensions will be
 # automatically used by link commands run by the configure script.
+#
+# This macro is called by AC_LANG_COMPILER, the latter being required
+# by the AC_COMPILE_IFELSE macros, so use AC_TRY_EVAL.
 m4_define([_AC_EXEEXT],
 [AC_CACHE_CHECK([for executable suffix], ac_cv_exeext,
 [case "$CYGWIN $MINGW32 $EMXOS2" in
   *yes*) ac_cv_exeext=.exe ;;
   *)
-  _AC_LINK_IFELSE([AC_LANG_PROGRAM()],
-  [if test ! -f conftest; then
-    for ac_file in conftest.*; do
-       case $ac_file in
-         *.$ac_ext | *.o | *.obj | *.xcoff) ;;
-         *) ac_cv_exeext=`expr "$ac_file" : 'conftest\(.*\)'`;;
-       esac
-     done
-   fi],
-  [AC_MSG_ERROR([cannot compile and link])])
-  test -n "$ac_cv_exeext" && ac_cv_exeext=no;;
+    AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
+    if AC_TRY_EVAL(ac_link); then
+      # 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 `ls conftest.exe conftest conftest.* 2>/dev/null`; do
+       case $ac_file in
+         *.$ac_ext | *.o | *.obj | *.xcoff | *.tds) ;;
+         *) ac_cv_exeext=`expr "$ac_file" : 'conftest\(.*\)'`
+            break;;
+       esac
+      done
+      rm -f conftest.$ac_objext conftest.$ac_ext
+    else
+      AC_MSG_ERROR([cannot compile and link])
+    fi
+    ;;
 esac])
-EXEEXT=
-test "$ac_cv_exeext" != no && EXEEXT=$ac_cv_exeext
-dnl Setting ac_exeext will implicitly change the ac_link command.
+AC_SUBST([EXEEXT], [$ac_cv_exeext])dnl
 ac_exeext=$EXEEXT
-AC_SUBST(EXEEXT)dnl
 ])# _AC_EXEEXT
 
 
@@ -1228,24 +1235,26 @@ AC_SUBST(EXEEXT)dnl
 # When the w32 free Borland C++ command line compiler links a program
 # (conftest.exe), it also produces a file named `conftest.tds' in
 # addition to `conftest.obj'
+#
+# This macro is called by AC_LANG_COMPILER, the latter being required
+# by the AC_COMPILE_IFELSE macros, so use AC_TRY_EVAL.
 m4_define([_AC_OBJEXT],
 [AC_CACHE_CHECK([for object suffix], ac_cv_objext,
 [AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
 if AC_TRY_EVAL(ac_compile); then
   for ac_file in `ls conftest.o conftest.obj conftest.* 2>/dev/null`; do
     case $ac_file in
-      *.o | *.obj )       ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`;;
       *.$ac_ext | *.tds ) ;;
-      *)                  ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`;;
+      *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+         break;;
     esac
   done
+  rm -f conftest.$ac_objext conftest.$ac_ext
 else
-  rm -f conftest.$ac_ext
   AC_MSG_ERROR([cannot compile])
 fi])
 AC_SUBST(OBJEXT, $ac_cv_objext)dnl
 ac_objext=$ac_cv_objext
-rm -f conftest.$ac_objext conftest.$ac_ext
 ])# _AC_OBJEXT
 
 
index e46889d2d083942bf5d52cbadee710f476dcf903..48527b50598f81b695c0223ec94bfa5c12606b34 100644 (file)
@@ -1194,28 +1194,35 @@ AC_DEFUN([AC_OBJEXT],   [])
 # add .exe for Cygwin or mingw32.  Otherwise, it compiles a test
 # executable.  If this is called, the executable extensions will be
 # automatically used by link commands run by the configure script.
+#
+# This macro is called by AC_LANG_COMPILER, the latter being required
+# by the AC_COMPILE_IFELSE macros, so use AC_TRY_EVAL.
 m4_define([_AC_EXEEXT],
 [AC_CACHE_CHECK([for executable suffix], ac_cv_exeext,
 [case "$CYGWIN $MINGW32 $EMXOS2" in
   *yes*) ac_cv_exeext=.exe ;;
   *)
-  _AC_LINK_IFELSE([AC_LANG_PROGRAM()],
-  [if test ! -f conftest; then
-    for ac_file in conftest.*; do
-       case $ac_file in
-         *.$ac_ext | *.o | *.obj | *.xcoff) ;;
-         *) ac_cv_exeext=`expr "$ac_file" : 'conftest\(.*\)'`;;
-       esac
-     done
-   fi],
-  [AC_MSG_ERROR([cannot compile and link])])
-  test -n "$ac_cv_exeext" && ac_cv_exeext=no;;
+    AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
+    if AC_TRY_EVAL(ac_link); then
+      # 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 `ls conftest.exe conftest conftest.* 2>/dev/null`; do
+       case $ac_file in
+         *.$ac_ext | *.o | *.obj | *.xcoff | *.tds) ;;
+         *) ac_cv_exeext=`expr "$ac_file" : 'conftest\(.*\)'`
+            break;;
+       esac
+      done
+      rm -f conftest.$ac_objext conftest.$ac_ext
+    else
+      AC_MSG_ERROR([cannot compile and link])
+    fi
+    ;;
 esac])
-EXEEXT=
-test "$ac_cv_exeext" != no && EXEEXT=$ac_cv_exeext
-dnl Setting ac_exeext will implicitly change the ac_link command.
+AC_SUBST([EXEEXT], [$ac_cv_exeext])dnl
 ac_exeext=$EXEEXT
-AC_SUBST(EXEEXT)dnl
 ])# _AC_EXEEXT
 
 
@@ -1228,24 +1235,26 @@ AC_SUBST(EXEEXT)dnl
 # When the w32 free Borland C++ command line compiler links a program
 # (conftest.exe), it also produces a file named `conftest.tds' in
 # addition to `conftest.obj'
+#
+# This macro is called by AC_LANG_COMPILER, the latter being required
+# by the AC_COMPILE_IFELSE macros, so use AC_TRY_EVAL.
 m4_define([_AC_OBJEXT],
 [AC_CACHE_CHECK([for object suffix], ac_cv_objext,
 [AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
 if AC_TRY_EVAL(ac_compile); then
   for ac_file in `ls conftest.o conftest.obj conftest.* 2>/dev/null`; do
     case $ac_file in
-      *.o | *.obj )       ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`;;
       *.$ac_ext | *.tds ) ;;
-      *)                  ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`;;
+      *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+         break;;
     esac
   done
+  rm -f conftest.$ac_objext conftest.$ac_ext
 else
-  rm -f conftest.$ac_ext
   AC_MSG_ERROR([cannot compile])
 fi])
 AC_SUBST(OBJEXT, $ac_cv_objext)dnl
 ac_objext=$ac_cv_objext
-rm -f conftest.$ac_objext conftest.$ac_ext
 ])# _AC_OBJEXT