# HG changeset patch # User Christian Kamm # Date 1231080568 -3600 # Node ID aa953cc960b6b0d2e62a849a85bed4cfb70b894c # Parent e70a0e7e2260815bf7a27081e79a4b5db6bbefb0 Apply BlueZeniX's patch for OpenSolaris compatibility. Fixes #158. diff -r e70a0e7e2260 -r aa953cc960b6 dmd/array.c --- a/dmd/array.c Sun Jan 04 15:39:34 2009 +0100 +++ b/dmd/array.c Sun Jan 04 15:49:28 2009 +0100 @@ -13,6 +13,10 @@ #include #include +#if (defined (__SVR4) && defined (__sun)) +#include +#endif + #if _MSC_VER || __MINGW32__ #include #endif diff -r e70a0e7e2260 -r aa953cc960b6 dmd/inifile.c --- a/dmd/inifile.c Sun Jan 04 15:39:34 2009 +0100 +++ b/dmd/inifile.c Sun Jan 04 15:49:28 2009 +0100 @@ -10,6 +10,10 @@ #include #include +#if (defined (__SVR4) && defined (__sun)) +#include +#endif + #include "root.h" #include "mem.h" diff -r e70a0e7e2260 -r aa953cc960b6 dmd/lexer.c --- a/dmd/lexer.c Sun Jan 04 15:39:34 2009 +0100 +++ b/dmd/lexer.c Sun Jan 04 15:49:28 2009 +0100 @@ -8,6 +8,8 @@ // in artistic.txt, or the GNU General Public License in gnu.txt. // See the included readme.txt for details. +#define __C99FEATURES__ 1 + /* Lexical Analyzer */ #include diff -r e70a0e7e2260 -r aa953cc960b6 dmd/mars.c --- a/dmd/mars.c Sun Jan 04 15:39:34 2009 +0100 +++ b/dmd/mars.c Sun Jan 04 15:49:28 2009 +0100 @@ -338,8 +338,10 @@ global.params.os = OSMacOSX; #elif __FreeBSD__ global.params.os = OSFreeBSD; +#elif defined (__SVR4) && defined (__sun) + global.params.os = OSSolaris; #else -#error Unsupported OS + #error Unsupported OS #endif /* linux */ assert(global.params.os != OSinvalid); @@ -694,6 +696,8 @@ global.params.os = OSMacOSX; else if(strcmp(p + 2, "FreeBSD") == 0) global.params.os = OSFreeBSD; + else if(strcmp(p + 2, "Solaris") == 0) + global.params.os = OSSolaris; else error("unrecognized target os '%s'", p + 2); } @@ -929,6 +933,11 @@ VersionCondition::addPredefinedGlobalIdent("Posix"); break; + case OSSolaris: + VersionCondition::addPredefinedGlobalIdent("solaris"); + VersionCondition::addPredefinedGlobalIdent("Posix"); + break; + default: assert(false && "Target OS not supported"); } diff -r e70a0e7e2260 -r aa953cc960b6 dmd/mars.h --- a/dmd/mars.h Sun Jan 04 15:39:34 2009 +0100 +++ b/dmd/mars.h Sun Jan 04 15:49:28 2009 +0100 @@ -61,7 +61,8 @@ OSLinux, OSWindows, OSMacOSX, - OSFreeBSD + OSFreeBSD, + OSSolaris, }; // Put command line switches in here diff -r e70a0e7e2260 -r aa953cc960b6 dmd/module.c --- a/dmd/module.c Sun Jan 04 15:39:34 2009 +0100 +++ b/dmd/module.c Sun Jan 04 15:49:28 2009 +0100 @@ -12,6 +12,10 @@ #include #include +#if (defined (__SVR4) && defined (__sun)) +#include +#endif + #if _MSC_VER || __MINGW32__ #include #endif diff -r e70a0e7e2260 -r aa953cc960b6 dmd/mtype.c --- a/dmd/mtype.c Sun Jan 04 15:39:34 2009 +0100 +++ b/dmd/mtype.c Sun Jan 04 15:49:28 2009 +0100 @@ -8,7 +8,13 @@ // in artistic.txt, or the GNU General Public License in gnu.txt. // See the included readme.txt for details. +#define __C99FEATURES__ 1 // Needed on Solaris for NaN and more #define __USE_ISOC99 1 // so signbit() gets defined + +#if (defined (__SVR4) && defined (__sun)) +#include +#endif + #include #include diff -r e70a0e7e2260 -r aa953cc960b6 dmd/root.c --- a/dmd/root.c Sun Jan 04 15:39:34 2009 +0100 +++ b/dmd/root.c Sun Jan 04 15:49:28 2009 +0100 @@ -14,6 +14,10 @@ #include #include +#if (defined (__SVR4) && defined (__sun)) +#include +#endif + #if _MSC_VER ||__MINGW32__ #include #include diff -r e70a0e7e2260 -r aa953cc960b6 runtime/internal/critical.c --- a/runtime/internal/critical.c Sun Jan 04 15:39:34 2009 +0100 +++ b/runtime/internal/critical.c Sun Jan 04 15:49:28 2009 +0100 @@ -75,7 +75,7 @@ /* ================================= linux ============================ */ -#if linux || __APPLE__ || __FreeBSD__ +#if linux || __APPLE__ || __FreeBSD__ || (defined(__SVR4) && defined (__sun)) #include #include diff -r e70a0e7e2260 -r aa953cc960b6 runtime/internal/eh.d --- a/runtime/internal/eh.d Sun Jan 04 15:39:34 2009 +0100 +++ b/runtime/internal/eh.d Sun Jan 04 15:49:28 2009 +0100 @@ -14,9 +14,11 @@ version(X86) { version(linux) version=X86_UNWIND; version(darwin) version=X86_UNWIND; + version(solaris) version=X86_UNWIND; } version(X86_64) { version(linux) version=X86_UNWIND; + version(solaris) version=X86_UNWIND; } private extern(C) void abort(); diff -r e70a0e7e2260 -r aa953cc960b6 runtime/internal/memory.d --- a/runtime/internal/memory.d Sun Jan 04 15:39:34 2009 +0100 +++ b/runtime/internal/memory.d Sun Jan 04 15:49:28 2009 +0100 @@ -73,6 +73,13 @@ /** * */ + +version( solaris ) { + version(X86_64) { + extern (C) void* _userlimit; + } +} + extern (C) void* rt_stackBottom() { version( Win32 ) @@ -110,6 +117,16 @@ // darwin has a fixed stack bottom return cast(void*) 0xc0000000; } + else version( solaris ) + { + version(X86_64) { + return _userlimit; + } + else { + // + return cast(void*) 0x8048000; + } + } else { static assert( false, "Operating system not supported." ); diff -r e70a0e7e2260 -r aa953cc960b6 runtime/internal/monitor.c --- a/runtime/internal/monitor.c Sun Jan 04 15:39:34 2009 +0100 +++ b/runtime/internal/monitor.c Sun Jan 04 15:49:28 2009 +0100 @@ -12,7 +12,7 @@ #include #if _WIN32 -#elif linux || __APPLE__ +#elif linux || __APPLE__ || (defined (__SVR4) && defined (__sun)) #define USE_PTHREADS 1 #else #endif