diff --git a/configure.ac b/configure.ac index b6ed92cb3..86153ec81 100644 --- a/configure.ac +++ b/configure.ac @@ -420,7 +420,7 @@ case $host_os in darwin*) AC_DEFINE(CSRG_BASED, 1, [System is BSD-like]) ;; - cygwin*) + cygwin*|mingw*) CFLAGS="$CFLAGS -DFD_SETSIZE=256" ;; esac @@ -1904,7 +1904,7 @@ if test "x$XWIN" = xyes; then XWIN_SERVER_NAME=Xming AC_DEFINE(RELOCATE_PROJECTROOT,1,[Make PROJECT_ROOT relative to the xserver location]) AC_DEFINE(HAS_WINSOCK,1,[Use Windows sockets]) - XWIN_SYS_LIBS=-lws2_32 + XWIN_SYS_LIBS="-lpthread -lws2_32" ;; esac diff --git a/doc/c-extensions b/doc/c-extensions index eb33e272b..4a9006150 100644 --- a/doc/c-extensions +++ b/doc/c-extensions @@ -35,7 +35,7 @@ The server will not build if your toolchain does not support these extensions. * interleaved code and declarations: { foo = TRUE; int bar; do_stuff(); } -Use of OS and library facilities throughout the X server tree +Use of library facilities throughout the X server tree ------------------------------------------------------------- Non-OS-dependent code can assume facilities at least as good as @@ -44,6 +44,17 @@ be C99, but even gcc+glibc doesn't implement that yet. Unix-like systems are assumed to be at least as good as UNIX03. +Note that there are two Windows ports, Cygwin and MinGW: +- Cygwin is more or less like Linux. +- MinGW is more restrictive. Windows does not provide the required +POSIX facilities, so some non-OS-dependent code is stubbed out or +has an alternate implementation if WIN32 is defined. Code that +needs to be portable to Windows should be careful to, well, be portable. + + +Required OS facilities +------------------------------------------------------------- + Linux systems must be at least 2.4 or later. As a practical matter though, 2.4 kernels never receive any testing. Use 2.6 already. @@ -51,11 +62,7 @@ TODO: Solaris. TODO: *BSD. -Code that needs to be portable to Windows should be careful to, -well, be portable. Note that there are two Windows ports, cygwin and -mingw. Cygwin is more or less like Linux, but mingw is a bit more -restrictive. TODO: document which versions of Windows we actually care -about. +Windows-dependent code assumes at least NT 5.1. OSX support is generally limited to the most recent version. Currently that means 10.5. diff --git a/hw/xwin/winprefs.c b/hw/xwin/winprefs.c index dbc5b5228..6cbd7ad80 100644 --- a/hw/xwin/winprefs.c +++ b/hw/xwin/winprefs.c @@ -645,6 +645,7 @@ winPrefsLoadPreferences(char *path) if (path) prefFile = fopen(path, "r"); +#ifdef __CYGWIN__ else { char defaultPrefs[] = "MENU rmenu {\n" @@ -656,6 +657,7 @@ winPrefsLoadPreferences(char *path) path = "built-in default"; prefFile = fmemopen(defaultPrefs, strlen(defaultPrefs), "r"); } +#endif if (!prefFile) { ErrorF("LoadPreferences: %s not found\n", path); diff --git a/os/utils.c b/os/utils.c index 04bcbc61f..3c520add5 100644 --- a/os/utils.c +++ b/os/utils.c @@ -235,6 +235,19 @@ OsSignal(int sig, OsSigHandlerPtr handler) #define LOCK_PREFIX "/.X" #define LOCK_SUFFIX "-lock" +#if !defined(WIN32) || defined(__CYGWIN__) +#define LOCK_SERVER +#endif + +#ifndef LOCK_SERVER +void +LockServer(void) +{} + +void +UnlockServer(void) +{} +#else /* LOCK_SERVER */ static Bool StillLocking = FALSE; static char LockFile[PATH_MAX]; static Bool nolock = FALSE; @@ -382,6 +395,7 @@ UnlockServer(void) (void) unlink(LockFile); } } +#endif /* LOCK_SERVER */ /* Force connections to close on SIGHUP from init */ @@ -503,7 +517,9 @@ UseMsg(void) #ifdef RLIMIT_STACK ErrorF("-ls int limit stack space to N Kb\n"); #endif +#ifdef LOCK_SERVER ErrorF("-nolock disable the locking mechanism\n"); +#endif ErrorF("-nolisten string don't listen on protocol\n"); ErrorF("-noreset don't reset after last client exists\n"); ErrorF("-background [none] create root window with no background\n"); @@ -664,7 +680,9 @@ ProcessCommandLine(int argc, char *argv[]) if (++i < argc) { displayfd = atoi(argv[i]); display = NULL; +#ifdef LOCK_SERVER nolock = TRUE; +#endif } else UseMsg(); @@ -744,6 +762,7 @@ ProcessCommandLine(int argc, char *argv[]) UseMsg(); } #endif +#ifdef LOCK_SERVER else if (strcmp(argv[i], "-nolock") == 0) { #if !defined(WIN32) && !defined(__CYGWIN__) if (getuid() != 0) @@ -753,6 +772,7 @@ ProcessCommandLine(int argc, char *argv[]) #endif nolock = TRUE; } +#endif else if (strcmp(argv[i], "-nolisten") == 0) { if (++i < argc) { if (_XSERVTransNoListen(argv[i]))