--- cmake-config.txt.orig	2019-09-25 12:54:33.000000000 -0700
+++ cmake-config.txt	2019-10-04 19:03:10.517020000 -0700
@@ -81,6 +81,7 @@
 option(USE_EXCEPTIONS "use C++ exceptions" ON)
 option(USE_FIXEDPOINT "use fixed point (instead of floating point) arithmetic" OFF)
 option(SPLASH_CMYK "include support for CMYK rasterization" OFF)
+option(USE_LIBPAPER "use libpaper" OFF)
 option(NO_FONTCONFIG "disable support for libfontconfig" OFF)
 option(SYSTEM_XPDFRC "full path for system-wide xpdfrc file" "")
 if (SYSTEM_XPDFRC)
@@ -212,7 +213,7 @@
       set(EXTRA_QT_LIBRARIES "-framework ApplicationServices")
     elseif (UNIX)
       find_package(Cups)
-      if (CUPS_FOUND)
+      if (CUPS)
         set(EXTRA_QT_LIBRARIES ${CUPS_LIBRARIES})
       else ()
         set (XPDFWIDGET_PRINTING OFF)
@@ -230,7 +231,7 @@
       set(EXTRA_QT_LIBRARIES "-framework ApplicationServices")
     elseif (UNIX)
       find_package(Cups)
-      if (CUPS_FOUND)
+      if (CUPS)
         set(EXTRA_QT_LIBRARIES ${CUPS_LIBRARIES})
       else ()
         set (XPDFWIDGET_PRINTING OFF)
@@ -248,6 +249,29 @@
              NAMES paper libpaper
              PATH_SUFFIXES lib64 lib
 )
+if(USE_LIBPAPER)
+  find_library(PAPER_LIBRARY
+    NAMES paper libpaper
+    HINTS
+    ${PAPER_DIR}
+    PATHS
+    /usr/local
+  )
+  find_path(PAPER_INCLUDE_DIR .h
+    HINTS
+    ${PAPER_DIR}
+    PATHS
+    /usr/local/include
+    PATH_SUFFIXES include
+  )
+ if (PAPER_INCLUDE_DIR AND PAPER_LIBRARY)
+   set(HAVE_PAPER_H TRUE)
+   message(STATUS "Found libpaper: ${PAPER_LIBRARY}")
+ else ()
+  set(HAVE_PAPER_H FALSE)
+  message(STATUS "libpaper not found")
+ endif ()
+endif ()
 if (PAPER_LIBRARY)
   set(HAVE_PAPER_H TRUE)
 else ()
