X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=System%2FInfo.hs;h=02cfa0dc5710cf7b248c123922b13a2da9270a02;hb=2f5eceabb9a273bfaf11830714cc209bf7dcc469;hp=452cec5c8dd641e68f71bd74194108e2272e6ecf;hpb=f7a485978f04e84b086f1974b88887cc72d832d0;p=ghc-base.git diff --git a/System/Info.hs b/System/Info.hs index 452cec5..02cfa0d 100644 --- a/System/Info.hs +++ b/System/Info.hs @@ -1,4 +1,4 @@ ------------------------------------------------------------------------------ +<----------------------------------------------------------------------------- -- | -- Module : System.Info -- Copyright : (c) The University of Glasgow 2001 @@ -13,18 +13,43 @@ -- ----------------------------------------------------------------------------- -#include "MachDeps.h" - module System.Info ( os, -- :: String - arch -- :: String + arch, -- :: String + compilerName, -- :: String + compilerVersion -- :: Version ) where import Prelude +import Data.Version + +compilerVersion :: Version +compilerVersion = Version {versionBranch=[maj,min], versionTags=[]} + where (maj,min) = compilerVersionRaw `divMod` 100 + +os, arch, compilerName :: String +compilerVersionRaw :: Int -arch :: String +#if defined(__NHC__) +#include "OSInfo.hs" +compilerName = "nhc98" +compilerVersionRaw = __NHC__ + +#elif defined(__GLASGOW_HASKELL__) +#include "ghcplatform.h" +os = HOST_OS arch = HOST_ARCH +compilerName = "ghc" +compilerVersionRaw = __GLASGOW_HASKELL__ -os :: String +#elif defined(__HUGS__) +#include "platform.h" os = HOST_OS +arch = HOST_ARCH +compilerName = "hugs" +compilerVersionRaw = 0 -- ToDo + +#else +#error Unknown compiler name +#endif