[project @ 2005-01-28 16:09:06 by malcolm]
[ghc-base.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 #ifdef __GLASGOW_HASKELL__
22        compilerVersion      -- :: Version
23 #endif
24    ) where
25
26 import Prelude
27 import Data.Version
28
29 #ifndef __NHC__
30
31 #include "ghcplatform.h"
32
33 arch :: String
34 arch = HOST_ARCH
35
36 os :: String
37 os = HOST_OS
38
39 #else
40 os,arch ::String
41 #include "OSInfo.hs"
42 #endif
43
44 compilerName :: String
45 #if defined(__NHC__)
46 compilerName = "nhc98"
47 #elif defined(__GLASGOW_HASKELL__)
48 compilerName = "ghc"
49 #elif defined(__HUGS__)
50 compilerName = "hugs"
51 #else
52 #error Unknown compiler name
53 #endif
54
55 #ifdef __GLASGOW_HASKELL__
56 compilerVersion :: Version
57 compilerVersion = Version {versionBranch=[maj,min], versionTags=[]}
58   where (maj,min) = __GLASGOW_HASKELL__ `divMod` 100
59 #endif
60
61 #ifdef __NHC__
62 compilerVersion :: Version
63 compilerVersion = Version {versionBranch=[maj,min], versionTags=[]}
64   where (maj,min) = __NHC__ `divMod` 100
65 #endif
66