X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=System%2FInfo.hs;h=68a4a1f25ddcd288e8cfddf12ffac08580bdfbf9;hb=5505736fa4594514aab2b3ea8b15171e8349b91e;hp=a064991ff79c77d47e8a9073c32172085c24c878;hpb=4836cf1053a971fe823ba547a8268431745c5bce;p=ghc-base.git diff --git a/System/Info.hs b/System/Info.hs index a064991..68a4a1f 100644 --- a/System/Info.hs +++ b/System/Info.hs @@ -2,7 +2,7 @@ -- | -- Module : System.Info -- Copyright : (c) The University of Glasgow 2001 --- License : BSD-style (see the file libraries/core/LICENSE) +-- License : BSD-style (see the file libraries/base/LICENSE) -- -- Maintainer : libraries@haskell.org -- Stability : experimental @@ -13,18 +13,54 @@ -- ----------------------------------------------------------------------------- -#include "MachDeps.h" - module System.Info ( os, -- :: String - arch -- :: String + arch, -- :: String + compilerName, -- :: String +#ifdef __GLASGOW_HASKELL__ + compilerVersion -- :: Version +#endif ) where import Prelude +import Data.Version + +#ifndef __NHC__ + +#include "ghcplatform.h" arch :: String arch = HOST_ARCH os :: String os = HOST_OS + +#else +os,arch ::String +#include "OSInfo.hs" +#endif + +compilerName :: String +#if defined(__NHC__) +compilerName = "nhc98" +#elif defined(__GLASGOW_HASKELL__) +compilerName = "ghc" +#elif defined(__HUGS__) +compilerName = "hugs" +#else +#error Unknown compiler name +#endif + +#ifdef __GLASGOW_HASKELL__ +compilerVersion :: Version +compilerVersion = Version {versionBranch=[maj,min], versionTags=[]} + where (maj,min) = __GLASGOW_HASKELL__ `divMod` 100 +#endif + +#ifdef __NHC__ +compilerVersion :: Version +compilerVersion = Version {versionBranch=[maj,min], versionTags=[]} + where (maj,min) = __NHC__ `divMod` 100 +#endif +