[project @ 2001-03-06 11:23:46 by simonmar]
[ghc-hetmet.git] / ghc / compiler / main / Main.hs
index a5b094f..5c98696 100644 (file)
@@ -1,6 +1,6 @@
 {-# OPTIONS -fno-warn-incomplete-patterns #-}
 -----------------------------------------------------------------------------
--- $Id: Main.hs,v 1.56 2001/02/27 15:25:18 simonmar Exp $
+-- $Id: Main.hs,v 1.59 2001/03/06 11:23:46 simonmar Exp $
 --
 -- GHC Driver program
 --
@@ -18,6 +18,7 @@ module Main (main) where
 
 #ifdef GHCI
 import InteractiveUI
+import Char            ( toLower )
 #endif
 
 #ifndef mingw32_TARGET_OS
@@ -26,6 +27,7 @@ import Posix
 #endif
 
 import CompManager
+import ParsePkgConf
 import DriverPipeline
 import DriverState
 import DriverFlags
@@ -38,9 +40,9 @@ import TmpFiles
 import Finder          ( initFinder )
 import CmStaticInfo
 import Config
+import Outputable
 import Util
 
-
 import Concurrent
 import Directory
 import IOExts
@@ -138,7 +140,7 @@ main =
        else do am_inplace <- doesFileExist inplace_pkgconfig
                if am_inplace
                    then writeIORef v_Path_package_config inplace_pkgconfig
-                   else throwDyn (OtherError "can't find package.conf")
+                   else throwDyn (OtherError ("Can't find package.conf in " ++ inplace_pkgconfig))
 
        -- set the location of our various files
    if am_installed
@@ -154,8 +156,11 @@ main =
 
        -- read the package configuration
    conf_file <- readIORef v_Path_package_config
-   contents <- readFile conf_file
-   let pkg_details = read contents     -- ToDo: faster
+   r <- parsePkgConf conf_file
+   case r of {
+       Left err -> throwDyn (OtherError (showSDoc err));
+       Right pkg_details -> do
+
    writeIORef v_Package_details pkg_details
 
        -- find the phase to stop after (i.e. -E, -C, -c, -S flags)
@@ -296,7 +301,7 @@ main =
    when (mode == DoMkDependHS) endMkDependHS
    when (mode == DoLink) (doLink o_files)
    when (mode == DoMkDLL) (doMkDLL o_files)
-
+  }
        -- grab the last -B option on the command line, and
        -- set topDir to its value.
 setTopDir :: [String] -> IO [String]