Sorry, due to brain-deadness on my part the previous version of this patch didn't build properly. This version is much cleaner and builds properly on linux.
Index: configure.ac =================================================================== RCS file: /home/wine/wine/configure.ac,v retrieving revision 1.65 diff -u -r1.65 configure.ac --- configure.ac 30 Jul 2002 02:44:19 -0000 1.65 +++ configure.ac 30 Jul 2002 23:51:10 -0000 @@ -863,12 +863,14 @@ AC_FUNC_ALLOCA() AC_CHECK_FUNCS(\ __libc_fork \ + _fstat \ _lwp_create \ _pclose \ _popen \ _snprintf \ _stricmp \ _strnicmp \ + _stat \ chsize \ clone \ ecvt \ @@ -1083,6 +1085,82 @@ then AC_DEFINE(HAVE_LINUX_22_JOYSTICK_API, 1, [Define if <linux/joystick.h> defines the Linux 2.2 joystick API]) + fi +fi + +dnl **** check for struct netent, getnetbyaddr() and getnetbyname() in <netdb.h> and for _off_t in <sys/types.h> **** + +if test "$ac_cv_header_netdb_h" = "yes" +then + AC_CACHE_CHECK([whether netdb.h defines struct netent], + wine_cv_netdb_h_defines_struct_netent, + AC_TRY_COMPILE([ + #include <netdb.h> + ], [ + struct netent foo; + ], + wine_cv_netdb_h_defines_struct_netent=yes, + wine_cv_netdb_h_defines_struct_netent=no + ) + ) + if test "$wine_cv_netdb_h_defines_struct_netent" = "yes" + then + AC_DEFINE(NETDB_H_DEFINES_STRUCT_NETENT, 1, + [Define if <netdb.h> defines struct netent]) + fi + + AC_CACHE_CHECK([whether netdb.h defines getnetbyaddr], + wine_cv_netdb_defines_getnetbyaddr, + AC_TRY_COMPILE([ + #include <netdb.h> + ], [ + getnetbyaddr(0,0); + ], + wine_cv_netdb_h_defines_getnetbyaddr=yes, + wine_cv_netdb_h_defines_getnetbyaddr=no + ) + ) + if test "$wine_cv_netdb_h_defines_getnetbyaddr" = "yes" + then + AC_DEFINE(NETDB_H_DEFINES_GETNETBYADDR, 1, + [Define if <netdb.h> defines getnetbyaddr()]) + fi + + AC_CACHE_CHECK([whether netdb.h defines getnetbyname], + wine_cv_netdb_h_defines_getnetbyname, + AC_TRY_COMPILE([ + #include <netdb.h> + ], [ + getnetbyname(""); + ], + wine_cv_netdb_h_defines_getnetbyname=yes, + wine_cv_netdb_h_defines_getnetbyname=no + ) + ) + if test "$wine_cv_netdb_h_defines_getnetbyname" = "yes" + then + AC_DEFINE(NETDB_H_DEFINES_GETNETBYNAME, 1, + [Define if <netdb.h> defines getnetbyname()]) + fi +fi + +if test "$ac_cv_header_sys_types_h" = "yes" +then + AC_CACHE_CHECK([whether sys/types.h defines _off_t], + wine_cv_sys_types_h_defines__off_t, + AC_TRY_COMPILE([ + #include <sys/types.h> + ], [ + _off_t o; + ], + wine_cv_sys_types_h_defines__off_t=yes, + wine_cv_sys_types_h_defines__off_t=no + ) + ) + if test "$wine_cv_sys_types_h_defines__off_t" = "yes" + then + AC_DEFINE(SYS_TYPES_H_DEFINES__OFF_T, 1, + [Define if <sys/types.h> defines _off_t]) fi fi Index: dlls/kernel/sync.c =================================================================== RCS file: /home/wine/wine/dlls/kernel/sync.c,v retrieving revision 1.21 diff -u -r1.21 sync.c --- dlls/kernel/sync.c 25 Jul 2002 00:22:03 -0000 1.21 +++ dlls/kernel/sync.c 30 Jul 2002 23:51:11 -0000 @@ -536,6 +536,7 @@ BOOL WINAPI PeekNamedPipe( HANDLE hPipe, LPVOID lpvBuffer, DWORD cbBuffer, LPDWORD lpcbRead, LPDWORD lpcbAvail, LPDWORD lpcbMessage ) { +#ifdef FIONREAD int avail=0,fd; fd = FILE_GetUnixHandle(hPipe, GENERIC_READ); @@ -555,6 +556,7 @@ *lpcbAvail= avail; return TRUE; } +#endif /* defined(FIONREAD) */ SetLastError(ERROR_CALL_NOT_IMPLEMENTED); FIXME("function not implemented\n"); Index: dlls/msvcrt/file.c =================================================================== RCS file: /home/wine/wine/dlls/msvcrt/file.c,v retrieving revision 1.32 diff -u -r1.32 file.c --- dlls/msvcrt/file.c 19 Jul 2002 03:24:50 -0000 1.32 +++ dlls/msvcrt/file.c 30 Jul 2002 23:51:13 -0000 @@ -670,7 +670,11 @@ /********************************************************************* * _fstat (MSVCRT.@) */ +#ifndef HAVE__FSTAT int _fstat(int fd, struct _stat* buf) +#else +int MSVCRT(_fstat)(int fd, struct _stat* buf) +#endif /* HAVE__FSTAT */ { DWORD dw; BY_HANDLE_FILE_INFORMATION hfi; @@ -1135,7 +1139,11 @@ /********************************************************************* * _stat (MSVCRT.@) */ +#ifndef HAVE__STAT int _stat(const char* path, struct _stat * buf) +#else +int MSVCRT(_stat)(const char* path, struct _stat * buf) +#endif /* HAVE__STAT */ { DWORD dw; WIN32_FILE_ATTRIBUTE_DATA hfi; Index: dlls/ntdll/signal_i386.c =================================================================== RCS file: /home/wine/wine/dlls/ntdll/signal_i386.c,v retrieving revision 1.40 diff -u -r1.40 signal_i386.c --- dlls/ntdll/signal_i386.c 22 Jul 2002 20:47:11 -0000 1.40 +++ dlls/ntdll/signal_i386.c 30 Jul 2002 23:51:15 -0000 @@ -249,8 +249,44 @@ #endif /* __EMX__ */ +#ifdef __CYGWIN__ -#if defined(linux) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__EMX__) +/* FIXME: This section is just here so it can compile, it's most likely + * completely wrong. */ + +typedef struct +{ + unsigned short sc_gs, __gsh; + unsigned short sc_fs, __fsh; + unsigned short sc_es, __esh; + unsigned short sc_ds, __dsh; + unsigned long sc_edi; + unsigned long sc_esi; + unsigned long sc_ebp; + unsigned long sc_esp; + unsigned long sc_ebx; + unsigned long sc_edx; + unsigned long sc_ecx; + unsigned long sc_eax; + unsigned long sc_trapno; + unsigned long sc_err; + unsigned long sc_eip; + unsigned short sc_cs, __csh; + unsigned long sc_eflags; + unsigned long esp_at_signal; + unsigned short sc_ss, __ssh; + unsigned long i387; + unsigned long oldmask; + unsigned long cr2; +} SIGCONTEXT; + +#define HANDLER_DEF(name) void name( int __signal, SIGCONTEXT __context ) +#define HANDLER_CONTEXT (&__context) + +#endif /* __CYGWIN__ */ + +#if defined(linux) || defined(__NetBSD__) || defined(__FreeBSD__) ||\ + defined(__OpenBSD__) || defined(__EMX__) || defined(__CYGWIN__) #define EAX_sig(context) ((context)->sc_eax) #define EBX_sig(context) ((context)->sc_ebx) Index: dlls/wineps/builtin.c =================================================================== RCS file: /home/wine/wine/dlls/wineps/builtin.c,v retrieving revision 1.1 diff -u -r1.1 builtin.c --- dlls/wineps/builtin.c 24 Jun 2002 23:44:18 -0000 1.1 +++ dlls/wineps/builtin.c 30 Jul 2002 23:51:16 -0000 @@ -49,7 +49,7 @@ * Scale builtin font to requested lfHeight * */ -inline static float round(float f) +inline static float Round(float f) { return (f > 0) ? (f + 0.5) : (f - 0.5); } @@ -73,15 +73,15 @@ (float)(wm->usWinAscent + wm->usWinDescent); } - font->size = (INT)round(font->fontinfo.Builtin.scale * (float)wm->usUnitsPerEm); + font->size = (INT)Round(font->fontinfo.Builtin.scale * (float)wm->usUnitsPerEm); - usUnitsPerEm = (USHORT)round((float)(wm->usUnitsPerEm) * font->fontinfo.Builtin.scale); - sAscender = (SHORT)round((float)(wm->sAscender) * font->fontinfo.Builtin.scale); - sDescender = (SHORT)round((float)(wm->sDescender) * font->fontinfo.Builtin.scale); - sLineGap = (SHORT)round((float)(wm->sLineGap) * font->fontinfo.Builtin.scale); - usWinAscent = (USHORT)round((float)(wm->usWinAscent) * font->fontinfo.Builtin.scale); - usWinDescent = (USHORT)round((float)(wm->usWinDescent) * font->fontinfo.Builtin.scale); - sAvgCharWidth = (SHORT)round((float)(wm->sAvgCharWidth) * font->fontinfo.Builtin.scale); + usUnitsPerEm = (USHORT)Round((float)(wm->usUnitsPerEm) * font->fontinfo.Builtin.scale); + sAscender = (SHORT)Round((float)(wm->sAscender) * font->fontinfo.Builtin.scale); + sDescender = (SHORT)Round((float)(wm->sDescender) * font->fontinfo.Builtin.scale); + sLineGap = (SHORT)Round((float)(wm->sLineGap) * font->fontinfo.Builtin.scale); + usWinAscent = (USHORT)Round((float)(wm->usWinAscent) * font->fontinfo.Builtin.scale); + usWinDescent = (USHORT)Round((float)(wm->usWinDescent) * font->fontinfo.Builtin.scale); + sAvgCharWidth = (SHORT)Round((float)(wm->sAvgCharWidth) * font->fontinfo.Builtin.scale); tm->tmAscent = (LONG)usWinAscent; tm->tmDescent = (LONG)usWinDescent; @@ -125,7 +125,7 @@ font->fontinfo.Builtin.scale *= (float)wm->usUnitsPerEm / 1000.0; - tm->tmMaxCharWidth = (LONG)round( + tm->tmMaxCharWidth = (LONG)Round( (afm->FontBBox.urx - afm->FontBBox.llx) * font->fontinfo.Builtin.scale); font->underlinePosition = afm->UnderlinePosition * font->fontinfo.Builtin.scale; Index: include/config.h.in =================================================================== RCS file: /home/wine/wine/include/config.h.in,v retrieving revision 1.125 diff -u -r1.125 config.h.in --- include/config.h.in 30 Jul 2002 02:44:20 -0000 1.125 +++ include/config.h.in 30 Jul 2002 23:51:17 -0000 @@ -611,6 +611,9 @@ /* Define if the X libraries support XVideo */ #undef HAVE_XVIDEO +/* Define to 1 if you have the `_fstat' function. */ +#undef HAVE__FSTAT + /* Define to 1 if you have the `_lwp_create' function. */ #undef HAVE__LWP_CREATE @@ -623,6 +626,9 @@ /* Define to 1 if you have the `_snprintf' function. */ #undef HAVE__SNPRINTF +/* Define to 1 if you have the `_stat' function. */ +#undef HAVE__STAT + /* Define to 1 if you have the `_stricmp' function. */ #undef HAVE__STRICMP @@ -635,6 +641,15 @@ /* Define if stdcall symbols need to be decorated */ #undef NEED_STDCALL_DECORATION +/* Define if <netdb.h> defines getnetbyaddr() */ +#undef NETDB_H_DEFINES_GETNETBYADDR + +/* Define if <netdb.h> defines getnetbyname() */ +#undef NETDB_H_DEFINES_GETNETBYNAME + +/* Define if <netdb.h> defines struct netent */ +#undef NETDB_H_DEFINES_STRUCT_NETENT + /* Define to disable all debug messages. */ #undef NO_DEBUG_MSGS @@ -699,6 +714,9 @@ /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS + +/* Define if <sys/types.h> defines _off_t */ +#undef SYS_TYPES_H_DEFINES__OFF_T /* Define to 1 if the X Window System is missing or not being used. */ #undef X_DISPLAY_MISSING Index: include/msvcrt/sys/stat.h =================================================================== RCS file: /home/wine/wine/include/msvcrt/sys/stat.h,v retrieving revision 1.4 diff -u -r1.4 stat.h --- include/msvcrt/sys/stat.h 27 Apr 2002 21:14:50 -0000 1.4 +++ include/msvcrt/sys/stat.h 30 Jul 2002 23:51:17 -0000 @@ -9,6 +9,7 @@ #define __WINE_SYS_STAT_H #define __WINE_USE_MSVCRT +#include "config.h" #include "msvcrt/sys/types.h" @@ -34,7 +35,11 @@ short st_uid; short st_gid; _dev_t st_rdev; +#ifndef SYS_TYPES_H_DEFINES__OFF_T _off_t st_size; +#else + MSVCRT(_off_t) st_size; +#endif /* SYS_TYPES_H_DEFINES__OFF_T */ MSVCRT(time_t) st_atime; MSVCRT(time_t) st_mtime; MSVCRT(time_t) st_ctime; @@ -59,9 +64,20 @@ extern "C" { #endif +#ifndef HAVE__FSTAT int _fstat(int,struct _stat*); +#else +int MSVCRT(_fstat)(int,struct _stat*); +#endif /* HAVE__FSTAT */ + int _fstati64(int,struct _stati64*); + +#ifndef HAVE__STAT int _stat(const char*,struct _stat*); +#else +int MSVCRT(_stat)(const char*,struct _stat*); +#endif /* HAVE__STAT */ + int _stati64(const char*,struct _stati64*); int _wstat(const WCHAR*,struct _stat*); Index: include/msvcrt/sys/types.h =================================================================== RCS file: /home/wine/wine/include/msvcrt/sys/types.h,v retrieving revision 1.4 diff -u -r1.4 types.h --- include/msvcrt/sys/types.h 10 Mar 2002 00:02:38 -0000 1.4 +++ include/msvcrt/sys/types.h 30 Jul 2002 23:51:17 -0000 @@ -21,6 +21,7 @@ #define __WINE_SYS_TYPES_H #define __WINE_USE_MSVCRT +#include "config.h" #ifdef USE_MSVCRT_PREFIX #define MSVCRT(x) MSVCRT_##x @@ -31,7 +32,11 @@ typedef unsigned int _dev_t; typedef unsigned short _ino_t; +#ifndef SYS_TYPES_H_DEFINES__OFF_T typedef int _off_t; +#else +typedef int MSVCRT(_off_t); +#endif /* SYS_TYPES_H_DEFINES__OFF_T */ typedef long MSVCRT(time_t); Index: include/wine/port.h =================================================================== RCS file: /home/wine/wine/include/wine/port.h,v retrieving revision 1.28 diff -u -r1.28 port.h --- include/wine/port.h 29 Jul 2002 23:55:40 -0000 1.28 +++ include/wine/port.h 30 Jul 2002 23:51:17 -0000 @@ -61,14 +61,16 @@ typedef int ssize_t; #endif -#if !defined(HAVE_GETNETBYADDR) && !defined(HAVE_GETNETBYNAME) +#if !defined(HAVE_GETNETBYADDR) && !defined(HAVE_GETNETBYNAME) &&\ + !defined(NETDB_H_DEFINES_STRUCT_NETENT) struct netent { char *n_name; char **n_aliases; int n_addrtype; unsigned long n_net; }; -#endif /* !defined(HAVE_GETNETBYADDR) && !defined(HAVE_GETNETBYNAME) */ +#endif /* !defined(HAVE_GETNETBYADDR) && !defined(HAVE_GETNETBYNAME) && + !defined(NETDB_H_DEFINES_STRUCT_NETENT) */ #if !defined(HAVE_GETPROTOBYNAME) && !defined(HAVE_GETPROTOBYNUMBER) struct protoent { @@ -186,13 +188,13 @@ int clone(int (*fn)(void *arg), void *stack, int flags, void *arg); #endif /* !defined(HAVE_CLONE) && defined(linux) */ -#ifndef HAVE_GETNETBYADDR +#if !defined(HAVE_GETNETBYADDR) && !defined(NETDB_H_DEFINES_GETNETBYADDR) struct netent *getnetbyaddr(unsigned long net, int type); -#endif /* defined(HAVE_GETNETBYNAME) */ +#endif /* !defined(HAVE_GETNETBYNAME) && !defined(NETDB_H_DEFINES_GETNETBYADDR) */ -#ifndef HAVE_GETNETBYNAME +#if !defined(HAVE_GETNETBYNAME) && !defined(NETDB_H_DEFINES_GETNETBYNAME) struct netent *getnetbyname(const char *name); -#endif /* defined(HAVE_GETNETBYNAME) */ +#endif /* !defined(HAVE_GETNETBYNAME) && !defined(NETDB_H_DEFINES_GETNETBYNAME) */ #ifndef HAVE_GETPAGESIZE size_t getpagesize(void); Index: library/Makefile.in =================================================================== RCS file: /home/wine/wine/library/Makefile.in,v retrieving revision 1.15 diff -u -r1.15 Makefile.in --- library/Makefile.in 20 Jun 2002 23:21:27 -0000 1.15 +++ library/Makefile.in 30 Jul 2002 23:51:17 -0000 @@ -33,7 +33,11 @@ $(RANLIB) $@ libwine.dll: $(OBJS) - $(DLLWRAP) $(DLLWRAPFLAGS) --export-all --implib libwine.a -o libwine.dll $(OBJS) -lmsvcrt + if echo $(CFLAGS) | grep -i mingw > /dev/null 2>&1; then \ + $(DLLWRAP) $(DLLWRAPFLAGS) --export-all --implib libwine.a -o libwine.dll $(OBJS) -lmsvcrt; \ + else \ + $(DLLWRAP) $(DLLWRAPFLAGS) --export-all --implib libwine.a -o libwine.dll $(OBJS); \ + fi .PHONY: install_so install_a install_dll Index: tsx11/Makefile.in =================================================================== RCS file: /home/wine/wine/tsx11/Makefile.in,v retrieving revision 1.14 diff -u -r1.14 Makefile.in --- tsx11/Makefile.in 14 Jun 2002 23:48:28 -0000 1.14 +++ tsx11/Makefile.in 30 Jul 2002 23:51:18 -0000 @@ -37,7 +37,7 @@ $(RANLIB) $@ libwine_tsx11.dll: $(OBJS) - $(DLLWRAP) $(DLLWRAPFLAGS) --export-all --implib libwine_tsx11.a -o libwine_tsx11.dll $(OBJS) + $(DLLWRAP) $(DLLWRAPFLAGS) --export-all --implib libwine_tsx11.a -o libwine_tsx11.dll $(OBJS) $(EXTRALIBS) .PHONY: install_so install_a