b3550bcf9e18c9551519ef8a8f14f4750dc3bcdf
[haskell-directory.git] / System / Info.hs
1 -----------------------------------------------------------------------------
2 -- |
3 -- Module      :  System.Info
4 -- Copyright   :  (c) The University of Glasgow 2001
5 -- License     :  BSD-style (see the file libraries/base/LICENSE)
6 -- 
7 -- Maintainer  :  libraries@haskell.org
8 -- Stability   :  experimental
9 -- Portability :  portable
10 --
11 -- Misc information about the characteristics of the host 
12 -- architecture\/machine lucky enough to run your program.
13 --
14 -----------------------------------------------------------------------------
15
16 module System.Info
17    (
18        os,                  -- :: String
19        arch,                -- :: String
20        compilerName,        -- :: String
21        compilerVersion      -- :: Version
22    ) where
23
24 import Prelude
25 import Data.Version
26
27 compilerVersion :: Version
28 compilerVersion = Version {versionBranch=[maj,min], versionTags=[]}
29   where (maj,min) = compilerVersionRaw `divMod` 100
30
31 os, arch, compilerName :: String
32 compilerVersionRaw :: Int
33
34 #if defined(__NHC__)
35 #include "OSInfo.hs"
36 compilerName = "nhc98"
37 compilerVersionRaw = __NHC__
38
39 #elif defined(__GLASGOW_HASKELL__)
40 #include "ghcplatform.h"
41 os = HOST_OS
42 arch = HOST_ARCH
43 compilerName = "ghc"
44 compilerVersionRaw = __GLASGOW_HASKELL__
45
46 #elif defined(__HUGS__)
47 #include "platform.h"
48 os = HOST_OS
49 arch = HOST_ARCH
50 compilerName = "hugs"
51 compilerVersionRaw = 0  -- ToDo
52
53 #else
54 #error Unknown compiler name
55 #endif