From cccf458bc431d5acf57051e42292f42ea20ebb7e Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Tue, 11 Jan 2011 17:34:27 +0000 Subject: build system: use pkg-config to detect installed libpng git-svn-id: svn://tug.org/texlive/trunk@21029 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/m4/kpse-libpng-flags.m4 | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'Build/source/m4') 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 +# Copyright (C) 2009, 2011 Peter Breitenlohner # # 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 -- cgit v1.2.3