Skip to content
Snippets Groups Projects
Commit 1f85d9a5 authored by Isaac Potoczny-Jones's avatar Isaac Potoczny-Jones
Browse files

cvs pull from Ross; invoke configure w/o sh

  Invoke the configure program (if present) directly instead of using sh,
  except under MinGW, where #! won't work.  (Problem noted by Frederik Eaton)
parent 2e96fa6e
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
-- --
-- Maintainer : Isaac Jones <ijones@syntaxpolice.org> -- Maintainer : Isaac Jones <ijones@syntaxpolice.org>
-- Stability : alpha -- Stability : alpha
-- Portability : GHC -- Portability : portable
-- --
-- Explanation: Simple build system; basically the interface for -- Explanation: Simple build system; basically the interface for
-- Distribution.Simple.\* modules. When given the parsed command-line -- Distribution.Simple.\* modules. When given the parsed command-line
...@@ -85,6 +85,9 @@ import Distribution.Simple.Install(install) ...@@ -85,6 +85,9 @@ import Distribution.Simple.Install(install)
import Distribution.Simple.Utils (die, currentDir, rawSystemVerbose, import Distribution.Simple.Utils (die, currentDir, rawSystemVerbose,
defaultPackageDesc, defaultHookedPackageDesc, defaultPackageDesc, defaultHookedPackageDesc,
moduleToFilePath) moduleToFilePath)
#if mingw32_HOST_OS || mingw32_TARGET_OS
import Distribution.Simple.Utils (rawSystemPath)
#endif
import Language.Haskell.Extension import Language.Haskell.Extension
-- Base -- Base
import System.Environment(getArgs) import System.Environment(getArgs)
...@@ -506,16 +509,25 @@ defaultUserHooks ...@@ -506,16 +509,25 @@ defaultUserHooks
} }
where defaultPostConf :: Args -> ConfigFlags -> LocalBuildInfo -> IO ExitCode where defaultPostConf :: Args -> ConfigFlags -> LocalBuildInfo -> IO ExitCode
defaultPostConf args flags lbi defaultPostConf args flags lbi
= do let prefix_opt pref opts = = do let verbose = configVerbose flags
("--prefix=" ++ pref) : opts args' = addOption "prefix" (configPrefix flags) args
confExists <- doesFileExist "configure" confExists <- doesFileExist "configure"
if confExists then do if confExists then
rawSystemVerbose (configVerbose flags) "sh" #if mingw32_HOST_OS || mingw32_TARGET_OS
("configure" : maybe id prefix_opt (configPrefix flags) args) -- FIXME: hack for script files under MinGW
return () -- This assumes sh (check for #! line?)
else rawSystemPath verbose "sh" ("configure" : args')
no_extra_flags args #else
return ExitSuccess rawSystemVerbose verbose "./configure" args'
#endif
else do
no_extra_flags args
return ExitSuccess
addOption :: String -> Maybe String -> [String] -> [String]
addOption _flag Nothing opts = opts
addOption flag (Just value) opts =
("--" ++ flag ++ "=" ++ value) : opts
readHook :: (a -> Int) -> Args -> a -> IO HookedBuildInfo readHook :: (a -> Int) -> Args -> a -> IO HookedBuildInfo
readHook verbose a flags = do readHook verbose a flags = do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment