X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Futils%2FPlatform.hs;h=f3749ca09c9901dece9667bc0de6afbfbf4bf046;hp=b240a0bd9419324fd720e8e2ab72421dfa6d808c;hb=265bedd9b4869cf5f323ab32ed1e4af0f7a0bfe0;hpb=9932074a7c841eb76518a3abb3246e9f1d81886e diff --git a/compiler/utils/Platform.hs b/compiler/utils/Platform.hs index b240a0b..f3749ca 100644 --- a/compiler/utils/Platform.hs +++ b/compiler/utils/Platform.hs @@ -9,11 +9,14 @@ module Platform ( OS(..), defaultTargetPlatform, + target32Bit, osElfTarget ) where +import Panic + #include "HsVersions.h" @@ -52,13 +55,26 @@ data OS deriving (Show, Eq) +target32Bit :: Platform -> Bool +target32Bit p = case platformArch p of + ArchUnknown -> panic "Don't know if ArchUnknown is 32bit" + ArchX86 -> True + ArchX86_64 -> False + ArchPPC -> True + ArchPPC_64 -> False + ArchSPARC -> True + + -- | This predicates tells us whether the OS supports ELF-like shared libraries. osElfTarget :: OS -> Bool -osElfTarget OSLinux = True -osElfTarget OSFreeBSD = True -osElfTarget OSOpenBSD = True +osElfTarget OSLinux = True +osElfTarget OSFreeBSD = True +osElfTarget OSOpenBSD = True osElfTarget OSSolaris2 = True -osElfTarget _ = False +osElfTarget OSDarwin = False +osElfTarget OSMinGW32 = False +osElfTarget OSUnknown = panic "Don't know if OSUnknown is elf" + -- | This is the target platform as far as the #ifdefs are concerned. -- These are set in includes/ghcplatform.h by the autoconf scripts