[project @ 2004-01-08 10:45:33 by simonmar]
[ghc-hetmet.git] / ghc / compiler / compMan / CompManager.lhs
index 2917879..c4c1913 100644 (file)
@@ -56,7 +56,7 @@ where
 
 import DriverPipeline  ( CompResult(..), preprocess, compile, link )
 import HscMain         ( newHscEnv )
-import DriverState     ( v_Output_file, v_NoHsMain )
+import DriverState     ( v_Output_file, v_NoHsMain, v_MainModIs )
 import DriverPhases
 import Finder
 import HscTypes
@@ -443,8 +443,11 @@ cmLoadModules cmstate1 mg2unsorted
         let verb = verbosity dflags
 
        -- Find out if we have a Main module
-        let a_root_is_Main 
-               = any ((=="Main").moduleNameUserString.modSummaryName) 
+       mb_main_mod <- readIORef v_MainModIs
+        let 
+           main_mod = mb_main_mod `orElse` "Main"
+           a_root_is_Main 
+               = any ((==main_mod).moduleNameUserString.modSummaryName) 
                      mg2unsorted
 
         let mg2unsorted_names = map modSummaryName mg2unsorted
@@ -573,7 +576,7 @@ cmLoadModules cmstate1 mg2unsorted
              let do_linking = a_root_is_Main || no_hs_main
              when (ghci_mode == Batch && isJust ofile && not do_linking
                     && verb > 0) $
-                hPutStrLn stderr "Warning: output was redirected with -o, but no output will be generated\nbecause there is no Main module."
+                hPutStrLn stderr ("Warning: output was redirected with -o, but no output will be generated\nbecause there is no " ++ main_mod ++ " module.")
 
              -- link everything together
               linkresult <- link ghci_mode dflags do_linking (hsc_HPT hsc_env3)