+GLOBAL_VAR(v_GhcMode, DoLink, GhcMode)
+GLOBAL_VAR(v_GhcModeFlag, "", String)
+
+setMode :: GhcMode -> String -> IO ()
+setMode m flag = do
+ old_mode <- readIORef v_GhcMode
+ old_flag <- readIORef v_GhcModeFlag
+ when (not (null (old_flag))) $
+ throwDyn (UsageError
+ ("cannot use `" ++ old_flag ++ "' with `" ++ flag ++ "'"))
+ writeIORef v_GhcMode m
+ writeIORef v_GhcModeFlag flag
+
+isCompManagerMode DoMake = True
+isCompManagerMode DoInteractive = True
+isCompManagerMode _ = False