Mercurial > projects > ldc
changeset 637:29dc68c949b0
Applied the FreeBSD patch from Ralith, closes ticket #95 , slightly changed but basically the same. Thanx Ralith :)
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Thu, 02 Oct 2008 03:25:46 +0200 |
parents | 9fb1f559d9e9 |
children | 94b01f15814f |
files | dmd/constfold.c dmd/mars.c dmd/mars.h gen/linker.cpp gen/tollvm.cpp runtime/internal/critical.c tests/runtest |
diffstat | 7 files changed, 33 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/dmd/constfold.c Thu Oct 02 01:42:21 2008 +0200 +++ b/dmd/constfold.c Thu Oct 02 03:25:46 2008 +0200 @@ -487,6 +487,9 @@ c = fmodl(e1->toReal(), r2) + fmodl(e1->toImaginary(), r2) * I; #elif defined(IN_GCC) c = complex_t(e1->toReal() % r2, e1->toImaginary() % r2); +#elif defined(__FreeBSD__) && __FreeBSD_version < 800000 + // freebsd is kinda messed up. the STABLE branch doesn't support C99's fmodl !?! + c = complex_t(fmod(e1->toReal(), r2), fmod(e1->toImaginary(), r2)); #else c = complex_t(fmodl(e1->toReal(), r2), fmodl(e1->toImaginary(), r2)); #endif @@ -498,6 +501,9 @@ c = fmodl(e1->toReal(), i2) + fmodl(e1->toImaginary(), i2) * I; #elif defined(IN_GCC) c = complex_t(e1->toReal() % i2, e1->toImaginary() % i2); +#elif defined(__FreeBSD__) && __FreeBSD_version < 800000 + // freebsd is kinda messed up. the STABLE branch doesn't support C99's fmodl !?! + c = complex_t(fmod(e1->toReal(), i2), fmod(e1->toImaginary(), i2)); #else c = complex_t(fmodl(e1->toReal(), i2), fmodl(e1->toImaginary(), i2)); #endif
--- a/dmd/mars.c Thu Oct 02 01:42:21 2008 +0200 +++ b/dmd/mars.c Thu Oct 02 03:25:46 2008 +0200 @@ -330,8 +330,10 @@ global.params.os = OSLinux; #elif __APPLE__ global.params.os = OSMacOSX; +#elif __FreeBSD__ + global.params.os = OSFreeBSD; #else -#error +#error Unsupported OS #endif /* linux */ assert(global.params.os != OSinvalid); @@ -843,6 +845,11 @@ global.params.tt_os = "-pc-darwin-gnu"; break; + case OSFreeBSD: + VersionCondition::addPredefinedGlobalIdent("freebsd"); + VersionCondition::addPredefinedGlobalIdent("Posix"); + break; + default: assert(false && "Target OS not supported"); }
--- a/dmd/mars.h Thu Oct 02 01:42:21 2008 +0200 +++ b/dmd/mars.h Thu Oct 02 03:25:46 2008 +0200 @@ -52,7 +52,8 @@ OSinvalid, OSLinux, OSWindows, - OSMacOSX + OSMacOSX, + OSFreeBSD }; // Put command line switches in here
--- a/gen/linker.cpp Thu Oct 02 01:42:21 2008 +0200 +++ b/gen/linker.cpp Thu Oct 02 03:25:46 2008 +0200 @@ -151,15 +151,18 @@ } // default libs - if(global.params.os == OSLinux || global.params.os == OSMacOSX) - { + switch(global.params.os) { + case OSLinux: + case OSMacOSX: + args.push_back("-ldl"); + case OSFreeBSD: args.push_back("-lpthread"); - args.push_back("-ldl"); args.push_back("-lm"); - } - else if (global.params.os == OSWindows) - { + break; + + case OSWindows: // FIXME: I'd assume kernel32 etc + break; } // object files
--- a/gen/tollvm.cpp Thu Oct 02 01:42:21 2008 +0200 +++ b/gen/tollvm.cpp Thu Oct 02 03:25:46 2008 +0200 @@ -704,6 +704,12 @@ return LLStructType::get(types); } + // FreeBSD + else if (global.params.os == OSFreeBSD) { + // Just a pointer + return LLStructType::get(DtoSize_t(), 0); + } + // pthread_fastlock std::vector<const LLType*> types2; types2.push_back(DtoSize_t());
--- a/runtime/internal/critical.c Thu Oct 02 01:42:21 2008 +0200 +++ b/runtime/internal/critical.c Thu Oct 02 03:25:46 2008 +0200 @@ -75,7 +75,7 @@ /* ================================= linux ============================ */ -#if linux || __APPLE__ +#if linux || __APPLE__ || __FreeBSD__ #include <stdio.h> #include <stdlib.h>