From: Ian Lynagh Date: Fri, 7 Aug 2009 15:21:51 +0000 (+0000) Subject: Fix the build on OS X X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=b3bd828c358cbd79887dbd873357e265d8d6060a Fix the build on OS X --- diff --git a/includes/rts/FileLock.h b/includes/rts/FileLock.h index 9a35ecc..ab59173 100644 --- a/includes/rts/FileLock.h +++ b/includes/rts/FileLock.h @@ -9,6 +9,10 @@ #ifndef RTS_FILELOCK_H #define RTS_FILELOCK_H +#ifdef HAVE_SYS_TYPES_H +#include +#endif + int lockFile(int fd, dev_t dev, ino_t ino, int for_writing); int unlockFile(int fd); diff --git a/rts/Adjustor.c b/rts/Adjustor.c index aa7a809..dcae59b 100644 --- a/rts/Adjustor.c +++ b/rts/Adjustor.c @@ -43,10 +43,20 @@ Haskell side. #include "Stable.h" #if defined(USE_LIBFFI_FOR_ADJUSTORS) - #include "ffi.h" #include +#endif + +#if defined(i386_HOST_ARCH) && defined(darwin_HOST_OS) +extern void adjustorCode(void); +#elif defined(powerpc_HOST_ARCH) || defined(powerpc64_HOST_ARCH) +// from AdjustorAsm.s +// not declared as a function so that AIX-style +// fundescs can never get in the way. +extern void *adjustorCode; +#endif +#if defined(USE_LIBFFI_FOR_ADJUSTORS) void freeHaskellFunctionPtr(void* ptr) { @@ -423,7 +433,6 @@ createAdjustor(int cconv, StgStablePtr hptr, AdjustorStub *adjustorStub = allocateExec(sizeof(AdjustorStub),&code); adjustor = adjustorStub; - extern void adjustorCode(void); int sz = totalArgumentSize(typeString); adjustorStub->call[0] = 0xe8; @@ -915,11 +924,6 @@ TODO: Depending on how much allocation overhead stgMallocBytes uses for AdjustorStub *adjustorStub; int sz = 0, extra_sz, total_sz; - // from AdjustorAsm.s - // not declared as a function so that AIX-style - // fundescs can never get in the way. - extern void *adjustorCode; - #ifdef FUNDESCS adjustorStub = stgMallocBytes(sizeof(AdjustorStub), "createAdjustor"); #else @@ -1154,7 +1158,6 @@ if ( *(unsigned char*)ptr != 0xe8 ) { } freeStablePtr(((StgStablePtr*)ptr)[1]); #elif defined(powerpc_HOST_ARCH) || defined(powerpc64_HOST_ARCH) - extern void* adjustorCode; if ( ((AdjustorStub*)ptr)->code != (StgFunPtr) &adjustorCode ) { errorBelch("freeHaskellFunctionPtr: not for me, guv! %p\n", ptr); return; diff --git a/rts/PosixSource.h b/rts/PosixSource.h index cd1aeea..b3da60f 100644 --- a/rts/PosixSource.h +++ b/rts/PosixSource.h @@ -9,6 +9,8 @@ #ifndef POSIXSOURCE_H #define POSIXSOURCE_H +#include + #define _POSIX_SOURCE 1 #define _POSIX_C_SOURCE 199506L #define _XOPEN_SOURCE 500 @@ -16,4 +18,12 @@ /* Let's be ISO C99 too... */ +#if defined(darwin_HOST_OS) +/* If we don't define this the including sysctl breaks with things like + /usr/include/bsm/audit.h:224:0: + error: syntax error before 'u_char' +*/ +#define _DARWIN_C_SOURCE 1 +#endif + #endif /* POSIXSOURCE_H */