diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,10 @@
+0.10.2.0
+--------
+
+- Split the c library dependency into separate packages.
+  Now the dependencies are either all `build-type: Simple` (`-f +use-pkg-config`)
+  or  `build-type: Configure` (`-f -use-pkg-config`).
+
 0.10.1.0
 --------
 
diff --git a/Setup.hs b/Setup.hs
deleted file mode 100644
--- a/Setup.hs
+++ /dev/null
@@ -1,55 +0,0 @@
-module Main (main) where
-
-import Distribution.Simple
-import Distribution.Simple.Setup
-import Distribution.PackageDescription
-import Distribution.Version
-
-import Distribution.Simple.LocalBuildInfo
-import Distribution.Simple.Program
-import Distribution.Verbosity
-
-import Data.Char (isSpace)
-import Data.List (dropWhile,reverse)
-
-import Distribution.Types.UnqualComponentName
-
-flag :: String -> FlagName
-flag = mkFlagName
-
-unqualComponentName :: String -> UnqualComponentName
-unqualComponentName = mkUnqualComponentName
-
-main :: IO ()
-main = defaultMainWithHooks simpleUserHooks {
-  confHook = \pkg flags -> do
-    if lookup (flag "use-pkg-config")
-              (unFlagAssignment (configConfigurationsFlags flags)) == Just True
-    then do
-      confHook simpleUserHooks pkg flags
-    else do
-      lbi <- confHook simpleUserHooks pkg flags
-      bi <- psqlBuildInfo lbi
-
-      return lbi {
-        localPkgDescr = updatePackageDescription
-                          (Just bi, [(unqualComponentName "runtests", bi)]) (localPkgDescr lbi)
-      }
-}
-
-psqlBuildInfo :: LocalBuildInfo -> IO BuildInfo
-psqlBuildInfo lbi = do
-  (pgconfigProg, _) <- requireProgram verbosity
-                         (simpleProgram "pg_config") (withPrograms lbi)
-  let pgconfig = getProgramOutput verbosity pgconfigProg
-
-  incDir <- pgconfig ["--includedir"]
-  libDir <- pgconfig ["--libdir"]
-
-  return emptyBuildInfo {
-    extraLibDirs = [strip libDir],
-    includeDirs  = [strip incDir]
-  }
-  where
-    verbosity = normal -- honestly, this is a hack
-    strip x = dropWhile isSpace $ reverse $ dropWhile isSpace $ reverse x
diff --git a/postgresql-libpq.cabal b/postgresql-libpq.cabal
--- a/postgresql-libpq.cabal
+++ b/postgresql-libpq.cabal
@@ -1,6 +1,6 @@
 cabal-version:      2.4
 name:               postgresql-libpq
-version:            0.10.1.0
+version:            0.10.2.0
 synopsis:           low-level binding to libpq
 description:
   This is a binding to libpq: the C application
@@ -21,7 +21,7 @@
   (c) 2011 Leon P Smith
 
 category:           Database
-build-type:         Custom
+build-type:         Simple
 extra-source-files: cbits/hs-libpq.h
 tested-with:
   GHC ==8.6.5
@@ -32,14 +32,10 @@
    || ==9.4.8
    || ==9.6.5
    || ==9.8.2
+   || ==9.10.1
 
 extra-source-files: CHANGELOG.md
 
-custom-setup
-  setup-depends:
-    , base   >=4.12.0.0 && <5
-    , Cabal  >=2.4      && <3.11
-
 -- If true,  use pkg-config,  otherwise use the pg_config based build
 -- configuration
 flag use-pkg-config
@@ -75,34 +71,20 @@
     Database.PostgreSQL.LibPQ.Ptr
 
   build-depends:
-    , base        >=4.12.0.0 && <4.20
+    , base        >=4.12.0.0 && <4.21
     , bytestring  >=0.10.8.2 && <0.13
 
   if !os(windows)
     build-depends: unix >=2.7.2.2 && <2.9
 
   if os(windows)
-    build-depends: Win32 >=2.2.0.2 && <2.14
+    build-depends: Win32 >=2.2.0.2 && <2.15
 
   if flag(use-pkg-config)
-    pkgconfig-depends: libpq >=10.22
+    build-depends: postgresql-libpq-pkgconfig ^>=0.10
 
   else
-    if os(windows)
-      -- Due to https://sourceware.org/bugzilla/show_bug.cgi?id=22948,
-      -- if we specify pq instead of libpq, then ld might link against
-      -- libpq.dll directly, which can lead to segfaults. As a temporary hack,
-      -- we force ld to link against the libpq.lib import library directly
-      -- by specifying libpq here.
-      extra-libraries: libpq
-
-    else
-      extra-libraries: pq
-
-      if os(openbsd)
-        extra-libraries:
-          crypto
-          ssl
+    build-depends: postgresql-libpq-configure ^>=0.10
 
   build-tool-depends: hsc2hs:hsc2hs >=0.68.5
 
