summaryrefslogtreecommitdiff
path: root/testsuite/mk
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-05-01 09:17:37 +0100
committerSimon Marlow <marlowsd@gmail.com>2012-05-01 11:42:52 +0100
commit3a3d1c6c5685d55aafeda22d4844ef0a300842f3 (patch)
treedd9ac7c8a3c7a62fc2d7df8cb971bc6f58e460eb /testsuite/mk
parentdeaa0ab325e34c62df1dfbee41b303641ae8eb3b (diff)
downloadhaskell-3a3d1c6c5685d55aafeda22d4844ef0a300842f3.tar.gz
substitute for $topdir in $(AR)
Fixes ghcilink001, ghcilink004 on Windows
Diffstat (limited to 'testsuite/mk')
-rw-r--r--testsuite/mk/ghc-config.hs14
1 files changed, 12 insertions, 2 deletions
diff --git a/testsuite/mk/ghc-config.hs b/testsuite/mk/ghc-config.hs
index e0b8954638..7bdc6d6d79 100644
--- a/testsuite/mk/ghc-config.hs
+++ b/testsuite/mk/ghc-config.hs
@@ -1,5 +1,6 @@
import System.Environment
import System.Process
+import Data.Maybe
main = do
[ghc] <- getArgs
@@ -14,6 +15,7 @@ main = do
info <- readProcess ghc ["--info"] ""
let fields = read info :: [(String,String)]
+
getGhcField fields "GhcStage" "Stage"
getGhcField fields "GhcWithNativeCodeGen" "Have native code generator"
getGhcField fields "GhcWithInterpreter" "Have interpreter"
@@ -28,8 +30,16 @@ getGhcField fields mkvar key =
Nothing -> fail ("No field: " ++ key)
Just val -> putStrLn (mkvar ++ '=':val)
-getGhcFieldWithDefault :: [(String,String)] -> String -> String -> String -> IO ()
+getGhcFieldWithDefault :: [(String,String)]
+ -> String -> String -> String -> IO ()
getGhcFieldWithDefault fields mkvar key deflt = do
case lookup key fields of
Nothing -> putStrLn (mkvar ++ '=':deflt)
- Just val -> putStrLn (mkvar ++ '=':val)
+ Just val -> putStrLn (mkvar ++ '=': fixTopdir topdir val)
+ where
+ topdir = fromMaybe "" (lookup "LibDir" fields)
+
+fixTopdir :: String -> String -> String
+fixTopdir t "" = ""
+fixTopdir t ('$':'t':'o':'p':'d':'i':'r':s) = t ++ s
+fixTopdir t (c:s) = c : fixTopdir t s