summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJehan Pag├Ęs <jehan@zemarmot.net>2014-08-12 19:05:03 (GMT)
committerAlbert Astals Cid <aacid@kde.org>2014-08-12 19:05:03 (GMT)
commite62e18e1b318d6fa664d236723de3c06ae43e86b (patch)
tree5e8e70ba9e0e408f285d5a3a80bea67477443053
parent572c60764bbbd2080bfd7a926c646ad20b467aea (diff)
poppler: use poppler-data pkg-config for both cmake and autotools buildsHEADmaster
-rw-r--r--CMakeLists.txt16
-rw-r--r--config.h.cmake2
-rw-r--r--configure.ac7
3 files changed, 23 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e100cd3..913d9f2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -232,6 +232,22 @@ if(LCMS2_FOUND)
include_directories(${LCMS2_INCLUDE_DIR})
endif(LCMS2_FOUND)
+# Recent versions of poppler-data install a .pc file.
+# Use it to determine the encoding data path, if available.
+# Default to the same prefix otherwise.
+pkg_check_modules(POPPLER_DATA poppler-data)
+if(POPPLER_DATA_FOUND)
+ execute_process(COMMAND "${PKG_CONFIG_EXECUTABLE}" --variable=poppler_datadir poppler-data
+ RESULT_VARIABLE _result_var
+ OUTPUT_VARIABLE _output_var OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(_result_var STREQUAL "0" AND NOT _output_var STREQUAL "")
+ set(POPPLER_DATADIR "${_output_var}")
+ endif(_result_var STREQUAL "0" AND NOT _output_var STREQUAL "")
+endif(POPPLER_DATA_FOUND)
+if(NOT DEFINED POPPLER_DATADIR)
+ set(POPPLER_DATADIR "${CMAKE_INSTALL_PREFIX}/share/poppler")
+endif(NOT DEFINED POPPLER_DATADIR)
+
if(DEFINED COMPILE_WARNINGS)
else(DEFINED COMPILE_WARNINGS)
set(COMPILE_WARNINGS "yes")
diff --git a/config.h.cmake b/config.h.cmake
index b707ba7..8ed1c92 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -169,7 +169,7 @@
#define PACKAGE_VERSION "${POPPLER_VERSION}"
/* Poppler data dir */
-#define POPPLER_DATADIR "${CMAKE_INSTALL_PREFIX}/share/poppler"
+#define POPPLER_DATADIR "${POPPLER_DATADIR}"
/* Support for curl based doc builder is compiled in. */
#cmakedefine POPPLER_HAS_CURL_SUPPORT 1
diff --git a/configure.ac b/configure.ac
index 477b2f7..ee20ed9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -105,7 +105,12 @@ if test x$enable_relocatable = xyes; then
fi
fi
-AC_DEFINE_DIR(POPPLER_DATADIR, "{datarootdir}/poppler", [Poppler data dir])
+dnl ##### Check for installed poppler-data. Use the same datarootdir as default otherwise.
+PKG_CHECK_EXISTS(poppler-data,
+ [POPPLER_DATADIR=`$PKG_CONFIG --variable=poppler_datadir poppler-data`
+ AC_DEFINE_DIR(POPPLER_DATADIR, "{POPPLER_DATADIR}", [Poppler data dir])],
+ [AC_DEFINE_DIR(POPPLER_DATADIR, "{datarootdir}/poppler", [Poppler data dir])]
+ )
dnl ##### Checks for header files.
AC_PATH_XTRA