*-darwin* ) opsys=darwin ;;
*-mingw32 )
opsys=mingw32
- CFLAGS="-mtune=pentium4 $CFLAGS"
+ # MinGW overrides and adds some system headers in nt/inc.
+ GCC_TEST_OPTIONS="-I nt/inc"
;;
*-sysv4.2uw* ) opsys=unixware ;;
*-sysv5uw* ) opsys=unixware ;;
## additional optimization. --nils@exp-math.uni-essen.de
test "$opsys" = "aix4.2" && test "x$GCC" != "xyes" && \
C_SWITCH_SYSTEM="-ma -qmaxmem=4000"
-test "$opsys" = "mingw32" && C_SWITCH_SYSTEM="-DUSE_CRT_DLL=1 -I../nt/inc"
+test "$opsys" = "mingw32" && C_SWITCH_SYSTEM="-mtune=pentium4"
## gnu-linux might need -D_BSD_SOURCE on old libc5 systems.
## It is redundant in glibc2, since we define _GNU_SOURCE.
AC_SUBST(C_SWITCH_SYSTEM)
AC_SUBST(LIBXML2_CFLAGS)
# If netdb.h doesn't declare h_errno, we must declare it by hand.
-# On MinGW, that is provided by nt/inc/sys/socket.h.
+# On MinGW, that is provided by nt/inc/sys/socket.h and w32.c.
if test "${opsys}" = "mingw32"; then
emacs_cv_netdb_declares_h_errno=yes
fi
esac
fi dnl GCC?
+dnl In a weird quirk, MS runtime uses _setjmp and longjmp.
AC_CACHE_CHECK([for _setjmp], [emacs_cv_func__setjmp],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <setjmp.h>
+ #ifdef __MINGW32__
+ # define _longjmp longjmp
+ #endif
]],
[[jmp_buf j;
if (! _setjmp (j))
esac
AC_SUBST(TOOLKIT_LIBW)
-if test "$USE_X_TOOLKIT" = "none"; then
- LIBXT_OTHER="\$(LIBXSM)"
- OLDXMENU_TARGET="really-oldXMenu"
-else
- LIBXT_OTHER="\$(LIBXMU) -lXt \$(LIBXTR6) -lXext"
- OLDXMENU_TARGET="really-lwlib"
+if test "${opsys}" != "mingw32"; then
+ if test "$USE_X_TOOLKIT" = "none"; then
+ LIBXT_OTHER="\$(LIBXSM)"
+ OLDXMENU_TARGET="really-oldXMenu"
+ else
+ LIBXT_OTHER="\$(LIBXMU) -lXt \$(LIBXTR6) -lXext"
+ OLDXMENU_TARGET="really-lwlib"
+ fi
fi
AC_SUBST(LIBXT_OTHER)
CFLAGS=$SAVE_CFLAGS
LIBS=$SAVE_LIBS
+if test "${opsys}" = "mingw32"; then
+ CPPFLAGS="-DUSE_CRT_DLL=1 -I../nt/inc"
+ # Remove unneeded switches from the value of CC that goes to Makefiles
+ CC=`echo $CC | sed -e "s,$GCC_TEST_OPTIONS,,"`
+fi
+
case "$opsys" in
aix4-2) LD_SWITCH_SYSTEM_TEMACS="-Wl,-bnodelcsect" ;;
#undef FD_ZERO
#endif
-/* avoid duplicate definition of timeval */
-#ifdef HAVE_TIMEVAL
+/* Avoid duplicate definition of timeval. MinGW uses _TIMEVAL_DEFINED
+ in sys/time.h to avoid that. */
+#if defined (HAVE_TIMEVAL) && defined (_MSC_VER)
#define timeval ws_timeval
#endif
#undef MUST_REDEF_SELECT
#endif
-/* revert to our version of FD_SET */
+/* Revert to our version of FD_SET, but not when included from test
+ programs run by configure. */
+#ifdef EMACS_CONFIG_H
#undef FD_SET
#undef FD_CLR
#undef FD_ISSET
/* allow us to provide our own version of fd_set */
#define fd_set ws_fd_set
#include "w32.h"
+#endif /* EMACS_CONFIG_H */
-#ifdef HAVE_TIMEVAL
+#if defined (HAVE_TIMEVAL) && defined (_MSC_VER)
#undef timeval
#endif
* have the below stuff.
*/
+/* Allow inclusion of sys/time.h and winsock2.h in any order. Needed
+ for running the configure test, which is only relevant to MinGW. */
+#ifndef _TIMEVAL_DEFINED
+#define _TIMEVAL_DEFINED
struct timeval
{
long tv_sec; /* seconds */
long tv_usec; /* microseconds */
};
+#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
+#define timercmp(tvp, uvp, cmp) \
+ (((tvp)->tv_sec != (uvp)->tv_sec) ? \
+ ((tvp)->tv_sec cmp (uvp)->tv_sec) : \
+ ((tvp)->tv_usec cmp (uvp)->tv_usec))
+#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
+#endif /* _TIMEVAL_DEFINED */
struct timezone
{