X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FDynFlags.hs;h=97cbfc8be335c9e52c05b0146615fc5246e3a772;hb=c395b75ce4f20583a5b28c5df79c4de019beecb9;hp=22b85b9e542604adf81aa409c04598a6eca4def5;hpb=dfcbf782fc0571014e1d3302d38b33537142159a;p=ghc-hetmet.git diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 22b85b9..97cbfc8 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -29,6 +29,7 @@ module DynFlags ( GhcLink(..), isNoLink, PackageFlag(..), Option(..), + DynLibLoader(..), fFlags, xFlags, -- Configuration of the core-to-core and stg-to-stg phases @@ -196,6 +197,7 @@ data DynFlag | Opt_PArr -- Syntactic support for parallel arrays | Opt_Arrows -- Arrow-notation syntax | Opt_TemplateHaskell + | Opt_QuasiQuotes | Opt_ImplicitParams | Opt_Generics | Opt_ImplicitPrelude @@ -333,6 +335,7 @@ data DynFlags = DynFlags { outputFile :: Maybe String, outputHi :: Maybe String, + dynLibLoader :: DynLibLoader, -- | This is set by DriverPipeline.runPipeline based on where -- its output is going. @@ -459,6 +462,12 @@ defaultObjectTarget | cGhcWithNativeCodeGen == "YES" = HscAsm | otherwise = HscC +data DynLibLoader + = Deployable + | Wrapped (Maybe String) + | SystemDependent + deriving Eq + initDynFlags dflags = do -- someday these will be dynamic flags ways <- readIORef v_Ways @@ -505,6 +514,7 @@ defaultDynFlags = outputFile = Nothing, outputHi = Nothing, + dynLibLoader = Deployable, dumpPrefix = Nothing, dumpPrefixForce = Nothing, includePaths = [], @@ -601,6 +611,15 @@ setHcSuf f d = d{ hcSuf = f} setOutputFile f d = d{ outputFile = f} setOutputHi f d = d{ outputHi = f} +parseDynLibLoaderMode f d = + case splitAt 8 f of + ("deploy", "") -> d{ dynLibLoader = Deployable } + ("sysdep", "") -> d{ dynLibLoader = SystemDependent } + ("wrapped", "") -> d{ dynLibLoader = Wrapped Nothing } + ("wrapped:", "hard") -> d{ dynLibLoader = Wrapped Nothing } + ("wrapped:", flex) -> d{ dynLibLoader = Wrapped (Just flex) } + (_,_) -> error "Unknown dynlib loader" + setDumpPrefixForce f d = d { dumpPrefixForce = f} -- XXX HACK: Prelude> words "'does not' work" ===> ["'does","not'","work"] @@ -993,6 +1012,7 @@ dynamic_flags = [ , ( "c" , NoArg (upd $ \d -> d{ ghcLink=NoLink } )) , ( "no-link" , NoArg (upd $ \d -> d{ ghcLink=NoLink } )) -- Dep. , ( "shared" , NoArg (upd $ \d -> d{ ghcLink=LinkDynLib } )) + , ( "dynload" , HasArg (upd . parseDynLibLoaderMode)) ------- Libraries --------------------------------------------------- , ( "L" , Prefix addLibraryPath ) @@ -1300,6 +1320,7 @@ xFlags = [ ( "Arrows", Opt_Arrows ), ( "PArr", Opt_PArr ), ( "TemplateHaskell", Opt_TemplateHaskell ), + ( "QuasiQuotes", Opt_QuasiQuotes ), ( "Generics", Opt_Generics ), -- On by default: ( "ImplicitPrelude", Opt_ImplicitPrelude ), @@ -1595,7 +1616,7 @@ setTmpDir dir dflags = dflags{ tmpDir = canonicalise dir } -- strip the trailing backslash (awful, but we only do this once). removeTrailingSlash path | isPathSeparator (last path) = init path - | othwerwise = path + | otherwise = path #endif -----------------------------------------------------------------------------