Index: Imakefile =================================================================== RCS file: /cvs/xorg/xc/Imakefile,v retrieving revision 1.3 diff -u -r1.3 Imakefile --- Imakefile 24 May 2004 19:06:57 -0000 1.3 +++ Imakefile 10 Nov 2004 17:35:18 -0000 @@ -46,7 +46,7 @@ #define IHaveSpecialMakefileTarget -#ifndef Win32Architecture +#if !defined(Win32Architecture) || defined(mingwArchitecture) VerifyOS:: @echo "" @echo Building on OSName "("OSMajorVersion"."OSMinorVersion"."OSTeenyVersion")." Index: config/cf/Imake.cf =================================================================== RCS file: /cvs/xorg/xc/config/cf/Imake.cf,v retrieving revision 1.5 diff -u -r1.5 Imake.cf --- config/cf/Imake.cf 18 Oct 2004 14:26:35 -0000 1.5 +++ config/cf/Imake.cf 10 Nov 2004 17:35:18 -0000 @@ -693,12 +693,27 @@ # undef SVR4 #endif /* Oki */ -#ifdef WIN32 +#if defined(WIN32) && !defined(__GNUC__) # define MacroIncludeFile # define MacroFile Win32.cf # define Win32Architecture #endif /* WIN32 */ +#if defined(WIN32) && defined(__GNUC__) +#define MacroIncludeFile +#define MacroFile mingw.cf +#define Win32Architecture +#define mingwArchitecture +#define i386Architecture +#undef i386 +#undef i486 +#undef i586 +#undef i686 +#undef __i386__ +#undef _X86_ +#undef __MINGW32__ +#endif /* CYGWIN */ + #ifdef linux # define MacroIncludeFile # define MacroFile linux.cf Index: config/cf/Imakefile =================================================================== RCS file: /cvs/xorg/xc/config/cf/Imakefile,v retrieving revision 1.4 diff -u -r1.4 Imakefile --- config/cf/Imakefile 13 Oct 2004 16:47:28 -0000 1.4 +++ config/cf/Imakefile 10 Nov 2004 17:35:18 -0000 @@ -37,6 +37,7 @@ bsdLib.rules \ cde.rules \ cygwin.rules \ +mingw.rules \ darwinLib.rules \ gnuLib.rules \ hpLib.rules \ @@ -71,6 +72,7 @@ bsdLib.tmpl \ cde.tmpl \ cygwin.tmpl \ +mingw.tmpl \ darwinLib.tmpl \ hpLib.tmpl \ gnuLib.tmpl \ @@ -97,6 +99,7 @@ OpenBSD.cf \ Oki.cf \ cygwin.cf \ +mingw.cf \ Win32.cf \ apollo.cf \ bsd.cf \ Index: config/cf/mingw.cf =================================================================== RCS file: config/cf/mingw.cf diff -N config/cf/mingw.cf --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ config/cf/mingw.cf 10 Nov 2004 17:35:18 -0000 @@ -0,0 +1,442 @@ +/* MingGW vendor strings and version */ +#include "xorgversion.def" + +#ifndef CygxVersionMajor +# define CygxVersionMajor XORG_VERSION_MAJOR +#endif +#ifndef CygxVersionMinor +# define CygxVersionMinor XORG_VERSION_MINOR +#endif +#ifndef CygxVersionPatch +# define CygxVersionPatch XORG_VERSION_PATCH +#endif +#ifndef CygxVersionSnap +# define CygxVersionSnap XORG_VERSION_SNAP +#endif +#ifndef CygxVersionServer +# define CygxVersionServer 0 +#endif + +#ifndef CygxVersion +# define CygxVersion (10000000 * CygxVersionMajor + 100000 * CygxVersionMinor + 1000 * CygxVersionPatch + CygxVersionSnap) +#endif + +#ifndef CygxVersionString +# define CygxVersionString `echo CygxVersionMajor CygxVersionMinor CygxVersionPatch CygxVersionSnap%CygxVersionServer| sed -e 's/ /./g' -e 's/%/-/g'` +#endif + +#ifndef CygxManVersionString +# define CygxManVersionString `echo CygxVersionMajor CygxVersionMinor CygxVersionPatch CygxVersionSnap| sed -e 's/ /./g' -e 's/^/Version\\\ /'` +#endif + +#ifndef XVendorString +# define XVendorString "The Cygwin/X Project" +#endif +#ifndef XVendorRelease +# define XVendorRelease CygxVersion +#endif +#ifndef XVendorManVersionString +# define XVendorManVersionString CygxManVersionString +#endif +#ifndef XVendorManNameString +# define XVendorManNameString "Cygwin/X" +#endif +#ifndef XVendorContact +# define XVendorContact "cygwin-xfree@cygwin.com" +#endif + +/* Operating system strings and version */ +#ifndef OSName +# define OSName Cygwin +#endif +#ifndef OSVendor +# define OSVendor Red Hat Inc. +#endif +#ifndef OSMajorVersion +# define OSMajorVersion DefaultOSMajorVersion +#endif +#ifndef OSMinorVersion +# define OSMinorVersion DefaultOSMinorVersion +#endif +#ifndef OSTeenyVersion +# define OSTeenyVersion DefaultOSTeenyVersion +#endif + +#ifndef ProjectRoot +# define ProjectRoot /usr/X11R6 +#endif + +#if !CrossCompiling +# define HasGcc2 YES +#endif /* !CrossCompiling */ +#define HasGcc2ForCplusplus YES +#define GccUsesGas YES +#define UseGas YES +#define GnuCpp YES +#define UnixCpp /* Just a flag that affects Concat macros in Imake.rules */ +#define HasShadowPasswd NO +#define HasLibCrypt YES +#define HasPutenv YES +#define HasFchown NO +#define HasPoll NO +#if (OSMajorVersion > 1) || (OSMajorVersion == 1 && OSMinorVersion >= 5) +# define HasStrlcat YES +#endif +#define HasShm NO + +#define HasSnprintf YES +#ifndef HasMakefileSafeInclude +# define HasMakefileSafeInclude YES +#endif + +#define Hastcl NO +#define Hastk NO + +#define HasSockets NO +#define GzipFontCompression YES +#define HasZlib NO + +/* We don't need -lm */ +#define MathLibrary /**/ + +/* + * /lib/libtermcap.a doesn't have tgetent, which is needed for + * xc/programs/xterm/resize.exe + */ +#define TermcapLibrary -lncurses.dll + +#define AvoidNullMakeCommand YES +#define StripInstalledPrograms YES +#define CompressAllFonts YES +#define Malloc0ReturnsNull NO +#define NeedConstPrototypes YES +#define NeedFunctionPrototypes YES +#define NeedNestedPrototypes YES +#define NeedVarargsPrototypes YES +#define NeedWidePrototypes NO +#define SetTtyGroup YES +#define ExpandManNames YES +#define HasDlopen NO +#define HasGnuMake YES +#define UseGccMakeDepend NO +#define ThreadedX YES +#define HasThreadSafeAPI YES +#if !CrossCompiling +#define CaseSensitiveFileSystem NO +#endif +#define HasWChar32 YES +#define HasBasename NO /* basename() in libc */ + +#define LnCmd ln -s +#ifndef CcCmd +# define CcCmd gcc +#endif /* CcCmd */ +#ifndef CplusplusCmd +# define CplusplusCmd g++ +#endif /* CplusplusCmd */ +#ifndef AsCmd +# define AsCmd as +#endif /* AsCmd */ + +#define GccGasOption -DGCCUSESGAS +#define AsmDefines -DUSE_GAS -DGCCUSESGAS + +#ifndef LdCmd +# define LdCmd gcc -lautomode +#endif /* LdCmd */ + +#define MkdirHierCmd mkdir -p + +#ifndef CppCmd +# define CppCmd cpp +#endif /* CppCmd */ +#ifndef YaccCmd +# define YaccCmd bison -y +#endif /* YaccCmd */ + +#define LexCmd flex -l +#define LexLib -lfl +#define HasFlex YES +#ifndef CrossCompileDir +# ifndef HasExpat +# define HasExpat YES +# endif +# ifndef HasFreetype2 +# define HasFreetype2 YES +# endif +# ifndef HasFontconfig +# define HasFontconfig YES +# endif +#endif + +/* Cygwin-specific Windows resource compiler command */ +#ifdef CrossCompileDir +# ifndef WindresCmd +# define WindresCmd Concat3(CrossCompileDir,/,windres) +# endif +#else +# ifndef WindresCmd +# define WindresCmd windres +# endif +#endif + +#define PreProcessCmd CcCmd -E + +#ifndef PostIncDir +# ifdef CrossCompileDir +# define PostIncDir `CrossCompileDir/CcCmd --print-libgcc-file-name | sed 's,\\\\,/,g' | sed 's,libgcc.a,include,'` +# else +# define PostIncDir `CcCmd --print-libgcc-file-name | sed 's,\\\\,/,g' | sed 's,libgcc.a,include,'` +# endif +#endif +#ifndef ExtraIncDir +# ifdef CrossCompileDir +# define ExtraIncDir CrossCompileDir/../include/w32api +# else +# define ExtraIncDir /usr/include/w32api +# endif +#endif + +#ifndef BourneShell +/* + * This will cause builds/installs to terminate on errors, as on other + * platforms. + */ +#define BourneShell /bin/sh -e +#endif + +#define LdCombineFlags -r + +#ifndef DefaultCCOptions +# define DefaultCCOptions -Wall -Wpointer-arith +#endif + +/* Cygwin 1.5.x now includes alloca */ +#if OSMinorVersion >= 5 +# define AllocateLocalDefines -DINCLUDE_ALLOCA_H +#else +# define AllocateLocalDefines -DNO_ALLOCA +#endif + +#ifndef OptimizedCDebugFlags +# define OptimizedCDebugFlags -O2 -fno-strength-reduce +#endif + +/* + * -DFD_SETSIZE=256 is needed for xfs and the xserver. cygwin defines the + * FD_SETSIZE as 64 but some code expects it to be larger. + */ +#define StandardDefines -D__i386__ -DWIN32_LEAN_AND_MEAN -DX_LOCALE \ + -D_X86_ -DWIN32 -D_XOPEN_SOURCE \ + -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE \ + -D_SVID_SOURCE -D_GNU_SOURCE -DFD_SETSIZE=1024 \ + -DXResExtension +#define XawI18nDefines -DHAS_WCHAR_H -DHAS_WCTYPE_H \ + -DHAS_ISW_FUNCS -DNO_WIDEC_H +#define StandardCppOptions -traditional + +/* Cygwin shared memory requires cygipc package or cygserver. */ +#if UseCygIPC +# if ThreadedX +# define StandardCppDefines -DHAS_THREADS -DHAS_SHM StandardDefines +# else +# define StandardCppDefines -DHAS_SHM StandardDefines +# endif +#else +# if ThreadedX +# define StandardCppDefines -DHAS_THREADS StandardDefines +# else +# define StandardCppDefines StandardDefines +# endif +#endif + +#define BuildIPv6 NO +#define BuildLBX NO + +#ifndef BuildServersOnly +# define BuildServersOnly YES +#endif + +/* XWin Server specific build flags */ +#ifndef GlxUseWindows +# define GlxUseWindows NO +#endif +#ifndef BuildXWinClipboard +# define BuildXWinClipboard NO +#endif +#ifndef BuildXWinEmulatePseudo +# define BuildXWinEmulatePseudo NO +#endif +#ifndef BuildXWinMultiWindow +# define BuildXWinMultiWindow NO +#endif +#ifndef BuildXWinMultiWindowExtWM +# define BuildXWinMultiWindowExtWM NO +#endif +#ifndef BuildXWinNativeGDI +# define BuildXWinNativeGDI NO +#endif +#ifndef BuildXWinPrimaryFB +# define BuildXWinPrimaryFB NO +#endif +#ifndef BuildXWinUpdateStats +# define BuildXWinUpdateStats NO +#endif +#ifndef BuildXWinXF86Config +# define BuildXWinXF86Config NO +#endif + +/* XWin specific build flags - 1st order dependency */ +#if BuildXWinMultiWindowExtWM && !defined(BuildWindowsWMLibrary) +# define BuildWindowsWMLibrary YES +#elif !defined(BuildWindowsWMLibrary) +# define BuildWindowsWMLibrary NO +#endif /* BuildXWinMultiWindowExtWM && BuildWindowsWMLibrary */ + +/* XWin Server specific defines */ +#if BuildXWinClipboard +# define XWinClipboardDefines -DXWIN_CLIPBOARD +#else +# define XWinClipboardDefines +#endif /* BuildXWinClipboard */ +#if BuildXWinEmulatePseudo +# define XWinEmulatePseudoDefines -DXWIN_EMULATEPSEUDO +#else +# define XWinEmulatePseudoDefines +#endif /* BuildXWinEmulatePseudo */ +#if BuildXWinMultiWindow +# define XWinMultiWindowDefines -DXWIN_MULTIWINDOW +#else +# define XWinMultiWindowDefines +#endif /* BuildXWinMultiWindow */ +#if BuildXWinMultiWindowExtWM +# define BuildRootless YES +# define XWinMultiWindowExtWMDefines -DXWIN_MULTIWINDOWEXTWM +#else /* BuildXWinMultiWindowExtWM */ +# define XWinMultiWindowExtWMDefines +#endif /* BuildXWinMultiWindowExtWM */ +#if BuildXWinNativeGDI +# define XWinNativeGDIDefines -DXWIN_NATIVEGDI +#else +# define XWinNativeGDIDefines +#endif /* BuildXWinNativeGDI */ +#if BuildXWinPrimaryFB +# define XWinPrimaryFBDefines -DXWIN_PRIMARYFB +#else +# define XWinPrimaryFBDefines +#endif /* BuildXWinPrimaryFB */ +#if BuildXWinUpdateStats +# define XWinUpdateStatsDefines -DXWIN_UPDATESTATS +#else +# define XWinUpdateStatsDefines +#endif /* BuildXWinUpdateStats */ +#if BuildXWinXF86Config +# define XWinXF86ConfigDefines -DXWIN_XF86CONFIG +#else +# define XWinXF86ConfigDefines +#endif /* BuildXWinXF86Config */ + +/* + * XFree86Server is defined for the w32api headers, which protects some + * colliding names with #ifdef XFree86Server. + */ +#define XWinServerDefines -DAVOID_GLYPHBLT -DPIXPRIV -DSINGLEDEPTH \ + -DXFree86Server \ + -DX_BYTE_ORDER=ByteOrder \ + XvExtensionDefines \ + XWinXF86ConfigDefines XWinNativeGDIDefines \ + XWinPrimaryFBDefines \ + XWinEmulatePseudoDefines \ + XWinUpdateStatsDefines \ + XWinClipboardDefines XWinMultiWindowDefines \ + XWinMultiWindowExtWMDefines \ + -DDDXBEFORERESET +#define ServerOSDefines -DDDXTIME -DDDXOSINIT \ + -DDDXOSVERRORF -DDDXOSFATALERROR +#define XkbServerDefines -DXKB_ALWAYS_USES_SOFT_REPEAT +#define ServerExtraDefines -DGCCUSESGAS XWinServerDefines \ + AllocateLocalDefines +#define ConnectionFlags -DTCPCONN +#define ExtraLibraries +#define InstUidFlags -m 4711 +#define UseRgbTxt YES +#define ExtraFilesToClean *.obj *.orig *.rej junk.c *.exe *.dll *.lib *~ + +/* Flags for which the default in X11.tmpl is not what we want. */ +#ifndef BuildXinerama +# define BuildXinerama NO /* Not supported by XWin Server */ +#endif +#ifndef BuildXIE +# define BuildXIE NO /* Deprecated */ +#endif +#ifndef BuildDPMS +# define BuildDPMS NO /* Not supported by XWin Server */ +#endif +#ifndef BuildXInputExt +# define BuildXInputExt YES /* Not enabled by default */ +#endif +#ifndef BuildRandR +# define BuildRandR YES /* Not supported by XWin Server */ +#endif +#ifndef BuildXF86BigfontExt +# define BuildXF86BigfontExt NO +#endif +#ifndef BuildGlxExt +# define BuildGlxExt NO +#endif +#ifndef BuildXprintLib +# define BuildXprintLib NO +#endif +#ifndef BuildXprint +# define BuildXprint NO +#endif +#ifndef BuildXterm +# define BuildXterm NO /* Built separately on Cygwin */ +#endif +#ifndef BuildXResExt +# define BuildXResExt YES /* Not enabled by default */ +#endif +#ifndef BuildFreeType +# define BuildFreeType YES /* Not enabled by default */ +#endif +#ifndef BuildXTrueType +# define BuildXTrueType YES /* Not enabled by default */ +#endif + +/* Server build rules */ +#ifndef XnestServer +# define XnestServer NO +#endif +#ifndef XprtServer +# define XprtServer NO +#endif +#ifndef XVirtualFramebufferServer +# define XVirtualFramebufferServer NO +#endif +#ifndef XWinServer +# define XWinServer YES +#endif + +/* + * --unix option of Cygwin make fools the standard MakeFlagsToShellFlags macro + */ +#define MakeFlagsToShellFlags(makeflags,shellcmd) \ + for flag in ${MAKEFLAGS} ''; do \ @@\ + case "$$flag" in *=*) ;;--*) ;; *[makeflags]*) shellcmd;; esac; done + +#define MakeNamedTargetSubdir(dir,flags,subname)\ + $(MAKE) -C dir $(MFLAGS) $(PARALLELMFLAGS) flags subname + +#ifndef ManSuffix +# define ManSuffix 1 +#endif + +#ifndef XtransFailSoft +#define XtransFailSoft YES +#endif + +#include + +#if CrossCompiling +#include +#endif Index: config/cf/mingw.rules =================================================================== RCS file: config/cf/mingw.rules diff -N config/cf/mingw.rules --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ config/cf/mingw.rules 10 Nov 2004 17:35:18 -0000 @@ -0,0 +1,458 @@ +/* + * Cygwin shared library rules (DLL versions) + */ + +#define HasSharedLibraries YES +#define NeedLibInsideFlag NO +#define ForceNormalLib NO +#ifndef SharedLibX11 +# define SharedLibX11 YES +#endif +#ifndef NormalLibX11 +# define NormalLibX11 NO +#endif +#define SharedLibXaw YES +#define SharedLibXmu YES +#define SharedLibXt YES +#define SharedLibFont NO +#define SharedLibXaw7 YES +#define SharedLibXaw6 YES +#define SharedLibSM YES +#define SharedLibICE YES +#define SharedLibXext YES +#define SharedLibXie YES +#define SharedLibXi YES +#define SharedLibPex YES +#define SharedLibXtst YES +#define SharedOldX YES +#define SharedLibXp YES +#define SharedLibGlx YES +#define SharedLibDps YES +#define SharedLibDpsTk YES +#define SharedLibGlu YES +#define SharedLibWindowsWM NO +#define SharedLibFreetype2 NO +#define SharedLibxkbfile NO +#ifndef SharedDataSeparation +#define SharedDataSeparation NO +#endif + +#ifndef SharedCodeDef +#define SharedCodeDef /**/ +#endif +#ifndef SharedLibraryDef +#define SharedLibraryDef /**/ +#endif +#ifndef ShLibIncludeFile +#define ShLibIncludeFile +#endif +#ifndef SharedLibraryLoadFlags +#define SharedLibraryLoadFlags -dll /**/ +#endif +#ifndef PositionIndependentCFlags +#define PositionIndependentCFlags -D_DLL +#endif +#ifndef PositionIndependentCplusplusFlags +#define PositionIndependentCplusplusFlags -D_DLL +#endif +#ifndef UseExportLists +#define UseExportLists YES +#endif + +#define SharedLibraryName(libname, rev) \ +Concat3(lib,libname,-$(shell echo rev|sed s=\\..*==).dll) + +#define ImportLibraryName(libname, rev) \ +Concat3(lib,libname,-$(shell echo rev|sed s=\\..*==).dll.a) + +#define ShortImportLibraryName(libname, rev) \ +Concat3(lib,libname,.dll.a) + +/* + * SharedDepLibraryTarget - generate rules to create a shared library. + */ + +#ifndef SharedDepLibraryTarget +# ifdef UseInstalled +# ifndef LinkBuildSonameLibrary +# define LinkBuildSonameLibrary(lib) +# endif +# else /* !UseInstalled */ +# ifndef LinkBuildSonameLibrary +# define LinkBuildSonameLibrary(lib) (RemoveFile($(BUILDLIBDIR)/lib); @@\ + cd $(BUILDLIBDIR); $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/lib .) +# endif +# endif /* UseInstalled */ + + +/* + * SharedDepLibraryTarget + */ + +#define SharedDepLibraryTarget(libname,rev,deplist,solist,down,up) @@\ +AllTarget(SharedLibraryName(libname,rev)) @@\ + @@\ +SharedLibraryName(libname,rev): deplist @@\ + RemoveFile(ImportLibraryName(libname,rev)) @@\ + RemoveFile(SharedLibraryName(libname,rev)) @@\ + MakeDLL(libname,solist,rev) @@\ + LinkBuildLibrary(ImportLibraryName(libname,rev)) @@\ + LinkImportLibrary(ImportLibraryName(libname,rev),LibraryTargetName(libname)) @@\ + LinkBuildDLL(SharedLibraryName(libname,rev)) @@\ + @@\ +clean:: @@\ + RemoveFile(ImportLibraryName(libname,rev)) @@\ + RemoveFile(SharedLibraryName(libname,rev)) @@\ + +#endif /* SharedDepLibraryTarget */ + +/* + * SharedDepCplusplusLibraryTarget - generate rules to create a shared library. + */ + +#ifndef SharedDepCplusplusLibraryTarget +# ifdef UseInstalled +# ifndef LinkBuildSonameLibrary +# define LinkBuildSonameLibrary(lib) +# endif +# else /* !UseInstalled */ +# ifndef LinkBuildSonameLibrary +# define LinkBuildSonameLibrary(lib) (RemoveFile($(BUILDLIBDIR)/lib); @@\ + cd $(BUILDLIBDIR); $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/lib .) +# endif +# endif /* UseInstalled */ + + +/* + * SharedDepCplusplusLibraryTarget + */ + +#define SharedDepCplusplusLibraryTarget(libname,rev,deplist,solist,down,up) @@\ +AllTarget(SharedLibraryName(libname,rev)) @@\ + @@\ +SharedLibraryName(libname,rev): deplist @@\ + RemoveFile(ImportLibraryName(libname,rev)) @@\ + RemoveFile(SharedLibraryName(libname,rev)) @@\ + MakeCplusplusDLL(libname,solist,rev) @@\ + LinkBuildLibrary(ImportLibraryName(libname,rev)) @@\ + LinkImportLibrary(ImportLibraryName(libname,rev),LibraryTargetName(libname)) @@\ + LinkBuildDLL(SharedLibraryName(libname,rev)) @@\ + @@\ +clean:: @@\ + RemoveFile(ImportLibraryName(libname,rev)) @@\ + RemoveFile(SharedLibraryName(libname,rev)) @@\ + +#endif /* SharedDepCplusplusLibraryTarget */ + + +/* + * SharedDepModuleTarget + */ + +#ifndef SharedDepModuleTarget +#define SharedDepModuleTarget(name,deps,solist) @@\ +AllTarget(name) @@\ + @@\ +name: deps @@\ + $(CC) -o $@ $(SHLIBLDFLAGS) solist $(REQUIREDLIBS) BaseShLibReqs @@\ + @@\ +clean:: @@\ + RemoveFile(name) +#endif /* SharedDepModuleTarget */ + + +/* + * SharedLibraryDataTarget - generate rules to create shared data file + */ + +#ifndef SharedLibraryDataTarget +#define SharedLibraryDataTarget(libname,rev,salist) +#endif + + +/* + * InstallSharedLibraryData - generate rules to install the shared library data + */ + +#ifndef InstallSharedLibraryData +#define InstallSharedLibraryData(libname,rev,dest) +#endif /* InstallSharedLibraryData */ + +/* + * MakeDllProg + */ + +#define MakeDLLProg(libname,solist,prog,rev) @@\ + prog -shared -Wl,--out-implib=ImportLibraryName(libname,rev) -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc -Wl,--exclude-libs,ALL -o SharedLibraryName(libname,rev) solist $(REQUIREDLIBS) + +/* + * MakeDll + */ + +#define MakeDLL(libname,solist,rev) @@\ + MakeDLLProg(libname,solist,$(CC),rev) + +/* + * MakeCplusplusDll + */ + +#define MakeCplusplusDLL(libname,solist,rev) @@\ + MakeDLLProg(libname,solist,$(CXX),rev) + + + +/* + * SharedLibraryTarget + */ + +#define SharedLibraryTarget(libname,rev,solist,down,up) @@\ +AllTarget(SharedLibraryName(libname,rev)) @@\ + @@\ +SharedLibraryName(libname,rev): solist @@\ + RemoveFile(ImportLibraryName(libname,rev)) @@\ + RemoveFile(SharedLibraryName(libname,rev)) @@\ + MakeDLL(libname,solist,rev) @@\ + LinkBuildLibrary(ImportLibraryName(libname,rev)) @@\ + LinkImportLibrary(ImportLibraryName(libname,rev),LibraryTargetName(libname)) @@\ + LinkBuildDLL(SharedLibraryName(libname,rev)) @@\ +clean:: @@\ + RemoveFile(ImportLibraryName(libname,rev)) @@\ + RemoveFile(SharedLibraryName(libname,rev)) @@\ + + +/* + * InstallLink + */ + +#ifndef InstallLink +#define InstallLink(step, file, link, dest) @@\ +step:: @@\ + MakeDir($(DESTDIR)dest) @@\ + $(LN) -sf file $(DESTDIR)dest/link +#endif + +/* + * InstallSharedLibrary + */ + +#define InstallSharedLibrary(libname,rev,dest) @@\ +InstallTarget(install,ImportLibraryName(libname,rev),$(INSTLIBFLAGS),$(USRLIBDIR)) @@\ +InstallTarget(install,SharedLibraryName(libname,rev),$(INSTBINFLAGS),$(BINDIR)) @@\ +InstallLink(install,ImportLibraryName(libname,rev),ShortImportLibraryName(libname,rev),$(USRLIBDIR)) + + +/* + * ProgramTargetName - This can be simply 'target' or 'target.exe' when + * building on Cygwin proper, as Cygwin automatically appends .exe to compiled + * executables and make, rm, ln, etc. will automatically search for a file + * with .exe appended if the raw file name cannot be found. However, + * building with a cross compiler requires 'target.exe', as the cross + * compiler doesn't know to append .exe, nor do the cross compiler tools + * know to search for files with .exe appended if the raw file name cannot + * be found. + */ + +#define ProgramTargetName(target) Concat(target,.exe) + + +/* + * HostProgramTargetName - Don't add .exe if cross-compiling. + */ + +#ifndef HostProgramTargetName +# if CrossCompiling +# define HostProgramTargetName(target) target +# else +# define HostProgramTargetName(target) ProgramTargetName(target) +# endif +#endif + + +/* + * LinkBuildDLL - Cygwin only rule, similar to LinkBuildModule. + * Unfortunately, we have to create a copy of each DLL in xc/exports/bin; + * linking doesn't work, the executables (e.g. xkbcomp) will report + * that they cannot find DLLs (e.g. libX11.dll). + */ + +#ifdef UseInstalled +#define LinkBuildDLL(lib) $(_NULLCMD_) +#else +#define LinkBuildDLL(lib) MakeDir($(BUILDBINDIR)) @@\ + RemoveFile($(BUILDBINDIR)/lib) @@\ + cd $(BUILDBINDIR) && $(CP) $(BUILDBINTOP)/$(CURRENT_DIR)/lib . +#endif + +#ifndef LinkImportLibrary +#ifdef UseInstalled +#define LinkImportLibrary(lib, importlib) $(_NULLCMD_) +#else +#define LinkImportLibrary(lib, importlib) MakeDir($(BUILDLIBDIR)) @@\ + RemoveFile($(BUILDLIBDIR)/importlib) @@\ + cd $(BUILDLIBDIR) && $(LN) lib importlib +#endif +#endif /* LinkImportLibrary */ + + +/* + * LinkBuildBinary - This rule normally creates a link in xc/exports/bin + * to a binary, but we create an actual copy of the binary. + * Creating a link causes the DLLs that the binary depend on, such as + * libX11.dll, not to be found. Copying the binary causes the runtime + * directory to be xc/exports/bin, which is the location of the DLLs, thus, + * the DLLs can now be found by the binary. Phew... + * + * Note that sometimes the binary is not an executable. One example + * is the rgb binary file. + * + * Passing -p preserves the attributes as the date and prevents useless + * rebuilds. + * + * ProgramTargetName is passed to LinkBuildBinary if the binary + * is actually an executable; thus, we do not wrap the binary name + * with ProgramTargetName here. + */ + +#ifndef LinkBuildBinary +#define LinkBuildBinary(binary) @@\ +all:: binary @@\ + MakeDir($(BUILDBINDIR)) @@\ + RemoveFile($(BUILDBINDIR)/binary) @@\ + cd $(BUILDBINDIR) && $(CP) -p $(BUILDBINTOP)/$(CURRENT_DIR)/binary . +#endif /* LinkBuildBinary */ + +/* + * ProfiledRelocatableTarget - generate rules to produce a profiled + * relocatable object file instead of a library. Differs from Imake.rules + * by passing '--oformat pe-i386' to ld. + */ + +#ifndef ProfiledRelocatableTarget +#define ProfiledRelocatableTarget(objname,objlist) @@\ +AllTarget(Concat(objname,_p.Osuf)) @@\ + @@\ +Concat(objname,_p.Osuf): objlist $(EXTRALIBRARYDEPS) @@\ + RemoveFile($@) @@\ + $(LD) -X -r --oformat pe-i386 objlist -o $@ + +#endif /* ProfiledRelocatableTarget */ + + +/* + * DebuggedRelocatableTarget - generate rules to produce a debuggable + * relocatable object file instead of a library. Differs from Imake.rules + * by passing '--oformat pe-i386' to ld. + */ + +#ifndef DebuggedRelocatableTarget +#define DebuggedRelocatableTarget(objname,objlist) @@\ +AllTarget(Concat(objname,_d.Osuf)) @@\ + @@\ +Concat(objname,_d.Osuf): objlist $(EXTRALIBRARYDEPS) @@\ + RemoveFile($@) @@\ + $(LD) -X -r --oformat pe-i386 objlist -o $@ + +#endif /* DebuggedRelocatableTarget */ + + +/* + * DependDependencyStatement - Imake.rules wraps $(DEPEND) in + * ProgramTargetName(), which causes cross compiling to think that + * $(DEPEND) hasn't been built, as $(DEPEND) is a host tool, and should + * not be wrapped with ProgramTargetName(). Perhaps there should be + * a HostProgramTargetName()... + */ + +#ifndef DependDependencyStatement +#if HasMakefileSafeInclude +#define DependDependencyStatement() @@\ +DependFileName:: $(DEPEND) +#else +#define DependDependencyStatement() @@\ +depend:: $(DEPEND) +#endif +#endif + + +/* + * DependDependency - Imake.rules wraps $(DEPEND) in ProgramTargetName(). + * This doesn't work when cross compiling, see the locally defined + * DependDependencyStatement comment (above) for more information. + */ + +#ifndef DependDependency +#ifdef UseInstalled +#define DependDependency() /**/ +#else +#define DependDependency() @@\ +DependDependencyStatement() @@\ + @@\ +NoCmpScript($(DEPEND)) @@\ + @@\ +$(DEPEND): @@\ + @echo "checking $@ over in $(DEPENDSRC) first..."; \ @@\ + cd $(DEPENDSRC) && $(MAKE) makedependonly; \ @@\ + echo "okay, continuing in $(CURRENT_DIR)" + +#endif /* UseInstalled */ +#endif /* DependDependency */ + + +/* + * ImakeDependency - Imake.rules wraps $(IMAKE) in ProgramTargetName(), + * which doesn't work when cross compiling, as imake is supposed to be a + * host program. See the locally defined DependDependencyStatement + * comment (above) for more information. + */ + +#ifndef ImakeDependency +#ifdef UseInstalled +#define ImakeDependency(target) /**/ +#else +#define ImakeDependency(target) @@\ +target:: $(IMAKE) @@\ + @@\ +NoCmpScript($(IMAKE) $(IMAKE).Osuf) @@\ + @@\ +$(IMAKE) $(IMAKE).Osuf: @@\ + -@(cd $(IMAKESRC) && if [ -f Makefile ]; then \ @@\ + echo "checking $@ in $(IMAKESRC) first..."; $(MAKE) imakeonly; else \ @@\ + echo "bootstrapping $@ from Makefile.ini in $(IMAKESRC) first..."; \ @@\ + $(MAKE) -f Makefile.ini BOOTSTRAPCFLAGS="$(BOOTSTRAPCFLAGS)"; fi; \ @@\ + echo "okay, continuing in $(CURRENT_DIR)") +#endif /* UseInstalled */ +#endif /* ImakeDependency */ + + +/* + * ResourceObjectRule - Build a Windows resouce file (.res) into + * an object file (.o) that can be linked in with the executable + * or library being built. + */ + +#ifndef ResourceObjectRule +#define ResourceObjectRule(basename,depends,options) @@\ +AllTarget(basename.RESsuf) @@\ +basename.RESsuf: basename.RCsuf depends @@\ + RemoveFile($@) @@\ + ClearmakeOSName \ @@\ + WindresCmd basename.RCsuf options -O coff -o basename.RESsuf @@\ +clean:: @@\ + RemoveFiles(basename.RESsuf) + +#endif /* ResourceObjectRule */ + +/* The arglist can get quite long. Make sure we can delete it though */ +#ifndef MakeFonts +# define MakeFonts() @@\ +all:: $(OBJS) @@\ + @@\ +MakeFontsDir($(OBJS)) @@\ + @@\ +clean:: @@\ + find -name "*.pcf" -o -name "*.pcf.Z" -o -name "*.pcf.gz" | xargs -r rm +#endif /* MakeFonts */ + +#ifndef IncludeMakefile +#define IncludeMakefile(file) @@sinclude file +#endif Index: config/cf/mingw.tmpl =================================================================== RCS file: config/cf/mingw.tmpl diff -N config/cf/mingw.tmpl --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ config/cf/mingw.tmpl 10 Nov 2004 17:35:18 -0000 @@ -0,0 +1,79 @@ +XCOMM $XFree86: xc/config/cf/cygwin.tmpl,v 3.18 2003/10/19 08:27:05 herrb Exp $ + +#define SharedX11Reqs -lwsock32 +#define SharedXlibi18nReqs $(LDPRELIB) $(XONLYLIB) +#define SharedOldXReqs $(LDPRELIB) $(XONLYLIB) +#define SharedXReqs $(XTOOLLIB) $(XPLIB) $(XLIB) $(LDPOSTLIBS) +#define SharedXtReqs $(LDPRELIB) $(SMLIB) $(ICELIB) $(XONLYLIB) +#define SharedXawReqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(EXTRAXAWREQS) $(XLIB) +#define SharedXaw7Reqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XLIB) +#define SharedXaw6Reqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XLIB) +#define SharedXmuReqs $(LDPRELIB) $(XTOOLLIB) $(XLIB) +#define SharedXextReqs $(LDPRELIB) $(XONLYLIB) +#define SharedXiReqs $(LDPRELIB) $(XLIB) +#define SharedPexReqs $(LDPRELIB) $(XONLYLIB) +#define SharedXtstReqs $(LDPRELIB) $(XLIB) +#define SharedXieReqs $(LDPRELIB) $(XONLYLIB) +#define SharedSMReqs $(LDPRELIB) $(ICELIB) +#define SharedXpReqs $(LDPRELIB) $(XAUTHLIB) $(XLIB) +#define SharedXvReqs $(LDPRELIB) $(XLIB) +#define SharedGLReqs $(LDPRELIB) $(XLIB) +#define SharedGLUReqs $(LDPRELIB) $(XLIB) $(GLXLIB) +#define SharedXfontReqs $(LDPRELIB) $(FONTSTUBLIB) GzipLibrary $(FREETYPE2LIB) +#define SharedFontencReqs $(LDPRELIB) GzipLibrary +#define SharedXxf86vmReqs $(LDPRELIB) $(XLIB) +#define SharedXxf86miscReqs $(LDPRELIB) $(XLIB) +#define SharedXpmReqs $(LDPRELIB) $(XLIB) +#define SharedXxf86dgaReqs $(LDPRELIB) $(XLIB) +#define SharedDPSReqs $(LDPRELIB) $(SMLIB) $(ICELIB) $(XTOOLLIB) $(XLIB) +#define SharedDPSTKReqs $(LDPRELIB) $(SMLIB) $(ICELIB) $(XTOOLLIB) $(DPSLIB) $(XLIB) +#define SharedXrenderReqs $(LDPRELIB) $(XLIB) +#define SharedpsresReqs $(LDPRELIB) $(SMLIB) $(ICELIB) $(XTOOLLIB) $(XLIB +#define SharedXResReqs $(LDPRELIB) $(XLIB) +#define SharedXfontcacheReqs $(LDPRELIB) $(XLIB) +#define SharedXineramaReqs $(LDPRELIB) $(XLIB) +/* + * We don't build Xss + * #define SharedXssReqs $(LDPRELIB) $(XLIB) + */ +#define SharedXvMCReqs $(LDPRELIB) $(XLIB) +#define SharedXxf86dgaReqs $(LDPRELIB) $(XLIB) +#define SharedXxf86miscReqs $(LDPRELIB) $(XLIB) +#define SharedXxf86vmReqs $(LDPRELIB) $(XLIB) +#define SharedxkbfileReqs $(LDPRELIB) $(XONLYLIB) +#define SharedxkbuiReqs $(LDPRELIB) $(XKBFILELIB) $(XONLYLIB) +#define SharedXmuuReqs $(LDPRELIB) $(XTOOLLIB) $(XLIB) +#define SharedXrandrReqs $(LDPRELIB) $(XRENDERLIB) $(XLIB) +#define SharedXcursorReqs $(LDPRELIB) $(XRENDERLIB) $(XLIB) +#define SharedXfixesReqs $(LDPRELIB) $(XLIB) +#define SharedXdamageReqs $(LDPRELIB) $(XFIXESLIB) $(XLIB) +#define SharedXcompositeReqs $(LDPRELIB) $(XDAMAGELIB) $(XFIXESLIB) $(XLIB) +#define SharedXevieReqs $(LDPRELIB) $(XLIB) + +#ifndef FixupLibReferences +# define FixupLibReferences() @@\ +XMULIBONLY = -lXmu @@\ +XMULIB = $(XMULIBONLY) $(XTOOLLIB) $(XLIB) +#endif + +#ifndef XawClientLibs +# define XawClientLibs $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XPMLIB) $(EXTRAXAWCLIENTLIBS) $(XLIB) +#endif + + +/* + * Suffix for Windows resource source files + */ + +#ifndef RCsuf +# define RCsuf rc +#endif + + +/* + * Suffix for Windows resource compiled files + */ + +#ifndef RESsuf +# define RESsuf res +#endif Index: config/imake/imake.c =================================================================== RCS file: /cvs/xorg/xc/config/imake/imake.c,v retrieving revision 1.4 diff -u -r1.4 imake.c --- config/imake/imake.c 9 Oct 2004 22:04:13 -0000 1.4 +++ config/imake/imake.c 10 Nov 2004 17:35:19 -0000 @@ -1422,8 +1422,12 @@ { #if defined CROSSCOMPILE || ( !defined(WIN32) && !defined(__UNIXOS2__) ) #ifdef CROSSCOMPILE +#ifdef __GNUC__ + if (1) +#else if ((sys != win32) && (sys != emx)) #endif +#endif { # if (defined(DEFAULT_OS_NAME) || defined(DEFAULT_OS_MAJOR_REV) || \ defined(DEFAULT_OS_MINOR_REV) || defined(DEFAULT_OS_TEENY_REV)) Index: config/imake/imakemdep.h =================================================================== RCS file: /cvs/xorg/xc/config/imake/imakemdep.h,v retrieving revision 1.6 diff -u -r1.6 imakemdep.h --- config/imake/imakemdep.h 19 Oct 2004 13:50:06 -0000 1.6 +++ config/imake/imakemdep.h 10 Nov 2004 17:35:19 -0000 @@ -143,12 +143,16 @@ #endif #ifdef WIN32 +#ifdef __GNUC__ +#define imake_ccflags "-D__STDC__" +#else #if _MSC_VER < 1000 #define imake_ccflags "-nologo -batch -D__STDC__" #else #define imake_ccflags "-nologo -D__STDC__" #endif #endif +#endif #ifdef __uxp__ #define imake_ccflags "-DSVR4 -DANSICPP" @@ -256,8 +260,12 @@ #endif #ifdef WIN32 #define USE_CC_E +#ifdef __GNUC__ +#define DEFAULT_CC "gcc" +#else #define DEFAULT_CC "cl" #endif +#endif #ifdef apollo #define DEFAULT_CPP "/usr/lib/cpp" #endif @@ -597,10 +605,12 @@ #endif #ifdef WIN32 "-DWIN32", +#ifndef __GNUC__ "-nologo", #if _MSC_VER < 1000 "-batch", #endif +#endif "-D__STDC__", #endif #ifdef NCR Index: config/util/Imakefile =================================================================== RCS file: /cvs/xorg/xc/config/util/Imakefile,v retrieving revision 1.3 diff -u -r1.3 Imakefile --- config/util/Imakefile 26 Jun 2004 12:50:32 -0000 1.3 +++ config/util/Imakefile 10 Nov 2004 17:35:19 -0000 @@ -10,7 +10,7 @@ EXPORTLISTGEN = exportlistgen #endif -#if defined(Win32Architecture) +#if defined(Win32Architecture) && !defined(CrossCompiling) CMKDIRHIER = mkdirhier.exe #endif @@ -94,7 +94,7 @@ #endif #endif -#if defined(Win32Architecture) +#if defined(Win32Architecture) && !defined(CrossCompiling) AllTarget(ProgramTargetName(mkdirhier)) SimpleProgramTarget_3(mkdirhier) #endif Index: include/Imakefile =================================================================== RCS file: /cvs/xorg/xc/include/Imakefile,v retrieving revision 1.3 diff -u -r1.3 Imakefile --- include/Imakefile 9 Aug 2004 22:37:21 -0000 1.3 +++ include/Imakefile 10 Nov 2004 17:35:19 -0000 @@ -18,7 +18,7 @@ SUBDIRS = bitmaps extensions fonts $(GLXDIR) $(DPSDIR) #ifdef Win32Architecture -EXTRA_HEADERS = Xw32defs.h Xwinsock.h +EXTRA_HEADERS = Xw32defs.h Xwinsock.h Xwindows.h #endif HEADERS = DECkeysym.h \ Index: include/Xos.h =================================================================== RCS file: /cvs/xorg/xc/include/Xos.h,v retrieving revision 1.2 diff -u -r1.2 Xos.h --- include/Xos.h 23 Apr 2004 18:43:05 -0000 1.2 +++ include/Xos.h 10 Nov 2004 17:35:19 -0000 @@ -211,11 +211,12 @@ #define _POSIX_SOURCE #elif defined(WIN32) #include -#if !defined(_WINSOCKAPI_) && !defined(_WILLWINSOCK_) +#if !defined(_WINSOCKAPI_) && !defined(_WILLWINSOCK_) && !defined(_TIMEVAL_DEFINED) struct timeval { long tv_sec; /* seconds */ long tv_usec; /* and microseconds */ }; +#define _TIMEVAL_DEFINED #endif #include #define gettimeofday(t) \ Index: include/Xpoll.h =================================================================== RCS file: /cvs/xorg/xc/include/Xpoll.h,v retrieving revision 1.4 diff -u -r1.4 Xpoll.h --- include/Xpoll.h 25 Jun 2004 09:15:35 -0000 1.4 +++ include/Xpoll.h 10 Nov 2004 17:35:19 -0000 @@ -191,7 +191,7 @@ #define XFD_ORSET(dst,b1,b2) { \ u_int __i; \ - XFD_COPYSET(b1,dst); \ + if (dst != b1) XFD_COPYSET(b1,dst); \ for (__i = 0; __i < XFD_SETCOUNT(b2) ; __i++) { \ if (!FD_ISSET(XFD_FD(b2,__i), dst)) \ FD_SET(XFD_FD(b2,__i), dst); \ Index: include/Xthreads.h =================================================================== RCS file: /cvs/xorg/xc/include/Xthreads.h,v retrieving revision 1.2 diff -u -r1.2 Xthreads.h --- include/Xthreads.h 23 Apr 2004 18:43:05 -0000 1.2 +++ include/Xthreads.h 10 Nov 2004 17:35:19 -0000 @@ -94,6 +94,7 @@ #else /* !SVR4 */ #ifdef WIN32 #define BOOL wBOOL +#define INT32 wINT32 #ifdef Status #undef Status #define Status wStatus @@ -103,6 +104,7 @@ #undef Status #define Status int #endif +#undef INT32 #undef BOOL typedef DWORD xthread_t; typedef DWORD xthread_key_t; Index: include/Xw32defs.h =================================================================== RCS file: /cvs/xorg/xc/include/Xw32defs.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 Xw32defs.h --- include/Xw32defs.h 14 Nov 2003 16:48:42 -0000 1.1.1.1 +++ include/Xw32defs.h 10 Nov 2004 17:35:19 -0000 @@ -3,6 +3,10 @@ #ifndef _XW32DEFS_H #define _XW32DEFS_H +#ifdef __GNUC__ /* mingw is more close to unix than msvc */ +typedef char *caddr_t; +#define lstat stat +#else typedef char *caddr_t; #define access _access @@ -70,5 +74,5 @@ #define X_OK 1 #define W_OK 2 #define R_OK 4 - +#endif #endif Index: include/Xwindows.h =================================================================== RCS file: include/Xwindows.h diff -N include/Xwindows.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ include/Xwindows.h 10 Nov 2004 17:35:19 -0000 @@ -0,0 +1,66 @@ +/* $Xorg$ */ +/* + +Copyright 1996, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- +ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL- +ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization from +The Open Group. + +*/ + +/* + * This header file has for sole purpose to allow to include windows.h + * without getting any name conflicts with our code. + * Conflicts come from the fact that including windows.h actually pulls + * in the whole Windows API... + */ + +#undef _XFree86Server +#ifdef XFree86Server +#define _XFree86Server +#undef XFree86Server +#endif + +#define BOOL wBOOL +#define INT32 wINT32 +#undef Status +#define Status wStatus +#define ATOM wATOM +#define BYTE wBYTE +#define FreeResource wFreeResource +#include +#undef Status +#define Status int +#undef BYTE +#undef BOOL +#undef INT32 +#undef ATOM +#undef FreeResource +#undef CreateWindowA +#undef RT_FONT +#undef RT_CURSOR + +#ifdef _XFree86Server +#define XFree86Server +#undef _XFree86Server +#endif + Index: include/Xwinsock.h =================================================================== RCS file: /cvs/xorg/xc/include/Xwinsock.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 Xwinsock.h --- include/Xwinsock.h 14 Nov 2003 16:48:42 -0000 1.1.1.1 +++ include/Xwinsock.h 10 Nov 2004 17:35:19 -0000 @@ -34,17 +34,33 @@ * in the whole Windows API... */ +#undef _XFree86Server +#ifdef XFree86Server +#define _XFree86Server +#undef XFree86Server +#endif + #define BOOL wBOOL +#define INT32 wINT32 #undef Status #define Status wStatus #define ATOM wATOM +#define BYTE wBYTE #define FreeResource wFreeResource #include #undef Status #define Status int +#undef BYTE #undef BOOL +#undef INT32 #undef ATOM #undef FreeResource #undef CreateWindowA #undef RT_FONT #undef RT_CURSOR + +#ifdef _XFree86Server +#define XFree86Server +#undef _XFree86Server +#endif + Index: lib/Xau/AuFileName.c =================================================================== RCS file: /cvs/xorg/xc/lib/Xau/AuFileName.c,v retrieving revision 1.2 diff -u -r1.2 AuFileName.c --- lib/Xau/AuFileName.c 23 Apr 2004 18:43:36 -0000 1.2 +++ lib/Xau/AuFileName.c 10 Nov 2004 17:35:19 -0000 @@ -49,7 +49,7 @@ if (!name) { #ifdef WIN32 (void) strcpy (dir, "/users/"); - if (name = getenv("USERNAME")) { + if ((name = getenv("USERNAME"))) { (void) strcat (dir, name); name = dir; } Index: lib/Xdmcp/GenKey.c =================================================================== RCS file: /cvs/xorg/xc/lib/Xdmcp/GenKey.c,v retrieving revision 1.2 diff -u -r1.2 GenKey.c --- lib/Xdmcp/GenKey.c 23 Apr 2004 18:43:41 -0000 1.2 +++ lib/Xdmcp/GenKey.c 10 Nov 2004 17:35:20 -0000 @@ -51,6 +51,12 @@ #define srandom srand48 #define random lrand48 #endif +#ifdef WIN32 +#include +#define srandom srand +#define random rand +#define getpid(x) _getpid(x) +#endif void XdmcpGenerateKey (XdmAuthKeyPtr key) Index: lib/font/fc/fsio.c =================================================================== RCS file: /cvs/xorg/xc/lib/font/fc/fsio.c,v retrieving revision 1.2 diff -u -r1.2 fsio.c --- lib/font/fc/fsio.c 23 Apr 2004 18:44:21 -0000 1.2 +++ lib/font/fc/fsio.c 10 Nov 2004 17:35:20 -0000 @@ -119,7 +119,11 @@ do { if (i == TRANS_TRY_CONNECT_AGAIN) +#ifndef WIN32 sleep(1); +#else + Sleep(1000); +#endif i = _FontTransConnect(trans_conn,servername); } while ((i == TRANS_TRY_CONNECT_AGAIN) && (retries-- > 0)); Index: lib/font/fontfile/bufio.c =================================================================== RCS file: /cvs/xorg/xc/lib/font/fontfile/bufio.c,v retrieving revision 1.2 diff -u -r1.2 bufio.c --- lib/font/fontfile/bufio.c 23 Apr 2004 18:44:21 -0000 1.2 +++ lib/font/fontfile/bufio.c 10 Nov 2004 17:35:20 -0000 @@ -122,7 +122,7 @@ BufFilePtr BufFileOpenRead (int fd) { -#ifdef __UNIXOS2__ +#if defined(__UNIXOS2__) || defined (WIN32) /* hv: I'd bet WIN32 has the same effect here */ setmode(fd,O_BINARY); #endif @@ -149,7 +149,7 @@ { BufFilePtr f; -#ifdef __UNIXOS2__ +#if defined(__UNIXOS2__) || defined(WIN32) /* hv: I'd bet WIN32 has the same effect here */ setmode(fd,O_BINARY); #endif Index: lib/font/fontfile/dirfile.c =================================================================== RCS file: /cvs/xorg/xc/lib/font/fontfile/dirfile.c,v retrieving revision 1.2 diff -u -r1.2 dirfile.c --- lib/font/fontfile/dirfile.c 23 Apr 2004 18:44:21 -0000 1.2 +++ lib/font/fontfile/dirfile.c 10 Nov 2004 17:35:20 -0000 @@ -73,11 +73,11 @@ #ifdef FONTDIRATTRIB /* Check for font directory attributes */ -#ifndef __UNIXOS2__ +#if !defined(__UNIXOS2__) && !defined(WIN32) if ((ptr = strchr(directory, ':'))) { #else - /* OS/2 path might start with a drive letter, don't clip this */ - if (ptr = strchr(directory+2, ':')) { + /* OS/2 and WIN32 path might start with a drive letter, don't clip this */ + if ((ptr = strchr(directory+2, ':'))) { #endif strncpy(dir_path, directory, ptr - directory); dir_path[ptr - directory] = '\0'; @@ -91,12 +91,19 @@ if (dir_file[strlen(dir_file) - 1] != '/') strcat(dir_file, "/"); strcat(dir_file, FontDirFile); - file = fopen(dir_file, "r"); + file = fopen(dir_file, "rt"); if (file) { Bool found_font = FALSE; - + +#ifndef WIN32 if (fstat (fileno(file), &statb) == -1) +#else + if (stat (dir_file, &statb) == -1) +#endif + { + fclose(file); return BadFontPath; + } count = fscanf(file, "%d\n", &i); if ((count == EOF) || (count != 1)) { fclose(file); @@ -113,7 +120,7 @@ MAXFONTFILENAMELEN-1, MAXFONTNAMELEN-1); while ((count = fscanf(file, format, file_name, font_name)) != EOF) { -#ifdef __UNIXOS2__ +#if defined(__UNIXOS2__) || defined(WIN32) /* strip any existing trailing CR */ for (i=0; i +#endif /* * Map FPE functions to renderer functions @@ -49,9 +52,9 @@ FontFileNameCheck (char *name) { #ifndef NCD -#ifdef __UNIXOS2__ +#if defined(__UNIXOS2__) || defined(WIN32) /* OS/2 uses D:/... as a path name for fonts, so accept this as a valid - * path if it starts with a letter and a colon + * path if it starts with a letter and a colon. Same applies for WIN32 */ if (isalpha(*name) && name[1]==':') return TRUE; Index: lib/xtrans/Xtrans.c =================================================================== RCS file: /cvs/xorg/xc/lib/xtrans/Xtrans.c,v retrieving revision 1.3 diff -u -r1.3 Xtrans.c --- lib/xtrans/Xtrans.c 17 Jul 2004 01:13:31 -0000 1.3 +++ lib/xtrans/Xtrans.c 10 Nov 2004 17:35:21 -0000 @@ -726,7 +726,11 @@ #else #if (defined(AIXV3) || defined(uniosu) || defined(WIN32) || defined(__UNIXOS2__) || defined(__QNX__)) && defined(FIONBIO) { +#ifdef WIN32 + u_long arg; +#else int arg; +#endif arg = 1; /* IBM TCP/IP understands this option too well: it causes TRANS(Read) to fail * eventually with EWOULDBLOCK */ Index: lib/xtrans/Xtransdnet.c =================================================================== RCS file: /cvs/xorg/xc/lib/xtrans/Xtransdnet.c,v retrieving revision 1.2 diff -u -r1.2 Xtransdnet.c --- lib/xtrans/Xtransdnet.c 23 Apr 2004 18:44:27 -0000 1.2 +++ lib/xtrans/Xtransdnet.c 10 Nov 2004 17:35:21 -0000 @@ -525,7 +525,11 @@ PRMSG (2,"DNETBytesReadable(%x,%d,%x)\n", ciptr, ciptr->fd, pend); #ifdef WIN32 - return ioctlsocket ((SOCKET) ciptr->fd, FIONREAD, (u_long *) pend); + { + int ret = ioctlsocket ((SOCKET) ciptr->fd, FIONREAD, (u_long *) pend); + errno = WSAGetLastError(); + return ret; + } #else return ioctl(ciptr->fd, FIONREAD, (char *)pend); #endif /* WIN32 */ @@ -539,7 +543,11 @@ PRMSG (2,"DNETRead(%d,%x,%d)\n", ciptr->fd, buf, size); #ifdef WIN32 - return recv ((SOCKET)ciptr->fd, buf, size, 0); + { + int ret = recv ((SOCKET)ciptr->fd, buf, size, 0); + errno = WSAGetLastError(); + return ret; + } #else return read (ciptr->fd, buf, size); #endif /* WIN32 */ @@ -553,7 +561,11 @@ PRMSG (2,"DNETWrite(%d,%x,%d)\n", ciptr->fd, buf, size); #ifdef WIN32 - return send ((SOCKET)ciptr->fd, buf, size, 0); + { + int ret = send ((SOCKET)ciptr->fd, buf, size, 0); + errno = WSAGetLastError(); + return ret; + } #else return write (ciptr->fd, buf, size); #endif /* WIN32 */ @@ -586,7 +598,15 @@ { PRMSG (2,"DNETDisconnect(%x,%d)\n", ciptr, ciptr->fd, 0); +#ifdef WIN32 + { + int ret = shutdown (ciptr->fd, 2); + errno = WSAGetLastError(); + return ret; + } +#else return shutdown (ciptr->fd, 2); /* disallow further sends and receives */ +#endif } @@ -596,7 +616,15 @@ { PRMSG (2,"DNETClose(%x,%d)\n", ciptr, ciptr->fd, 0); +#ifdef WIN32 + { + int ret = close (ciptr->fd); + errno = WSAGetLastError(); + return ret; + } +#else return close (ciptr->fd); +#endif } Index: lib/xtrans/Xtranssock.c =================================================================== RCS file: /cvs/xorg/xc/lib/xtrans/Xtranssock.c,v retrieving revision 1.2 diff -u -r1.2 Xtranssock.c --- lib/xtrans/Xtranssock.c 23 Apr 2004 18:44:27 -0000 1.2 +++ lib/xtrans/Xtranssock.c 10 Nov 2004 17:35:21 -0000 @@ -122,6 +122,7 @@ #define EPROTOTYPE WSAEPROTOTYPE #undef EWOULDBLOCK #define EWOULDBLOCK WSAEWOULDBLOCK +#define EINPROGRESS WSAEINPROGRESS #undef EINTR #define EINTR WSAEINTR #define X_INCLUDE_NETDB_H @@ -348,6 +349,9 @@ if (getsockname (ciptr->fd,(struct sockaddr *) socknamePtr, (void *)&namelen) < 0) { +#ifdef WIN32 + errno = WSAGetLastError(); +#endif PRMSG (1,"SocketINETGetAddr: getsockname() failed: %d\n", EGET(),0, 0); return -1; @@ -420,6 +424,9 @@ if (getpeername (ciptr->fd, (struct sockaddr *) socknamePtr, (void *)&namelen) < 0) { +#ifdef WIN32 + errno = WSAGetLastError(); +#endif PRMSG (1,"SocketINETGetPeerAddr: getpeername() failed: %d\n", EGET(), 0, 0); return -1; @@ -475,6 +482,9 @@ #endif #endif ) { +#ifdef WIN32 + errno = WSAGetLastError(); +#endif PRMSG (2, "SocketOpen: socket() failed for %s\n", Sockettrans2devtab[i].transname, 0, 0); @@ -876,9 +886,17 @@ return TRANS_CREATE_LISTENER_FAILED; } #ifdef SO_REUSEADDR +#ifdef WIN32 + Sleep(1000); +#else sleep (1); +#endif +#else +#ifdef WIN32 + Sleep(10000); #else sleep (10); +#endif #endif /* SO_REUSEDADDR */ } @@ -1233,6 +1251,9 @@ if ((newciptr->fd = accept (ciptr->fd, (struct sockaddr *) &sockname, (void *)&namelen)) < 0) { +#ifdef WIN32 + errno = WSAGetLastError(); +#endif PRMSG (1, "SocketINETAccept: accept() failed\n", 0, 0, 0); xfree (newciptr); *status = TRANS_ACCEPT_FAILED; @@ -2081,7 +2102,11 @@ *pend = 0L; /* FIONREAD only returns a short. Zero out upper bits */ #endif #ifdef WIN32 - return ioctlsocket ((SOCKET) ciptr->fd, FIONREAD, (u_long *) pend); + { + int ret = ioctlsocket ((SOCKET) ciptr->fd, FIONREAD, (u_long *) pend); + errno = WSAGetLastError(); + return ret; + } #else #if (defined(i386) && defined(SYSV) && !defined(sco)) || (defined(_SEQUENT_) && _SOCKET_VERSION == 1) return ioctl (ciptr->fd, I_NREAD, (char *) pend); @@ -2103,7 +2128,13 @@ PRMSG (2,"SocketRead(%d,%p,%d)\n", ciptr->fd, buf, size); #if defined(WIN32) || defined(__UNIXOS2__) - return recv ((SOCKET)ciptr->fd, buf, size, 0); + { + int ret = recv ((SOCKET)ciptr->fd, buf, size, 0); +#ifdef WIN32 + errno = WSAGetLastError(); +#endif + return ret; + } #else return read (ciptr->fd, buf, size); #endif /* WIN32 */ @@ -2117,7 +2148,13 @@ PRMSG (2,"SocketWrite(%d,%p,%d)\n", ciptr->fd, buf, size); #if defined(WIN32) || defined(__UNIXOS2__) - return send ((SOCKET)ciptr->fd, buf, size, 0); + { + int ret = send ((SOCKET)ciptr->fd, buf, size, 0); +#ifdef WIN32 + errno = WSAGetLastError(); +#endif + return ret; + } #else return write (ciptr->fd, buf, size); #endif /* WIN32 */ @@ -2150,7 +2187,15 @@ { PRMSG (2,"SocketDisconnect(%p,%d)\n", ciptr, ciptr->fd, 0); +#ifdef WIN32 + { + int ret = shutdown (ciptr->fd, 2); + errno = WSAGetLastError(); + return ret; + } +#else return shutdown (ciptr->fd, 2); /* disallow further sends and receives */ +#endif } @@ -2161,7 +2206,15 @@ { PRMSG (2,"SocketINETClose(%p,%d)\n", ciptr, ciptr->fd, 0); +#ifdef WIN32 + { + int ret = close (ciptr->fd); + errno = WSAGetLastError(); + return ret; + } +#else return close (ciptr->fd); +#endif } #endif /* TCPCONN */ Index: lib/xtrans/Xtransutil.c =================================================================== RCS file: /cvs/xorg/xc/lib/xtrans/Xtransutil.c,v retrieving revision 1.5 diff -u -r1.5 Xtransutil.c --- lib/xtrans/Xtransutil.c 27 Aug 2004 22:47:45 -0000 1.5 +++ lib/xtrans/Xtransutil.c 10 Nov 2004 17:35:21 -0000 @@ -472,7 +472,7 @@ PRMSG (2,"WSAStartup()\n", 0, 0, 0); - if (!wsadata.wVersion && WSAStartup(MAKEWORD(1,1), &wsadata)) + if (!wsadata.wVersion && WSAStartup(0x0101, &wsadata)) return 1; return 0; } @@ -498,6 +498,7 @@ #include #if !defined(S_IFLNK) && !defined(S_ISLNK) +#undef lstat #define lstat(a,b) stat(a,b) #endif @@ -523,6 +524,7 @@ } /* Dir doesn't exist. Try to create it */ +#ifndef WIN32 /* * 'sticky' bit requested: assume application makes * certain security implications. If effective user ID @@ -541,7 +543,9 @@ path, 0, 0); } } - +#endif + +#ifndef WIN32 if (mkdir(path, mode) == 0) { if (chmod(path, mode)) { PRMSG(1, "mkdir: ERROR: Mode of %s should be set to %04o\n", @@ -550,6 +554,9 @@ return -1; #endif } +#else + if (mkdir(path) == 0) { +#endif } else { PRMSG(1, "mkdir: ERROR: Cannot create %s\n", path, 0, 0);