1# Public macros for the TeX Live (TL) tree.
2# Copyright (C) 2009-2012 Peter Breitenlohner <tex-live@tug.org>
3#
4# This file is free software; the copyright holder
5# gives unlimited permission to copy and/or distribute it,
6# with or without modifications, as long as this notice is preserved.
7
8# KPSE_XPDF_FLAGS
9# ---------------
10# Provide the configure option '--with-system-xpdf' (if in the TL tree).
11#
12# Set the make variables XPDF_INCLUDES and XPDF_LIBS to the CPPFLAGS and
13# LIBS required for the `-lxpdf' library in libs/xpdf/ of the TL tree.
14AC_DEFUN([KPSE_XPDF_FLAGS],
15[AC_REQUIRE([KPSE_CHECK_WIN32])[]dnl
16_KPSE_LIB_FLAGS([xpdf], [xpdf], [],
17                [-DPDF_PARSER_ONLY -IBLD/libs/xpdf -IBLD/libs/xpdf/goo -IBLD/libs/xpdf/xpdf],
18                [BLD/libs/xpdf/libxpdf.a], [],
19                [], [${top_builddir}/../../libs/xpdf/xpdf/Stream.h])[]dnl
20test "x$kpse_cv_have_win32" = xno || XPDF_LIBS="$XPDF_LIBS -lgdi32"
21]) # KPSE_XPDF_FLAGS
22
23# KPSE_XPDF_OPTIONS([WITH-SYSTEM])
24# --------------------------------
25AC_DEFUN([KPSE_XPDF_OPTIONS],
26[m4_ifval([$1],
27          [AC_ARG_WITH([system-xpdf],
28                       AS_HELP_STRING([--with-system-xpdf],
29                                      [use installed poppler headers and library instead of xpdf library from TL (requires pkg-config)]))])[]dnl
30]) # KPSE_XPDF_OPTIONS
31
32# KPSE_XPDF_SYSTEM_FLAGS
33# ----------------------
34AC_DEFUN([KPSE_XPDF_SYSTEM_FLAGS],
35[AC_REQUIRE([_KPSE_CHECK_PKG_CONFIG])[]dnl
36if $PKG_CONFIG poppler --atleast-version=0.12; then
37  POPPLER_VERSION='-DPOPPLER_VERSION=\"'`$PKG_CONFIG poppler --modversion`'\"'
38  XPDF_INCLUDES="$POPPLER_VERSION `$PKG_CONFIG poppler --cflags`"
39  XPDF_LIBS=`$PKG_CONFIG poppler --libs`
40elif test "x$need_xpdf:$with_system_xpdf" = xyes:yes; then
41  AC_MSG_ERROR([did not find poppler-0.12 or better])
42fi
43]) # KPSE_XPDF_SYSTEM_FLAGS
44