Apply BlueZeniX's patch for OpenSolaris compatibility. Fixes #158.

This commit is contained in:
Christian Kamm
2009-01-04 15:49:28 +01:00
parent 955df981f8
commit e7f750aee1
12 changed files with 57 additions and 4 deletions

View File

@@ -13,6 +13,10 @@
#include <string.h>
#include <assert.h>
#if (defined (__SVR4) && defined (__sun))
#include <alloca.h>
#endif
#if _MSC_VER || __MINGW32__
#include <malloc.h>
#endif

View File

@@ -10,6 +10,10 @@
#include <stdlib.h>
#include <ctype.h>
#if (defined (__SVR4) && defined (__sun))
#include <alloca.h>
#endif
#include "root.h"
#include "mem.h"

View File

@@ -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 <stdio.h>

View File

@@ -338,8 +338,10 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
VersionCondition::addPredefinedGlobalIdent("Posix");
break;
case OSSolaris:
VersionCondition::addPredefinedGlobalIdent("solaris");
VersionCondition::addPredefinedGlobalIdent("Posix");
break;
default:
assert(false && "Target OS not supported");
}

View File

@@ -61,7 +61,8 @@ enum OS
OSLinux,
OSWindows,
OSMacOSX,
OSFreeBSD
OSFreeBSD,
OSSolaris,
};
// Put command line switches in here

View File

@@ -12,6 +12,10 @@
#include <stdlib.h>
#include <assert.h>
#if (defined (__SVR4) && defined (__sun))
#include <alloca.h>
#endif
#if _MSC_VER || __MINGW32__
#include <malloc.h>
#endif

View File

@@ -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 <alloca.h>
#endif
#include <math.h>
#include <stdio.h>

View File

@@ -14,6 +14,10 @@
#include <stdint.h>
#include <assert.h>
#if (defined (__SVR4) && defined (__sun))
#include <alloca.h>
#endif
#if _MSC_VER ||__MINGW32__
#include <malloc.h>
#include <string>

View File

@@ -75,7 +75,7 @@ void _STD_critical_term()
/* ================================= linux ============================ */
#if linux || __APPLE__ || __FreeBSD__
#if linux || __APPLE__ || __FreeBSD__ || (defined(__SVR4) && defined (__sun))
#include <stdio.h>
#include <stdlib.h>

View File

@@ -14,9 +14,11 @@ import ldc.cstdarg;
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();

View File

@@ -73,6 +73,13 @@ private
/**
*
*/
version( solaris ) {
version(X86_64) {
extern (C) void* _userlimit;
}
}
extern (C) void* rt_stackBottom()
{
version( Win32 )
@@ -110,6 +117,16 @@ extern (C) void* rt_stackBottom()
// darwin has a fixed stack bottom
return cast(void*) 0xc0000000;
}
else version( solaris )
{
version(X86_64) {
return _userlimit;
}
else {
// <sys/vmparam.h>
return cast(void*) 0x8048000;
}
}
else
{
static assert( false, "Operating system not supported." );

View File

@@ -12,7 +12,7 @@
#include <assert.h>
#if _WIN32
#elif linux || __APPLE__
#elif linux || __APPLE__ || (defined (__SVR4) && defined (__sun))
#define USE_PTHREADS 1
#else
#endif