[project @ 2005-01-28 13:36:25 by simonmar]
[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 #ifndef __NHC__
28
29 #include "ghcplatform.h"
30
31 arch :: String
32 arch = HOST_ARCH
33
34 os :: String
35 os = HOST_OS
36
37 #else
38 os,arch ::String
39 #include "OSInfo.hs"
40 #endif
41
42 compilerName :: String
43 #if defined(__NHC__)
44 compilerName = "nhc98"
45 #elif defined(__GLASGOW_HASKELL__)
46 compilerName = "ghc"
47 #elif defined(__HUGS__)
48 compilerName = "hugs"
49 #else
50 #error Unknown compiler name
51 #endif
52
53 compilerVersion :: Version
54 #ifdef __GLASGOW_HASKELL__
55 compilerVersion = Version {versionBranch=[maj,min], versionTags=[]}
56   where (maj,min) = __GLASGOW_HASKELL__ `divMod` 100
57 #endif