diff --git a/Setup.hs b/Setup.hs
--- a/Setup.hs
+++ b/Setup.hs
@@ -4,14 +4,12 @@
 import Distribution.Simple.LocalBuildInfo
 import Distribution.InstalledPackageInfo
 import Distribution.Simple.Program
---import Distribution.Simple.PackageIndex as Pkg
-import Distribution.Simple.PackageSet as Pkg
+import Distribution.Simple.PackageIndex as Pkg
 
 import System.Exit
 import System.IO
 import Data.IORef
 import Data.Char
-import Data.List
 import Data.Maybe
 
 main = defaultMainWithHooks simpleUserHooks {
@@ -41,9 +39,9 @@
                           Nothing -> error "ghc was not found"
 
           -- figure out docdir from base's haddock-html field
-          base_pkg = case lookupPackageName (installedPkgs lbi) (PackageName "base") of
-                        [] -> error "no base package"
-                        [x] -> x
+          base_pkg = case searchByName (installedPkgs lbi) "base" of
+                        None -> error "no base package"
+                        Unambiguous (x:_) -> x
                         _ -> error "base ambiguous"
           base_html = case haddockHTMLs base_pkg of
                         [] -> ""
@@ -53,12 +51,11 @@
                                                   (reverse base_html))
 
       let buildinfo = emptyBuildInfo{
-              cppOptions = ["-DGHC_PATHS_GHC_PKG=" ++ show ghc_pkg,
-                            "-DGHC_PATHS_GHC=" ++ show ghc,
-                            "-DGHC_PATHS_LIBDIR=" ++ show libdir,
-                            "-DGHC_PATHS_DOCDIR=" ++ show docdir ]
-            }
-
+               cppOptions = ["-DGHC_PATHS_GHC_PKG=\"" ++ ghc_pkg ++ "\"",
+                             "-DGHC_PATHS_GHC=\"" ++ ghc ++ "\"",
+                             "-DGHC_PATHS_LIBDIR=\"" ++ libdir ++ "\"",
+                             "-DGHC_PATHS_DOCDIR=\"" ++ docdir ++ "\"" ]
+             }
       writeFile file (show buildinfo)
 
     readHook :: Args -> a -> IO HookedBuildInfo
@@ -74,3 +71,8 @@
   hPutStr stderr msg
   exitWith (ExitFailure 1)
 
+stripPrefix :: Eq a => [a] -> [a] -> Maybe [a]
+stripPrefix [] ys = Just ys
+stripPrefix (x:xs) (y:ys)
+ | x == y = stripPrefix xs ys
+stripPrefix _ _ = Nothing
diff --git a/ghc-paths.cabal b/ghc-paths.cabal
--- a/ghc-paths.cabal
+++ b/ghc-paths.cabal
@@ -1,5 +1,5 @@
 name: ghc-paths
-version: 0.1.0.3
+version: 0.1.0.4
 license: BSD3
 license-file: LICENSE
 copyright: (c) Simon Marlow
