Paul Berrevoets <[EMAIL PROTECTED]> writes:

> [...] for AC_EXEEXT please take into consideration that on UWIN
> (which uses a cc wrapper for MSVC), the compiler also generates a
> .pdb file, which if you don't filter it out along with .obj, would
> be used as the extension for executables.

I've had a patch in the pipeline for AC_EXEEXT for quite some time
now, which would not fall into the trap you decribe. See below.

There was a lot of discussion and many rewrites, but I don't think I
ever got a definitive "no" on the (so far) final version below. I even
think I got at least one "yes" from one of the maintainers, so I
really don't know why it wasn't applied.

Regards,
Morten

Index: acspecific.m4
===================================================================
RCS file: /cvs/autoconf/acspecific.m4,v
retrieving revision 1.313
diff -u -r1.313 acspecific.m4
--- acspecific.m4       2000/11/14 16:01:05     1.313
+++ acspecific.m4       2000/11/15 12:03:11
@@ -1199,32 +1199,32 @@
 
 # _AC_EXEEXT
 # ----------
-# Check for the extension used for executables.  This knows that we
-# 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.
+# Check for a valid extension to use for executables.
 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;;
-esac])
-EXEEXT=
-test "$ac_cv_exeext" != no && EXEEXT=$ac_cv_exeext
-dnl Setting ac_exeext will implicitly change the ac_link command.
-ac_exeext=$EXEEXT
-AC_SUBST(EXEEXT)dnl
+[# Try to compile and link an executable with no suffix first.
+ac_exeext=
+_AC_LINK_IFELSE([AC_LANG_PROGRAM()],
+ [# Ok, we can use an empty suffix for executables. Now see if the
+  # executable with the empty suffix is just a filesystem mapping
+  # from the real file (this happens under Cygwin, for instance).
+  if (test conftest -ef conftest.exe) >/dev/null 2>&1; then
+    # Prefer .exe over empty suffix (to avoid depending
+    # on the Cygwin filesystem voodoo, which is known to fail
+    # with certain tools/commands).
+    ac_exeext=.exe
+  fi],
+ [# Couldn't use empty suffix, try with suffix commonly used
+  # on DOS-based platforms.
+  ac_exeext=.exe
+  _AC_LINK_IFELSE([AC_LANG_PROGRAM()], [],
+                  [rm -f conftest.$ac_ext conftest.$ac_objext
+AC_MSG_ERROR([cannot compile and link])])
+ ])
+ac_cv_exeext=$ac_exeext
+])
+ac_exeext=$ac_cv_exeext
+AC_SUBST(EXEEXT, $ac_exeext)
 ])# _AC_EXEEXT
 
 

Reply via email to