MacOS 10.3 needs #include <libc.h> as well
[haskell-directory.git] / Setup.hs
index eff2859..d708be7 100644 (file)
--- a/Setup.hs
+++ b/Setup.hs
@@ -10,9 +10,7 @@ import Control.Monad
 import Data.List
 import Distribution.Simple
 import Distribution.PackageDescription
-import Distribution.PreProcess
 import Distribution.Setup
-import Distribution.Simple.Configure
 import Distribution.Simple.LocalBuildInfo
 import System.Environment
 import System.Exit
@@ -20,15 +18,18 @@ import System.Exit
 main :: IO ()
 main = do args <- getArgs
           let (ghcArgs, args') = extractGhcArgs args
-              (configureArgs, args'') = extractConfigureArgs args'
+              (confArgs, args'') = extractConfigureArgs args'
               hooks = defaultUserHooks {
                   confHook = add_extra_deps
                            $ confHook defaultUserHooks,
-                  postConf = add_configure_options configureArgs
+                  postConf = add_configure_options confArgs
                            $ postConf defaultUserHooks,
                   buildHook = add_ghc_options ghcArgs
                             $ filter_modules_hook
                             $ buildHook defaultUserHooks,
+                  makefileHook = add_ghc_options ghcArgs
+                            $ filter_modules_hook
+                            $ makefileHook defaultUserHooks,
                   instHook = filter_modules_hook
                            $ instHook defaultUserHooks }
           withArgs args'' $ defaultMainWithHooks hooks
@@ -40,11 +41,11 @@ extractConfigureArgs :: [String] -> ([String], [String])
 extractConfigureArgs = extractPrefixArgs "--configure-option="
 
 extractPrefixArgs :: String -> [String] -> ([String], [String])
-extractPrefixArgs prefix args
+extractPrefixArgs the_prefix args
  = let f [] = ([], [])
        f (x:xs) = case f xs of
                       (wantedArgs, otherArgs) ->
-                          case removePrefix prefix x of
+                          case removePrefix the_prefix x of
                               Just wantedArg ->
                                   (wantedArg:wantedArgs, otherArgs)
                               Nothing ->