1 {-# OPTIONS -fno-warn-missing-fields #-}
2 -----------------------------------------------------------------------------
6 -- Most flags are dynamic flags, which means they can change from
7 -- compilation to compilation using OPTIONS_GHC pragmas, and in a
8 -- multi-session GHC each session can be using different dynamic
9 -- flags. Dynamic flags can also be set at the prompt in GHCi.
11 -- (c) The University of Glasgow 2005
13 -----------------------------------------------------------------------------
20 GhcMode(..), isOneShot,
21 GhcLink(..), isNoLink,
25 -- Configuration of the core-to-core and stg-to-stg phases
29 SimplifierMode(..), FloatOutSwitches(..),
30 getCoreToDo, getStgToDo,
32 -- Manipulating DynFlags
33 defaultDynFlags, -- DynFlags
34 initDynFlags, -- DynFlags -> IO DynFlags
36 dopt, -- DynFlag -> DynFlags -> Bool
37 dopt_set, dopt_unset, -- DynFlags -> DynFlag -> DynFlags
38 getOpts, -- (DynFlags -> [a]) -> IO [a]
49 machdepCCOpts, picCCOpts
52 #include "HsVersions.h"
54 import Module ( Module, mkModuleName, mkModule )
56 import PrelNames ( mAIN )
57 #ifdef i386_TARGET_ARCH
58 import StaticFlags ( opt_Static )
60 import StaticFlags ( opt_PIC, WayName(..), v_Ways, v_Build_tag,
62 import {-# SOURCE #-} Packages (PackageState)
63 import DriverPhases ( Phase(..), phaseInputExt )
66 import Constants ( mAX_CONTEXT_REDUCTION_DEPTH )
67 import Panic ( panic, GhcException(..) )
68 import UniqFM ( UniqFM )
69 import Util ( notNull, splitLongestPrefix, normalisePath )
70 import Maybes ( fromJust, orElse )
71 import SrcLoc ( SrcSpan )
73 import {-# SOURCE #-} ErrUtils ( Severity(..), Message, mkLocMessage )
75 import Data.IORef ( readIORef )
76 import Control.Exception ( throwDyn )
77 import Control.Monad ( when )
78 #ifdef mingw32_TARGET_OS
79 import Data.List ( isPrefixOf )
84 import Data.Char ( isUpper )
85 import System.IO ( hPutStrLn, stderr )
88 import Breakpoints ( BkptHandler )
89 import Module ( ModuleName )
91 -- -----------------------------------------------------------------------------
104 | Opt_D_dump_inlinings
105 | Opt_D_dump_rule_firings
106 | Opt_D_dump_occur_anal
110 | Opt_D_dump_simpl_iterations
119 | Opt_D_dump_worker_wrapper
120 | Opt_D_dump_rn_trace
121 | Opt_D_dump_rn_stats
123 | Opt_D_dump_simpl_stats
124 | Opt_D_dump_tc_trace
125 | Opt_D_dump_if_trace
131 | Opt_D_verbose_core2core
132 | Opt_D_verbose_stg2stg
134 | Opt_D_dump_hi_diffs
135 | Opt_D_dump_minimal_imports
136 | Opt_D_faststring_stats
141 | Opt_WarnIsError -- -Werror; makes warnings fatal
142 | Opt_WarnDuplicateExports
144 | Opt_WarnIncompletePatterns
145 | Opt_WarnIncompletePatternsRecUpd
146 | Opt_WarnMissingFields
147 | Opt_WarnMissingMethods
148 | Opt_WarnMissingSigs
149 | Opt_WarnNameShadowing
150 | Opt_WarnOverlappingPatterns
151 | Opt_WarnSimplePatterns
152 | Opt_WarnTypeDefaults
153 | Opt_WarnUnusedBinds
154 | Opt_WarnUnusedImports
155 | Opt_WarnUnusedMatches
156 | Opt_WarnDeprecations
157 | Opt_WarnDodgyImports
162 | Opt_AllowOverlappingInstances
163 | Opt_AllowUndecidableInstances
164 | Opt_AllowIncoherentInstances
165 | Opt_MonomorphismRestriction
167 | Opt_ExtendedDefaultRules -- Use GHC's extended rules for defaulting
170 | Opt_PArr -- Syntactic support for parallel arrays
171 | Opt_Arrows -- Arrow-notation syntax
175 | Opt_ImplicitPrelude
176 | Opt_ScopedTypeVariables
184 | Opt_IgnoreInterfacePragmas
185 | Opt_OmitInterfacePragmas
186 | Opt_DoLambdaEtaExpansion
188 | Opt_IgnoreBreakpoints
191 | Opt_UnboxStrictFields
200 | Opt_ExcessPrecision
201 | Opt_ReadUserPackageConf
205 | Opt_HideAllPackages
206 #if defined(GHCI) && defined(DEBUGGER)
209 | Opt_PrintBindResult
222 data DynFlags = DynFlags {
225 coreToDo :: Maybe [CoreToDo], -- reserved for -Ofile
226 stgToDo :: Maybe [StgToDo], -- similarly
227 hscTarget :: HscTarget,
228 hscOutName :: String, -- name of the output file
229 extCoreName :: String, -- name of the .core output file
230 verbosity :: Int, -- verbosity level
231 optLevel :: Int, -- optimisation level
232 maxSimplIterations :: Int, -- max simplifier iterations
233 ruleCheck :: Maybe String,
234 libCaseThreshold :: Int, -- Threshold for liberate-case
236 stolen_x86_regs :: Int,
237 cmdlineHcIncludes :: [String], -- -#includes
238 importPaths :: [FilePath],
240 mainFunIs :: Maybe String,
241 ctxtStkDepth :: Int, -- Typechecker context stack depth
243 thisPackage :: PackageId,
246 wayNames :: [WayName], -- way flags from the cmd line
247 buildTag :: String, -- the global "way" (eg. "p" for prof)
248 rtsBuildTag :: String, -- the RTS "way"
251 objectDir :: Maybe String,
252 hiDir :: Maybe String,
253 stubDir :: Maybe String,
259 outputFile :: Maybe String,
260 outputHi :: Maybe String,
262 includePaths :: [String],
263 libraryPaths :: [String],
264 frameworkPaths :: [String], -- used on darwin only
265 cmdlineFrameworks :: [String], -- ditto
266 tmpDir :: String, -- no trailing '/'
268 ghcUsagePath :: FilePath, -- Filled in by SysTools
269 ghciUsagePath :: FilePath, -- ditto
271 hpcDir :: String, -- ^ path to store the .mix files
273 -- options for particular phases
284 -- commands for particular phases
286 pgm_P :: (String,[Option]),
288 pgm_c :: (String,[Option]),
289 pgm_m :: (String,[Option]),
290 pgm_s :: (String,[Option]),
291 pgm_a :: (String,[Option]),
292 pgm_l :: (String,[Option]),
293 pgm_dll :: (String,[Option]),
295 pgm_sysman :: String,
298 extraPkgConfs :: [FilePath],
299 topDir :: FilePath, -- filled in by SysTools
300 systemPackageConfig :: FilePath, -- ditto
301 -- The -package-conf flags given on the command line, in the order
304 packageFlags :: [PackageFlag],
305 -- The -package and -hide-package flags from the command-line
308 -- NB. do not modify this field, it is calculated by
309 -- Packages.initPackages and Packages.updatePackages.
310 pkgDatabase :: Maybe (UniqFM InstalledPackageInfo),
311 pkgState :: PackageState,
317 log_action :: Severity -> SrcSpan -> PprStyle -> Message -> IO ()
320 -- breakpoint handling
321 ,bkptHandler :: Maybe (BkptHandler Module)
334 = BatchCompile -- | @ghc --make Main@
335 | Interactive -- | @ghc --interactive@
336 | OneShot -- | @ghc -c Foo.hs@
337 | JustTypecheck -- | Development environemnts, refactorer, etc.
341 isOneShot :: GhcMode -> Bool
342 isOneShot OneShot = True
343 isOneShot _other = False
345 data GhcLink -- What to do in the link step, if there is one
346 = -- Only relevant for modes
347 -- DoMake and StopBefore StopLn
348 NoLink -- Don't link at all
349 | StaticLink -- Ordinary linker [the default]
350 | MkDLL -- Make a DLL
352 isNoLink :: GhcLink -> Bool
353 isNoLink NoLink = True
354 isNoLink other = False
357 = ExposePackage String
359 | IgnorePackage String
363 | cGhcWithNativeCodeGen == "YES" = HscAsm
366 initDynFlags dflags = do
367 -- someday these will be dynamic flags
368 ways <- readIORef v_Ways
369 build_tag <- readIORef v_Build_tag
370 rts_build_tag <- readIORef v_RTS_Build_tag
373 buildTag = build_tag,
374 rtsBuildTag = rts_build_tag
380 ghcLink = StaticLink,
383 hscTarget = defaultHscTarget,
388 maxSimplIterations = 4,
390 libCaseThreshold = 20,
392 cmdlineHcIncludes = [],
396 ctxtStkDepth = mAX_CONTEXT_REDUCTION_DEPTH,
398 thisPackage = mainPackageId,
404 objectSuf = phaseInputExt StopLn,
405 hcSuf = phaseInputExt HCc,
408 outputFile = Nothing,
413 cmdlineFrameworks = [],
414 tmpDir = cDEFAULT_TMPDIR,
430 pkgDatabase = Nothing,
431 pkgState = panic "no package state yet: call GHC.setSessionDynFlags",
433 bkptHandler = Nothing,
436 Opt_ReadUserPackageConf,
438 Opt_MonoPatBinds, -- Experimentally, I'm making this non-standard
439 -- behaviour the default, to see if anyone notices
443 Opt_MonomorphismRestriction,
445 -- strictness is on by default, but this only
447 Opt_CSE, -- similarly for CSE.
448 Opt_FullLaziness, -- ...and for full laziness
450 Opt_DoLambdaEtaExpansion,
451 -- This one is important for a tiresome reason:
452 -- we want to make sure that the bindings for data
453 -- constructors are eta-expanded. This is probably
454 -- a good thing anyway, but it seems fragile.
458 -- and the default no-optimisation options:
459 Opt_IgnoreInterfacePragmas,
460 Opt_OmitInterfacePragmas,
464 ] ++ standardWarnings,
466 log_action = \severity srcSpan style msg ->
468 SevInfo -> hPutStrLn stderr (show (msg style))
469 SevFatal -> hPutStrLn stderr (show (msg style))
470 _ -> hPutStrLn stderr ('\n':show ((mkLocMessage srcSpan msg) style))
476 0 | print errors & warnings only
477 1 | minimal verbosity: print "compiling M ... done." for each module.
478 2 | equivalent to -dshow-passes
479 3 | equivalent to existing "ghc -v"
480 4 | "ghc -v -ddump-most"
481 5 | "ghc -v -ddump-all"
484 dopt :: DynFlag -> DynFlags -> Bool
485 dopt f dflags = f `elem` (flags dflags)
487 dopt_set :: DynFlags -> DynFlag -> DynFlags
488 dopt_set dfs f = dfs{ flags = f : flags dfs }
490 dopt_unset :: DynFlags -> DynFlag -> DynFlags
491 dopt_unset dfs f = dfs{ flags = filter (/= f) (flags dfs) }
493 getOpts :: DynFlags -> (DynFlags -> [a]) -> [a]
494 getOpts dflags opts = reverse (opts dflags)
495 -- We add to the options from the front, so we need to reverse the list
497 getVerbFlag :: DynFlags -> String
499 | verbosity dflags >= 3 = "-v"
502 setObjectDir f d = d{ objectDir = f}
503 setHiDir f d = d{ hiDir = f}
504 setStubDir f d = d{ stubDir = f}
506 setObjectSuf f d = d{ objectSuf = f}
507 setHiSuf f d = d{ hiSuf = f}
508 setHcSuf f d = d{ hcSuf = f}
510 setOutputFile f d = d{ outputFile = f}
511 setOutputHi f d = d{ outputHi = f}
513 -- XXX HACK: Prelude> words "'does not' work" ===> ["'does","not'","work"]
514 -- Config.hs should really use Option.
515 setPgmP f d = let (pgm:args) = words f in d{ pgm_P = (pgm, map Option args)}
517 setPgmL f d = d{ pgm_L = f}
518 setPgmF f d = d{ pgm_F = f}
519 setPgmc f d = d{ pgm_c = (f,[])}
520 setPgmm f d = d{ pgm_m = (f,[])}
521 setPgms f d = d{ pgm_s = (f,[])}
522 setPgma f d = d{ pgm_a = (f,[])}
523 setPgml f d = d{ pgm_l = (f,[])}
524 setPgmdll f d = d{ pgm_dll = (f,[])}
526 addOptL f d = d{ opt_L = f : opt_L d}
527 addOptP f d = d{ opt_P = f : opt_P d}
528 addOptF f d = d{ opt_F = f : opt_F d}
529 addOptc f d = d{ opt_c = f : opt_c d}
530 addOptm f d = d{ opt_m = f : opt_m d}
531 addOpta f d = d{ opt_a = f : opt_a d}
532 addOptl f d = d{ opt_l = f : opt_l d}
533 addOptdll f d = d{ opt_dll = f : opt_dll d}
534 addOptdep f d = d{ opt_dep = f : opt_dep d}
536 addCmdlineFramework f d = d{ cmdlineFrameworks = f : cmdlineFrameworks d}
538 -- -----------------------------------------------------------------------------
539 -- Command-line options
541 -- When invoking external tools as part of the compilation pipeline, we
542 -- pass these a sequence of options on the command-line. Rather than
543 -- just using a list of Strings, we use a type that allows us to distinguish
544 -- between filepaths and 'other stuff'. [The reason being, of course, that
545 -- this type gives us a handle on transforming filenames, and filenames only,
546 -- to whatever format they're expected to be on a particular platform.]
549 = FileOption -- an entry that _contains_ filename(s) / filepaths.
550 String -- a non-filepath prefix that shouldn't be
551 -- transformed (e.g., "/out=")
552 String -- the filepath/filename portion
555 -----------------------------------------------------------------------------
556 -- Setting the optimisation level
558 updOptLevel :: Int -> DynFlags -> DynFlags
559 -- Set dynflags appropriate to the optimisation level
561 = dfs2{ optLevel = n }
563 dfs1 = foldr (flip dopt_unset) dfs remove_dopts
564 dfs2 = foldr (flip dopt_set) dfs1 extra_dopts
567 | n == 0 = opt_0_dopts
568 | otherwise = opt_1_dopts
571 | n == 0 = opt_1_dopts
572 | otherwise = opt_0_dopts
575 Opt_IgnoreInterfacePragmas,
576 Opt_OmitInterfacePragmas
585 -- -----------------------------------------------------------------------------
586 -- Standard sets of warning options
589 = [ Opt_WarnDeprecations,
590 Opt_WarnOverlappingPatterns,
591 Opt_WarnMissingFields,
592 Opt_WarnMissingMethods,
593 Opt_WarnDuplicateExports
597 = standardWarnings ++
598 [ Opt_WarnUnusedBinds,
599 Opt_WarnUnusedMatches,
600 Opt_WarnUnusedImports,
601 Opt_WarnIncompletePatterns,
607 [ Opt_WarnTypeDefaults,
608 Opt_WarnNameShadowing,
614 -- -----------------------------------------------------------------------------
615 -- CoreToDo: abstraction of core-to-core passes to run.
617 data CoreToDo -- These are diff core-to-core passes,
618 -- which may be invoked in any order,
619 -- as many times as you like.
621 = CoreDoSimplify -- The core-to-core simplifier.
624 -- Each run of the simplifier can take a different
625 -- set of simplifier-specific flags.
627 | CoreDoFloatOutwards FloatOutSwitches
632 | CoreDoWorkerWrapper
635 | CoreDoOldStrictness
638 | CoreDoRuleCheck Int{-CompilerPhase-} String -- Check for non-application of rules
639 -- matching this string
641 | CoreDoNothing -- useful when building up lists of these things
643 data SimplifierMode -- See comments in SimplMonad
647 data SimplifierSwitch
648 = MaxSimplifierIterations Int
651 data FloatOutSwitches
652 = FloatOutSw Bool -- True <=> float lambdas to top level
653 Bool -- True <=> float constants to top level,
654 -- even if they do not escape a lambda
657 -- The core-to-core pass ordering is derived from the DynFlags:
659 getCoreToDo :: DynFlags -> [CoreToDo]
661 | Just todo <- coreToDo dflags = todo -- set explicitly by user
662 | otherwise = core_todo
664 opt_level = optLevel dflags
665 max_iter = maxSimplIterations dflags
666 strictness = dopt Opt_Strictness dflags
667 full_laziness = dopt Opt_FullLaziness dflags
668 cse = dopt Opt_CSE dflags
669 rule_check = ruleCheck dflags
672 if opt_level == 0 then
674 CoreDoSimplify (SimplPhase 0) [
675 MaxSimplifierIterations max_iter
678 else {- opt_level >= 1 -} [
680 -- initial simplify: mk specialiser happy: minimum effort please
681 CoreDoSimplify SimplGently [
683 -- Don't inline anything till full laziness has bitten
684 -- In particular, inlining wrappers inhibits floating
685 -- e.g. ...(case f x of ...)...
686 -- ==> ...(case (case x of I# x# -> fw x#) of ...)...
687 -- ==> ...(case x of I# x# -> case fw x# of ...)...
688 -- and now the redex (f x) isn't floatable any more
689 -- Similarly, don't apply any rules until after full
690 -- laziness. Notably, list fusion can prevent floating.
692 NoCaseOfCase, -- Don't do case-of-case transformations.
693 -- This makes full laziness work better
694 MaxSimplifierIterations max_iter
697 -- Specialisation is best done before full laziness
698 -- so that overloaded functions have all their dictionary lambdas manifest
701 if full_laziness then CoreDoFloatOutwards (FloatOutSw False False)
706 CoreDoSimplify (SimplPhase 2) [
707 -- Want to run with inline phase 2 after the specialiser to give
708 -- maximum chance for fusion to work before we inline build/augment
709 -- in phase 1. This made a difference in 'ansi' where an
710 -- overloaded function wasn't inlined till too late.
711 MaxSimplifierIterations max_iter
713 case rule_check of { Just pat -> CoreDoRuleCheck 2 pat; Nothing -> CoreDoNothing },
715 CoreDoSimplify (SimplPhase 1) [
716 -- Need inline-phase2 here so that build/augment get
717 -- inlined. I found that spectral/hartel/genfft lost some useful
718 -- strictness in the function sumcode' if augment is not inlined
719 -- before strictness analysis runs
720 MaxSimplifierIterations max_iter
722 case rule_check of { Just pat -> CoreDoRuleCheck 1 pat; Nothing -> CoreDoNothing },
724 CoreDoSimplify (SimplPhase 0) [
725 -- Phase 0: allow all Ids to be inlined now
726 -- This gets foldr inlined before strictness analysis
728 MaxSimplifierIterations 3
729 -- At least 3 iterations because otherwise we land up with
730 -- huge dead expressions because of an infelicity in the
732 -- let k = BIG in foldr k z xs
733 -- ==> let k = BIG in letrec go = \xs -> ...(k x).... in go xs
734 -- ==> let k = BIG in letrec go = \xs -> ...(BIG x).... in go xs
738 case rule_check of { Just pat -> CoreDoRuleCheck 0 pat; Nothing -> CoreDoNothing },
740 #ifdef OLD_STRICTNESS
743 if strictness then CoreDoStrictness else CoreDoNothing,
747 CoreDoSimplify (SimplPhase 0) [
748 MaxSimplifierIterations max_iter
751 if full_laziness then
752 CoreDoFloatOutwards (FloatOutSw False -- Not lambdas
753 True) -- Float constants
755 -- nofib/spectral/hartel/wang doubles in speed if you
756 -- do full laziness late in the day. It only happens
757 -- after fusion and other stuff, so the early pass doesn't
758 -- catch it. For the record, the redex is
759 -- f_el22 (f_el21 r_midblock)
762 -- We want CSE to follow the final full-laziness pass, because it may
763 -- succeed in commoning up things floated out by full laziness.
764 -- CSE used to rely on the no-shadowing invariant, but it doesn't any more
766 if cse then CoreCSE else CoreDoNothing,
770 -- Case-liberation for -O2. This should be after
771 -- strictness analysis and the simplification which follows it.
773 case rule_check of { Just pat -> CoreDoRuleCheck 0 pat; Nothing -> CoreDoNothing }
778 (if opt_level >= 2 then
780 CoreDoSimplify (SimplPhase 0) [
781 MaxSimplifierIterations max_iter
782 ], -- Run the simplifier after LiberateCase to vastly
783 -- reduce the possiblility of shadowing
784 -- Reason: see Note [Shadowing] in SpecConstr.lhs
792 -- Final clean-up simplification:
793 [ CoreDoSimplify (SimplPhase 0) [
794 MaxSimplifierIterations max_iter
798 -- -----------------------------------------------------------------------------
799 -- StgToDo: abstraction of stg-to-stg passes to run.
802 = StgDoMassageForProfiling -- should be (next to) last
803 -- There's also setStgVarInfo, but its absolute "lastness"
804 -- is so critical that it is hardwired in (no flag).
807 getStgToDo :: DynFlags -> [StgToDo]
809 | Just todo <- stgToDo dflags = todo -- set explicitly by user
812 stg_stats = dopt Opt_StgStats dflags
814 todo1 = if stg_stats then [D_stg_stats] else []
816 todo2 | WayProf `elem` wayNames dflags
817 = StgDoMassageForProfiling : todo1
821 -- -----------------------------------------------------------------------------
825 allFlags = map ('-':) $
826 [ name | (name, optkind) <- dynamic_flags, ok optkind ] ++
827 map ("fno-"++) flags ++
829 where ok (PrefixPred _ _) = False
831 flags = map fst fFlags
833 dynamic_flags :: [(String, OptKind DynP)]
835 ( "n" , NoArg (setDynFlag Opt_DryRun) )
836 , ( "cpp" , NoArg (setDynFlag Opt_Cpp))
837 , ( "F" , NoArg (setDynFlag Opt_Pp))
838 , ( "#include" , HasArg (addCmdlineHCInclude) )
839 , ( "v" , OptIntSuffix setVerbosity )
841 ------- Specific phases --------------------------------------------
842 , ( "pgmL" , HasArg (upd . setPgmL) )
843 , ( "pgmP" , HasArg (upd . setPgmP) )
844 , ( "pgmF" , HasArg (upd . setPgmF) )
845 , ( "pgmc" , HasArg (upd . setPgmc) )
846 , ( "pgmm" , HasArg (upd . setPgmm) )
847 , ( "pgms" , HasArg (upd . setPgms) )
848 , ( "pgma" , HasArg (upd . setPgma) )
849 , ( "pgml" , HasArg (upd . setPgml) )
850 , ( "pgmdll" , HasArg (upd . setPgmdll) )
852 , ( "optL" , HasArg (upd . addOptL) )
853 , ( "optP" , HasArg (upd . addOptP) )
854 , ( "optF" , HasArg (upd . addOptF) )
855 , ( "optc" , HasArg (upd . addOptc) )
856 , ( "optm" , HasArg (upd . addOptm) )
857 , ( "opta" , HasArg (upd . addOpta) )
858 , ( "optl" , HasArg (upd . addOptl) )
859 , ( "optdll" , HasArg (upd . addOptdll) )
860 , ( "optdep" , HasArg (upd . addOptdep) )
862 , ( "split-objs" , NoArg (if can_split
863 then setDynFlag Opt_SplitObjs
866 -------- Linking ----------------------------------------------------
867 , ( "c" , NoArg (upd $ \d -> d{ ghcLink=NoLink } ))
868 , ( "no-link" , NoArg (upd $ \d -> d{ ghcLink=NoLink } )) -- Dep.
869 , ( "-mk-dll" , NoArg (upd $ \d -> d{ ghcLink=MkDLL } ))
871 ------- Libraries ---------------------------------------------------
872 , ( "L" , Prefix addLibraryPath )
873 , ( "l" , AnySuffix (\s -> do upd (addOptl s)
876 ------- Frameworks --------------------------------------------------
877 -- -framework-path should really be -F ...
878 , ( "framework-path" , HasArg addFrameworkPath )
879 , ( "framework" , HasArg (upd . addCmdlineFramework) )
881 ------- Output Redirection ------------------------------------------
882 , ( "odir" , HasArg (upd . setObjectDir . Just))
883 , ( "o" , SepArg (upd . setOutputFile . Just))
884 , ( "ohi" , HasArg (upd . setOutputHi . Just ))
885 , ( "osuf" , HasArg (upd . setObjectSuf))
886 , ( "hcsuf" , HasArg (upd . setHcSuf))
887 , ( "hisuf" , HasArg (upd . setHiSuf))
888 , ( "hidir" , HasArg (upd . setHiDir . Just))
889 , ( "tmpdir" , HasArg (upd . setTmpDir))
890 , ( "stubdir" , HasArg (upd . setStubDir . Just))
892 ------- Keeping temporary files -------------------------------------
893 , ( "keep-hc-file" , AnySuffix (\_ -> setDynFlag Opt_KeepHcFiles))
894 , ( "keep-s-file" , AnySuffix (\_ -> setDynFlag Opt_KeepSFiles))
895 , ( "keep-raw-s-file", AnySuffix (\_ -> setDynFlag Opt_KeepRawSFiles))
896 , ( "keep-tmp-files" , AnySuffix (\_ -> setDynFlag Opt_KeepTmpFiles))
898 ------- Miscellaneous ----------------------------------------------
899 , ( "no-hs-main" , NoArg (setDynFlag Opt_NoHsMain))
900 , ( "main-is" , SepArg setMainIs )
901 , ( "haddock" , NoArg (setDynFlag Opt_Haddock) )
902 , ( "hpcdir" , SepArg setOptHpcDir )
904 ------- recompilation checker (DEPRECATED, use -fforce-recomp) -----
905 , ( "recomp" , NoArg (unSetDynFlag Opt_ForceRecomp) )
906 , ( "no-recomp" , NoArg (setDynFlag Opt_ForceRecomp) )
908 ------- Packages ----------------------------------------------------
909 , ( "package-conf" , HasArg extraPkgConf_ )
910 , ( "no-user-package-conf", NoArg (unSetDynFlag Opt_ReadUserPackageConf) )
911 , ( "package-name" , HasArg (upd . setPackageName) )
912 , ( "package" , HasArg exposePackage )
913 , ( "hide-package" , HasArg hidePackage )
914 , ( "hide-all-packages", NoArg (setDynFlag Opt_HideAllPackages) )
915 , ( "ignore-package" , HasArg ignorePackage )
916 , ( "syslib" , HasArg exposePackage ) -- for compatibility
918 ------ HsCpp opts ---------------------------------------------------
919 , ( "D", AnySuffix (upd . addOptP) )
920 , ( "U", AnySuffix (upd . addOptP) )
922 ------- Include/Import Paths ----------------------------------------
923 , ( "I" , Prefix addIncludePath)
924 , ( "i" , OptPrefix addImportPath )
926 ------ Debugging ----------------------------------------------------
927 , ( "dstg-stats", NoArg (setDynFlag Opt_StgStats))
929 , ( "ddump-cmm", setDumpFlag Opt_D_dump_cmm)
930 , ( "ddump-asm", setDumpFlag Opt_D_dump_asm)
931 , ( "ddump-cpranal", setDumpFlag Opt_D_dump_cpranal)
932 , ( "ddump-deriv", setDumpFlag Opt_D_dump_deriv)
933 , ( "ddump-ds", setDumpFlag Opt_D_dump_ds)
934 , ( "ddump-flatC", setDumpFlag Opt_D_dump_flatC)
935 , ( "ddump-foreign", setDumpFlag Opt_D_dump_foreign)
936 , ( "ddump-inlinings", setDumpFlag Opt_D_dump_inlinings)
937 , ( "ddump-rule-firings", setDumpFlag Opt_D_dump_rule_firings)
938 , ( "ddump-occur-anal", setDumpFlag Opt_D_dump_occur_anal)
939 , ( "ddump-parsed", setDumpFlag Opt_D_dump_parsed)
940 , ( "ddump-rn", setDumpFlag Opt_D_dump_rn)
941 , ( "ddump-simpl", setDumpFlag Opt_D_dump_simpl)
942 , ( "ddump-simpl-iterations", setDumpFlag Opt_D_dump_simpl_iterations)
943 , ( "ddump-spec", setDumpFlag Opt_D_dump_spec)
944 , ( "ddump-prep", setDumpFlag Opt_D_dump_prep)
945 , ( "ddump-stg", setDumpFlag Opt_D_dump_stg)
946 , ( "ddump-stranal", setDumpFlag Opt_D_dump_stranal)
947 , ( "ddump-tc", setDumpFlag Opt_D_dump_tc)
948 , ( "ddump-types", setDumpFlag Opt_D_dump_types)
949 , ( "ddump-rules", setDumpFlag Opt_D_dump_rules)
950 , ( "ddump-cse", setDumpFlag Opt_D_dump_cse)
951 , ( "ddump-worker-wrapper", setDumpFlag Opt_D_dump_worker_wrapper)
952 , ( "ddump-rn-trace", NoArg (setDynFlag Opt_D_dump_rn_trace))
953 , ( "ddump-if-trace", NoArg (setDynFlag Opt_D_dump_if_trace))
954 , ( "ddump-tc-trace", setDumpFlag Opt_D_dump_tc_trace)
955 , ( "ddump-splices", setDumpFlag Opt_D_dump_splices)
956 , ( "ddump-rn-stats", NoArg (setDynFlag Opt_D_dump_rn_stats))
957 , ( "ddump-opt-cmm", setDumpFlag Opt_D_dump_opt_cmm)
958 , ( "ddump-simpl-stats", setDumpFlag Opt_D_dump_simpl_stats)
959 , ( "ddump-bcos", setDumpFlag Opt_D_dump_BCOs)
960 , ( "dsource-stats", setDumpFlag Opt_D_source_stats)
961 , ( "dverbose-core2core", setDumpFlag Opt_D_verbose_core2core)
962 , ( "dverbose-stg2stg", setDumpFlag Opt_D_verbose_stg2stg)
963 , ( "ddump-hi-diffs", NoArg (setDynFlag Opt_D_dump_hi_diffs))
964 , ( "ddump-hi", setDumpFlag Opt_D_dump_hi)
965 , ( "ddump-minimal-imports", NoArg (setDynFlag Opt_D_dump_minimal_imports))
966 , ( "ddump-vect", setDumpFlag Opt_D_dump_vect)
967 , ( "ddump-hpc", setDumpFlag Opt_D_dump_hpc)
969 , ( "dcore-lint", NoArg (setDynFlag Opt_DoCoreLinting))
970 , ( "dstg-lint", NoArg (setDynFlag Opt_DoStgLinting))
971 , ( "dcmm-lint", NoArg (setDynFlag Opt_DoCmmLinting))
972 , ( "dshow-passes", NoArg (do setDynFlag Opt_ForceRecomp
973 setVerbosity (Just 2)) )
974 , ( "dfaststring-stats", NoArg (setDynFlag Opt_D_faststring_stats))
976 ------ Machine dependant (-m<blah>) stuff ---------------------------
978 , ( "monly-2-regs", NoArg (upd (\s -> s{stolen_x86_regs = 2}) ))
979 , ( "monly-3-regs", NoArg (upd (\s -> s{stolen_x86_regs = 3}) ))
980 , ( "monly-4-regs", NoArg (upd (\s -> s{stolen_x86_regs = 4}) ))
982 ------ Warning opts -------------------------------------------------
983 , ( "W" , NoArg (mapM_ setDynFlag minusWOpts) )
984 , ( "Werror" , NoArg (setDynFlag Opt_WarnIsError) )
985 , ( "Wall" , NoArg (mapM_ setDynFlag minusWallOpts) )
986 , ( "Wnot" , NoArg (mapM_ unSetDynFlag minusWallOpts) ) /* DEPREC */
987 , ( "w" , NoArg (mapM_ unSetDynFlag minusWallOpts) )
989 ------ Optimisation flags ------------------------------------------
990 , ( "O" , NoArg (upd (setOptLevel 1)))
991 , ( "Onot" , NoArg (upd (setOptLevel 0)))
992 , ( "O" , OptIntSuffix (\mb_n -> upd (setOptLevel (mb_n `orElse` 1))))
993 -- If the number is missing, use 1
995 , ( "fmax-simplifier-iterations", IntSuffix (\n ->
996 upd (\dfs -> dfs{ maxSimplIterations = n })) )
997 , ( "fliberate-case-threshold", IntSuffix (\n -> upd (\dfs -> dfs{ libCaseThreshold = n })))
998 , ( "frule-check", SepArg (\s -> upd (\dfs -> dfs{ ruleCheck = Just s })))
999 , ( "fcontext-stack" , IntSuffix $ \n -> upd $ \dfs -> dfs{ ctxtStkDepth = n })
1001 ------ Compiler flags -----------------------------------------------
1003 , ( "fno-code", NoArg (setTarget HscNothing))
1004 , ( "fasm", AnySuffix (\_ -> setTarget HscAsm) )
1005 , ( "fvia-c", NoArg (setTarget HscC) )
1006 , ( "fvia-C", NoArg (setTarget HscC) )
1008 , ( "fglasgow-exts", NoArg (mapM_ setDynFlag glasgowExtsFlags) )
1009 , ( "fno-glasgow-exts", NoArg (mapM_ unSetDynFlag glasgowExtsFlags) )
1012 -- the rest of the -f* and -fno-* flags
1013 , ( "fno-", PrefixPred (\f -> isFFlag f) (\f -> unSetDynFlag (getFFlag f)) )
1014 , ( "f", PrefixPred (\f -> isFFlag f) (\f -> setDynFlag (getFFlag f)) )
1017 -- these -f<blah> flags can all be reversed with -fno-<blah>
1020 ( "warn-duplicate-exports", Opt_WarnDuplicateExports ),
1021 ( "warn-hi-shadowing", Opt_WarnHiShadows ),
1022 ( "warn-incomplete-patterns", Opt_WarnIncompletePatterns ),
1023 ( "warn-incomplete-record-updates", Opt_WarnIncompletePatternsRecUpd ),
1024 ( "warn-missing-fields", Opt_WarnMissingFields ),
1025 ( "warn-missing-methods", Opt_WarnMissingMethods ),
1026 ( "warn-missing-signatures", Opt_WarnMissingSigs ),
1027 ( "warn-name-shadowing", Opt_WarnNameShadowing ),
1028 ( "warn-overlapping-patterns", Opt_WarnOverlappingPatterns ),
1029 ( "warn-simple-patterns", Opt_WarnSimplePatterns ),
1030 ( "warn-type-defaults", Opt_WarnTypeDefaults ),
1031 ( "warn-unused-binds", Opt_WarnUnusedBinds ),
1032 ( "warn-unused-imports", Opt_WarnUnusedImports ),
1033 ( "warn-unused-matches", Opt_WarnUnusedMatches ),
1034 ( "warn-deprecations", Opt_WarnDeprecations ),
1035 ( "warn-orphans", Opt_WarnOrphans ),
1036 ( "warn-tabs", Opt_WarnTabs ),
1037 ( "fi", Opt_FFI ), -- support `-ffi'...
1038 ( "ffi", Opt_FFI ), -- ...and also `-fffi'
1039 ( "arrows", Opt_Arrows ), -- arrow syntax
1040 ( "parr", Opt_PArr ),
1042 ( "implicit-prelude", Opt_ImplicitPrelude ),
1043 ( "scoped-type-variables", Opt_ScopedTypeVariables ),
1044 ( "bang-patterns", Opt_BangPatterns ),
1045 ( "indexed-types", Opt_IndexedTypes ),
1046 ( "monomorphism-restriction", Opt_MonomorphismRestriction ),
1047 ( "mono-pat-binds", Opt_MonoPatBinds ),
1048 ( "extended-default-rules", Opt_ExtendedDefaultRules ),
1049 ( "implicit-params", Opt_ImplicitParams ),
1050 ( "allow-overlapping-instances", Opt_AllowOverlappingInstances ),
1051 ( "allow-undecidable-instances", Opt_AllowUndecidableInstances ),
1052 ( "allow-incoherent-instances", Opt_AllowIncoherentInstances ),
1053 ( "generics", Opt_Generics ),
1054 ( "strictness", Opt_Strictness ),
1055 ( "full-laziness", Opt_FullLaziness ),
1057 ( "ignore-interface-pragmas", Opt_IgnoreInterfacePragmas ),
1058 ( "omit-interface-pragmas", Opt_OmitInterfacePragmas ),
1059 ( "do-lambda-eta-expansion", Opt_DoLambdaEtaExpansion ),
1060 ( "ignore-asserts", Opt_IgnoreAsserts ),
1061 ( "ignore-breakpoints", Opt_IgnoreBreakpoints),
1062 ( "do-eta-reduction", Opt_DoEtaReduction ),
1063 ( "case-merge", Opt_CaseMerge ),
1064 ( "unbox-strict-fields", Opt_UnboxStrictFields ),
1065 ( "dicts-cheap", Opt_DictsCheap ),
1066 ( "excess-precision", Opt_ExcessPrecision ),
1067 ( "asm-mangling", Opt_DoAsmMangling ),
1068 ( "print-bind-result", Opt_PrintBindResult ),
1069 #if defined(GHCI) && defined(DEBUGGER)
1070 ( "debugging", Opt_Debugging),
1072 ( "force-recomp", Opt_ForceRecomp ),
1073 ( "hpc-no-auto", Opt_Hpc_No_Auto )
1077 glasgowExtsFlags = [
1081 Opt_ScopedTypeVariables,
1084 isFFlag f = f `elem` (map fst fFlags)
1085 getFFlag f = fromJust (lookup f fFlags)
1087 -- -----------------------------------------------------------------------------
1088 -- Parsing the dynamic flags.
1090 parseDynamicFlags :: DynFlags -> [String] -> IO (DynFlags,[String])
1091 parseDynamicFlags dflags args = do
1092 let ((leftover,errs),dflags')
1093 = runCmdLine (processArgs dynamic_flags args) dflags
1094 when (not (null errs)) $ do
1095 throwDyn (UsageError (unlines errs))
1096 return (dflags', leftover)
1099 type DynP = CmdLineP DynFlags
1101 upd :: (DynFlags -> DynFlags) -> DynP ()
1103 dfs <- getCmdLineState
1104 putCmdLineState $! (f dfs)
1106 setDynFlag, unSetDynFlag :: DynFlag -> DynP ()
1107 setDynFlag f = upd (\dfs -> dopt_set dfs f)
1108 unSetDynFlag f = upd (\dfs -> dopt_unset dfs f)
1110 setDumpFlag :: DynFlag -> OptKind DynP
1111 setDumpFlag dump_flag
1112 = NoArg (setDynFlag Opt_ForceRecomp >> setDynFlag dump_flag)
1113 -- Whenver we -ddump, switch off the recompilation checker,
1114 -- else you don't see the dump!
1116 setVerbosity :: Maybe Int -> DynP ()
1117 setVerbosity mb_n = upd (\dfs -> dfs{ verbosity = mb_n `orElse` 3 })
1119 addCmdlineHCInclude a = upd (\s -> s{cmdlineHcIncludes = a : cmdlineHcIncludes s})
1121 extraPkgConf_ p = upd (\s -> s{ extraPkgConfs = p : extraPkgConfs s })
1124 upd (\s -> s{ packageFlags = ExposePackage p : packageFlags s })
1126 upd (\s -> s{ packageFlags = HidePackage p : packageFlags s })
1128 upd (\s -> s{ packageFlags = IgnorePackage p : packageFlags s })
1131 | Nothing <- unpackPackageId pid
1132 = throwDyn (CmdLineError ("cannot parse \'" ++ p ++ "\' as a package identifier"))
1134 = \s -> s{ thisPackage = pid }
1136 pid = stringToPackageId p
1138 -- we can only switch between HscC, and HscAsmm with dynamic flags
1139 -- (-fvia-C, -fasm, -filx respectively).
1140 setTarget l = upd (\dfs -> case hscTarget dfs of
1141 HscC -> dfs{ hscTarget = l }
1142 HscAsm -> dfs{ hscTarget = l }
1145 setOptLevel :: Int -> DynFlags -> DynFlags
1146 setOptLevel n dflags
1147 | hscTarget dflags == HscInterpreted && n > 0
1149 -- not in IO any more, oh well:
1150 -- putStr "warning: -O conflicts with --interactive; -O ignored.\n"
1152 = updOptLevel n dflags
1155 setMainIs :: String -> DynP ()
1157 | not (null main_fn) -- The arg looked like "Foo.baz"
1158 = upd $ \d -> d{ mainFunIs = Just main_fn,
1159 mainModIs = mkModule mainPackageId (mkModuleName main_mod) }
1161 | isUpper (head main_mod) -- The arg looked like "Foo"
1162 = upd $ \d -> d{ mainModIs = mkModule mainPackageId (mkModuleName main_mod) }
1164 | otherwise -- The arg looked like "baz"
1165 = upd $ \d -> d{ mainFunIs = Just main_mod }
1167 (main_mod, main_fn) = splitLongestPrefix arg (== '.')
1169 -----------------------------------------------------------------------------
1170 -- Paths & Libraries
1172 -- -i on its own deletes the import paths
1173 addImportPath "" = upd (\s -> s{importPaths = []})
1174 addImportPath p = upd (\s -> s{importPaths = importPaths s ++ splitPathList p})
1178 upd (\s -> s{libraryPaths = libraryPaths s ++ splitPathList p})
1181 upd (\s -> s{includePaths = includePaths s ++ splitPathList p})
1183 addFrameworkPath p =
1184 upd (\s -> s{frameworkPaths = frameworkPaths s ++ splitPathList p})
1186 split_marker = ':' -- not configurable (ToDo)
1188 splitPathList :: String -> [String]
1189 splitPathList s = filter notNull (splitUp s)
1190 -- empty paths are ignored: there might be a trailing
1191 -- ':' in the initial list, for example. Empty paths can
1192 -- cause confusion when they are translated into -I options
1193 -- for passing to gcc.
1195 #ifndef mingw32_TARGET_OS
1196 splitUp xs = split split_marker xs
1198 -- Windows: 'hybrid' support for DOS-style paths in directory lists.
1200 -- That is, if "foo:bar:baz" is used, this interpreted as
1201 -- consisting of three entries, 'foo', 'bar', 'baz'.
1202 -- However, with "c:/foo:c:\\foo;x:/bar", this is interpreted
1203 -- as 3 elts, "c:/foo", "c:\\foo", "x:/bar"
1205 -- Notice that no attempt is made to fully replace the 'standard'
1206 -- split marker ':' with the Windows / DOS one, ';'. The reason being
1207 -- that this will cause too much breakage for users & ':' will
1208 -- work fine even with DOS paths, if you're not insisting on being silly.
1211 splitUp (x:':':div:xs) | div `elem` dir_markers
1212 = ((x:':':div:p): splitUp rs)
1214 (p,rs) = findNextPath xs
1215 -- we used to check for existence of the path here, but that
1216 -- required the IO monad to be threaded through the command-line
1217 -- parser which is quite inconvenient. The
1218 splitUp xs = cons p (splitUp rs)
1220 (p,rs) = findNextPath xs
1225 -- will be called either when we've consumed nought or the
1226 -- "<Drive>:/" part of a DOS path, so splitting is just a Q of
1227 -- finding the next split marker.
1229 case break (`elem` split_markers) xs of
1230 (p, d:ds) -> (p, ds)
1233 split_markers :: [Char]
1234 split_markers = [':', ';']
1236 dir_markers :: [Char]
1237 dir_markers = ['/', '\\']
1240 -- -----------------------------------------------------------------------------
1241 -- tmpDir, where we store temporary files.
1243 setTmpDir :: FilePath -> DynFlags -> DynFlags
1244 setTmpDir dir dflags = dflags{ tmpDir = canonicalise dir }
1246 #if !defined(mingw32_HOST_OS)
1247 canonicalise p = normalisePath p
1249 -- Canonicalisation of temp path under win32 is a bit more
1250 -- involved: (a) strip trailing slash,
1251 -- (b) normalise slashes
1252 -- (c) just in case, if there is a prefix /cygdrive/x/, change to x:
1254 canonicalise path = normalisePath (xltCygdrive (removeTrailingSlash path))
1256 -- if we're operating under cygwin, and TMP/TEMP is of
1257 -- the form "/cygdrive/drive/path", translate this to
1258 -- "drive:/path" (as GHC isn't a cygwin app and doesn't
1259 -- understand /cygdrive paths.)
1261 | "/cygdrive/" `isPrefixOf` path =
1262 case drop (length "/cygdrive/") path of
1263 drive:xs@('/':_) -> drive:':':xs
1267 -- strip the trailing backslash (awful, but we only do this once).
1268 removeTrailingSlash path =
1275 -----------------------------------------------------------------------------
1278 setOptHpcDir :: String -> DynP ()
1279 setOptHpcDir arg = upd $ \ d -> d{hpcDir = arg}
1281 -----------------------------------------------------------------------------
1282 -- Via-C compilation stuff
1284 machdepCCOpts :: DynFlags -> ([String], -- flags for all C compilations
1285 [String]) -- for registerised HC compilations
1286 machdepCCOpts dflags
1287 #if alpha_TARGET_ARCH
1289 #ifdef HAVE_THREADED_RTS_SUPPORT
1293 -- For now, to suppress the gcc warning "call-clobbered
1294 -- register used for global register variable", we simply
1295 -- disable all warnings altogether using the -w flag. Oh well.
1297 #elif hppa_TARGET_ARCH
1298 -- ___HPUX_SOURCE, not _HPUX_SOURCE, is #defined if -ansi!
1299 -- (very nice, but too bad the HP /usr/include files don't agree.)
1300 = ( ["-D_HPUX_SOURCE"], [] )
1302 #elif m68k_TARGET_ARCH
1303 -- -fno-defer-pop : for the .hc files, we want all the pushing/
1304 -- popping of args to routines to be explicit; if we let things
1305 -- be deferred 'til after an STGJUMP, imminent death is certain!
1307 -- -fomit-frame-pointer : *don't*
1308 -- It's better to have a6 completely tied up being a frame pointer
1309 -- rather than let GCC pick random things to do with it.
1310 -- (If we want to steal a6, then we would try to do things
1311 -- as on iX86, where we *do* steal the frame pointer [%ebp].)
1312 = ( [], ["-fno-defer-pop", "-fno-omit-frame-pointer"] )
1314 #elif i386_TARGET_ARCH
1315 -- -fno-defer-pop : basically the same game as for m68k
1317 -- -fomit-frame-pointer : *must* in .hc files; because we're stealing
1318 -- the fp (%ebp) for our register maps.
1319 = let n_regs = stolen_x86_regs dflags
1322 ( [ if sta then "-DDONT_WANT_WIN32_DLL_SUPPORT" else ""
1323 -- , if suffixMatch "mingw32" cTARGETPLATFORM then "-mno-cygwin" else ""
1326 #ifdef HAVE_GCC_MNO_OMIT_LFPTR
1327 -- Some gccs are configured with
1328 -- -momit-leaf-frame-pointer on by default, and it
1329 -- apparently takes precedence over
1330 -- -fomit-frame-pointer, so we disable it first here.
1331 "-mno-omit-leaf-frame-pointer",
1333 #ifdef HAVE_GCC_HAS_NO_UNIT_AT_A_TIME
1334 "-fno-unit-at-a-time",
1335 -- unit-at-a-time doesn't do us any good, and screws
1336 -- up -split-objs by moving the split markers around.
1337 -- It's only turned on with -O2, but put it here just
1338 -- in case someone uses -optc-O2.
1340 "-fomit-frame-pointer",
1341 -- we want -fno-builtin, because when gcc inlines
1342 -- built-in functions like memcpy() it tends to
1343 -- run out of registers, requiring -monly-n-regs
1345 "-DSTOLEN_X86_REGS="++show n_regs ]
1348 #elif ia64_TARGET_ARCH
1349 = ( [], ["-fomit-frame-pointer", "-G0"] )
1351 #elif x86_64_TARGET_ARCH
1352 = ( [], ["-fomit-frame-pointer",
1353 "-fno-asynchronous-unwind-tables",
1354 -- the unwind tables are unnecessary for HC code,
1355 -- and get in the way of -split-objs. Another option
1356 -- would be to throw them away in the mangler, but this
1358 #ifdef HAVE_GCC_HAS_NO_UNIT_AT_A_TIME
1359 "-fno-unit-at-a-time",
1360 -- unit-at-a-time doesn't do us any good, and screws
1361 -- up -split-objs by moving the split markers around.
1362 -- It's only turned on with -O2, but put it here just
1363 -- in case someone uses -optc-O2.
1366 -- calling builtins like strlen() using the FFI can
1367 -- cause gcc to run out of regs, so use the external
1371 #elif sparc_TARGET_ARCH
1373 -- For now, to suppress the gcc warning "call-clobbered
1374 -- register used for global register variable", we simply
1375 -- disable all warnings altogether using the -w flag. Oh well.
1377 #elif powerpc_apple_darwin_TARGET
1379 -- Disable Apple's precompiling preprocessor. It's a great thing
1380 -- for "normal" programs, but it doesn't support register variable
1382 = ( [], ["-no-cpp-precomp"] )
1387 picCCOpts :: DynFlags -> [String]
1389 #if darwin_TARGET_OS
1390 -- Apple prefers to do things the other way round.
1391 -- PIC is on by default.
1392 -- -mdynamic-no-pic:
1393 -- Turn off PIC code generation.
1395 -- Don't generate "common" symbols - these are unwanted
1396 -- in dynamic libraries.
1401 = ["-mdynamic-no-pic"]
1402 #elif mingw32_TARGET_OS
1403 -- no -fPIC for Windows
1412 -- -----------------------------------------------------------------------------
1417 #if defined(i386_TARGET_ARCH) \
1418 || defined(x86_64_TARGET_ARCH) \
1419 || defined(alpha_TARGET_ARCH) \
1420 || defined(hppa_TARGET_ARCH) \
1421 || defined(m68k_TARGET_ARCH) \
1422 || defined(mips_TARGET_ARCH) \
1423 || defined(powerpc_TARGET_ARCH) \
1424 || defined(rs6000_TARGET_ARCH) \
1425 || defined(sparc_TARGET_ARCH)