+Tue Jun 10 11:04:16 1997 Tom Tromey <tromey@cygnus.com>
+
+ * m4/cygwin.m4: Examine output of compiler to see if .exe needed.
+
Sun Jun 1 13:16:05 1997 Tom Tromey <tromey@cygnus.com>
* automake.in (handle_built_sources): Handle PRE_BUILT_SOURCES.
# Otherwise set it to "".
dnl AM_CYGWIN32()
+dnl You might think we can do this by checking for a cygwin32-specific
+dnl cpp define. We can't, because cross-compilers that target
+dnl cygwin32 don't use the .exe suffix. I don't know why.
AC_DEFUN(AM_CYGWIN32,
-[AC_MSG_CHECKING(for Cygwin32 environment)
-AC_EGREP_CPP(lose, [
-#ifdef __CYGWIN32__
-lose
-#endif], [EXEEXT=.exe
-AC_MSG_RESULT(yes)], [EXEEXT=
-AC_MSG_RESULT(no)])
+[AC_CACHE_CHECK(for Cygwin32 environment, am_cv_cygwin32,
+[cat > conftest.$ac_ext << 'EOF'
+int main () {
+/* Nothing. */
+return 0; }
+EOF
+if AC_TRY_EVAL(ac_link) && test -s conftest.exe; then
+ am_cv_cygwin32=yes
+else
+ am_cv_cygwin32=no
+fi
+rm -f conftest*])
+EXEEXT=
+test "$am_cv_cygwin32" = yes && EXEEXT=.exe
AC_SUBST(EXEEXT)])