dnl Copyright (C) 2009-2010 Nick Bowler dnl Copying and distribution of this file, with or without modification, dnl are permitted in any medium without royalty provided the copyright dnl notice and this notice are preserved. This file is offered as-is, dnl without any warranty. dnl _DX_LIBPNG_TEST_PROGRAM(major, minor, release) AC_DEFUN([_DX_LIBPNG_TEST_PROGRAM], [AC_LANG_PROGRAM([dnl #include ifelse([$1], [], [], [dnl #if PNG_LIBPNG_VER_MAJOR < $1 # error Invalid libpng major version ifelse([$2], [], [], [dnl #elif PNG_LIBPNG_VER_MAJOR == $1 # if PNG_LIBPNG_VER_MINOR < $2 # error Invalid libpng minor version ifelse([$3], [], [], [dnl # elif PNG_LIBPNG_VER_MINOR == $2 # if PNG_LIBPNG_VER_RELEASE < $3 # error Invalid libpng release # endif ])dnl # endif ])dnl #endif ])dnl ], [dnl png_structp png = png_create_read_struct("", 0, 0, 0); png_infop info = png_create_info_struct(png); ])]) dnl DX_CHECK_LIBPNG([min-version], [action-if-ok], [action-if-fail]) AC_DEFUN([DX_CHECK_LIBPNG], [DX_PKG_CONFIG([libpng], [libpng], [libpng]) DX_CHECK_LIB([libpng], [for libpng[]ifelse([$1], [], [], [ version at least $1])], [m4_apply([_DX_LIBPNG_TEST_PROGRAM], m4_split([$1], [\.]))], [dnl [[$LIBPNG_CFLAGS], [$LIBPNG_LIBS]], [[$pkg_cv_libpng_cflags], [$pkg_cv_libpng_libs], [test ! x"$pkg_failed" = x"yes"]], [[], [-lpng]], ]) if test x"$dx_cv_libpng_found" = x"yes"; then ifelse([$2], [], [:], [$2]) else ifelse([$3], [], [AC_MSG_FAILURE([dnl libpng[]ifelse([$1], [], [], [ version at least $1]) is required. The latest version can be obtained from http://libpng.org/pub/png/libpng.html. If libpng is installed but was not found by this configure script, consider adjusting LIBPNG_CFLAGS and/or LIBPNG_LIBS as necessary. If pkg-config is installed, it may help to adjust PKG_CONFIG_PATH if libpng is installed in a non-standard prefix. ])], [$3]) fi ])