@@ -1,3 +1,5 @@
1import Distribution.Simple
3import Distribution.Simple
2import Distribution.Simple.LocalBuildInfo
4import Distribution.Simple.LocalBuildInfo
3import Distribution.Simple.Setup
5import Distribution.Simple.Setup
@@ -9,6 +11,7 @@ import System.Process
9import System.Directory
11import System.Directory
10import System.FilePath
12import System.FilePath
11import System.Exit
13import System.Exit
13main = defaultMainWithHooks hk
16main = defaultMainWithHooks hk
@@ -44,6 +47,30 @@ canUseRDRAND cc = do
44 , " return (!err);"
47 , " return (!err);"
47− ec <- rawSystemExitCode normal cc [tmpDir </> "testRDRAND.c", "-o", tmpDir ++ "/a.o","-c"]
50+ ec <- myRawSystemExitCode normal cc [tmpDir </> "testRDRAND.c", "-o", tmpDir ++ "/a.o","-c"]
48 notice normal $ "Result of RDRAND Test: " ++ show (ec == ExitSuccess)
51 notice normal $ "Result of RDRAND Test: " ++ show (ec == ExitSuccess)
49 return (ec == ExitSuccess)
52 return (ec == ExitSuccess)
54+myRawSystemExitCode :: Verbosity -> FilePath -> [String] -> IO ExitCode
55+#if __GLASGOW_HASKELL__ >= 704
56+-- We know for sure, that if GHC >= 7.4 implies Cabal >= 1.14
57+myRawSystemExitCode = rawSystemExitCode
60+-- We implement our own 'rawSystemExitCode', this will even work if
61+-- the user happens to have Cabal >= 1.14 installed with GHC 7.0 or
63+myRawSystemExitCode verbosity path args = do
64+ printRawCommandAndArgs verbosity path args
66+ exitcode <- rawSystem path args
67+ unless (exitcode == ExitSuccess) $ do
68+ debug verbosity $ path ++ " returned " ++ show exitcode
71+ printRawCommandAndArgs :: Verbosity -> FilePath -> [String] -> IO ()
72+ printRawCommandAndArgs verbosity path args
73+ | verbosity >= deafening = print (path, args)
74+ | verbosity >= verbose = putStrLn $ unwords (path : args)
75+ | otherwise = return ()