Commit 9e821c83 authored by Eli Zaretskii's avatar Eli Zaretskii

Fixed configure.ac and headers in nt/inc. Emulated functions not handled yet.

parent bc9ce0d9
......@@ -526,7 +526,8 @@ case "${canonical}" in
*-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 ;;
......@@ -988,7 +989,7 @@ C_SWITCH_SYSTEM=
## 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)
......@@ -2905,7 +2906,7 @@ AC_SUBST(LIBXML2_LIBS)
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
......@@ -3926,10 +3927,14 @@ else
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))
......@@ -4275,12 +4280,14 @@ case "$USE_X_TOOLKIT" in
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)
......@@ -4385,6 +4392,12 @@ gl_INIT
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" ;;
......
......@@ -43,8 +43,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#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
......@@ -62,7 +63,9 @@ typedef unsigned short uint16_t;
#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
......@@ -71,8 +74,9 @@ typedef unsigned short uint16_t;
/* 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
......
......@@ -6,11 +6,22 @@
* 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
{
......
......@@ -3,6 +3,9 @@
#ifndef _UNISTD_H
#define _UNISTD_H
#include <sys/types.h>
#include <pwd.h>
/* On Microsoft platforms, <stdlib.h> declares 'environ'; on POSIX
platforms, <unistd.h> does. Every file in Emacs that includes
<unistd.h> also includes <stdlib.h>, so there's no need to declare
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment