diff --git a/INSTALL b/INSTALL
index f13e57019..a1cd239e5 100644
--- a/INSTALL
+++ b/INSTALL
@@ -118,6 +118,13 @@ Just download the source tarball, unpack, and type:
 This will install the pandoc executable and the Haskell libraries,
 but not the shell scripts, man pages, or other documentation.
 
+You may just want the executable, or just the libraries.  This
+can be controlled with configuration flags (the `-` negates the
+flag):
+
+    runhaskell Setup.hs configure -f-library      # just the executable
+    runhaskell Setup.hs configure -f-executable   # just the libraries
+
 Note:  If you are using GHC 6.6.*, you will need to start by
 replacing `pandoc.cabal` with a version suitable for GHC 6.6:
 
diff --git a/pandoc.cabal b/pandoc.cabal
index d0d788499..3822b8e60 100644
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -64,6 +64,12 @@ Flag splitBase
 Flag highlighting
   Description:   Compile in support for syntax highlighting of code blocks.
   Default:       False
+Flag executable
+  Description:   Build the pandoc executable.
+  Default:       True
+Flag library
+  Description:   Build the pandoc library.
+  Default:       True
 
 Library
   if flag(splitBase)
@@ -107,8 +113,18 @@ Library
   Ghc-Options:     -O2 -Wall -threaded
   Ghc-Prof-Options: -auto-all
 
+  if flag(library)
+    Buildable:      True
+  else
+    Buildable:      False
+
 Executable pandoc
   Hs-Source-Dirs:     .
   Main-Is:            Main.hs
   Ghc-Options:        -O2 -Wall -threaded
   Ghc-Prof-Options:   -auto-all
+
+  if flag(executable)
+    Buildable:      True
+  else
+    Buildable:      False