summaryrefslogtreecommitdiff
path: root/Build/source/m4/kpse-libpng-flags.m4
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/m4/kpse-libpng-flags.m4')
-rw-r--r--Build/source/m4/kpse-libpng-flags.m423
1 files changed, 18 insertions, 5 deletions
diff --git a/Build/source/m4/kpse-libpng-flags.m4 b/Build/source/m4/kpse-libpng-flags.m4
index a9283884b0f..433100c0c98 100644
--- a/Build/source/m4/kpse-libpng-flags.m4
+++ b/Build/source/m4/kpse-libpng-flags.m4
@@ -1,5 +1,5 @@
# Public macros for the TeX Live (TL) tree.
-# Copyright (C) 2009 Peter Breitenlohner <tex-live@tug.org>
+# Copyright (C) 2009, 2011 Peter Breitenlohner <tex-live@tug.org>
#
# This file is free software; the copyright holder
# gives unlimited permission to copy and/or distribute it,
@@ -9,8 +9,7 @@
# KPSE_LIBPNG_FLAGS
# -----------------
-# Provide the configure options '--with-system-libpng' (if in the TL tree),
-# '--with-libpng-includes', and '--with-libpng-libdir'.
+# Provide the configure options '--with-system-libpng' (if in the TL tree).
#
# Set the make variables LIBPNG_INCLUDES and LIBPNG_LIBS to the CPPFLAGS and
# LIBS required for the `-lpng' library in libs/libpng/ of the TL tree.
@@ -23,8 +22,22 @@ _KPSE_LIB_FLAGS([libpng], [png], [],
# KPSE_LIBPNG_OPTIONS([WITH-SYSTEM])
# ----------------------------------
-AC_DEFUN([KPSE_LIBPNG_OPTIONS], [_KPSE_LIB_OPTIONS([libpng], [$1])])
+AC_DEFUN([KPSE_LIBPNG_OPTIONS],
+[m4_ifval([$1],
+ [AC_ARG_WITH([system-libpng],
+ AS_HELP_STRING([--with-system-libpng],
+ [use installed libpng headers and library
+ (requires pkg-config)]))])[]dnl
+]) # KPSE_LIBPNG_OPTIONS
# KPSE_LIBPNG_SYSTEM_FLAGS
# ------------------------
-AC_DEFUN([KPSE_LIBPNG_SYSTEM_FLAGS], [_KPSE_LIB_FLAGS_SYSTEM([libpng], [png])])
+AC_DEFUN([KPSE_LIBPNG_SYSTEM_FLAGS],
+[AC_REQUIRE([_KPSE_CHECK_PKG_CONFIG])[]dnl
+if $PKG_CONFIG libpng; then
+ LIBPNG_INCLUDES=`$PKG_CONFIG libpng --cflags`
+ LIBPNG_LIBS=`$PKG_CONFIG libpng --libs`
+elif test "x$need_libpng:$with_system_libpng" = xyes:yes; then
+ AC_MSG_ERROR([did not find libpng])
+fi
+]) # KPSE_LIBPNG_SYSTEM_FLAGS