Deprecate NewQualifiedOperators extension (rejected by H')
[ghc-hetmet.git] / utils / ghc-pkg / Main.hs
index 03a547d..940e404 100644 (file)
@@ -27,14 +27,8 @@ import Text.Printf
 
 import Prelude
 
-#include "../../includes/ghcconfig.h"
-
 import System.Console.GetOpt
-#if __GLASGOW_HASKELL__ >= 609
 import qualified Control.Exception as Exception
-#else
-import qualified Control.Exception.Extensible as Exception
-#endif
 import Data.Maybe
 
 import Data.Char ( isSpace, toLower )
@@ -60,12 +54,8 @@ import Foreign.C
 
 #if __GLASGOW_HASKELL__ < 612
 import System.Posix.Internals
-#if __GLASGOW_HASKELL__ >= 611
-import GHC.IO.Handle.FD (fdToHandle)
-#else
 import GHC.Handle (fdToHandle)
 #endif
-#endif
 
 #ifdef mingw32_HOST_OS
 import GHC.ConsoleHandler
@@ -1296,6 +1286,9 @@ checkDir warn_only thisfield d
  | "$topdir"     `isPrefixOf` d = return ()
  | "$httptopdir" `isPrefixOf` d = return ()
         -- can't check these, because we don't know what $(http)topdir is
+ | isRelative d = verror ForceFiles $
+                     thisfield ++ ": " ++ d ++ " is a relative path"
+        -- relative paths don't make any sense; #4134
  | otherwise = do
    there <- liftIO $ doesDirectoryExist d
    when (not there) $
@@ -1537,7 +1530,7 @@ installSignalHandlers = do
   _ <- installHandler sigQUIT (Catch interrupt) Nothing
   _ <- installHandler sigINT  (Catch interrupt) Nothing
   return ()
-#elif __GLASGOW_HASKELL__ >= 603
+#else
   -- GHC 6.3+ has support for console events on Windows
   -- NOTE: running GHCi under a bash shell for some reason requires
   -- you to press Ctrl-Break rather than Ctrl-C to provoke
@@ -1549,13 +1542,6 @@ installSignalHandlers = do
 
   _ <- installHandler (Catch sig_handler)
   return ()
-#else
-  return () -- nothing
-#endif
-
-#if __GLASGOW_HASKELL__ <= 604
-isInfixOf               :: (Eq a) => [a] -> [a] -> Bool
-isInfixOf needle haystack = any (isPrefixOf needle) (tails haystack)
 #endif
 
 #if mingw32_HOST_OS || mingw32_TARGET_OS
@@ -1649,9 +1635,7 @@ openNewFile dir template = do
 
     oflags = rw_flags .|. o_EXCL
 
-#if __GLASGOW_HASKELL__ < 611
     withFilePath = withCString
-#endif
 
     findTempName x = do
       fd <- withFilePath filepath $ \ f ->
@@ -1667,11 +1651,7 @@ openNewFile dir template = do
          -- as any exceptions etc will only be able to report the
          -- fd currently
          h <-
-#if __GLASGOW_HASKELL__ >= 609
               fdToHandle fd
-#else
-              fdToHandle (fromIntegral fd)
-#endif
               `Exception.onException` c_close fd
          return (filepath, h)
       where