From 6b67dc7ba7301274167519d5fcc38161b1a791a9 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 9 Mar 2011 16:24:27 +0100 Subject: Better libTIFF test --- config.h.in | 3 +++ configure | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- configure.ac | 8 ++++++-- 3 files changed, 62 insertions(+), 4 deletions(-) diff --git a/config.h.in b/config.h.in index 1393c5a6..165d8766 100644 --- a/config.h.in +++ b/config.h.in @@ -53,6 +53,9 @@ /* Define to 1 if libPNG is available */ #undef HAVE_LIBPNG +/* Define to 1 if you have the `tiff' library (-ltiff). */ +#undef HAVE_LIBTIFF + /* Define to 1 if your system has a GNU libc compatible `malloc' function, and to 0 otherwise. */ #undef HAVE_MALLOC diff --git a/configure b/configure index 1b502c5e..9f06a509 100755 --- a/configure +++ b/configure @@ -7002,15 +7002,59 @@ if test "${with_libtiff+set}" = set; then : withval=$with_libtiff; LIBTIFF_CFLAGS="-I$withval/include" LIBTIFF_LIBS="-L$withval/lib -ltiff" + have_libtiff=true else - LIBTIFF_LIBS="-ltiff" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for TIFFOpen in -ltiff" >&5 +$as_echo_n "checking for TIFFOpen in -ltiff... " >&6; } +if test "${ac_cv_lib_tiff_TIFFOpen+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ltiff $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char TIFFOpen (); +int +main () +{ +return TIFFOpen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_tiff_TIFFOpen=yes +else + ac_cv_lib_tiff_TIFFOpen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tiff_TIFFOpen" >&5 +$as_echo "$ac_cv_lib_tiff_TIFFOpen" >&6; } +if test "x$ac_cv_lib_tiff_TIFFOpen" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBTIFF 1 +_ACEOF + + LIBS="-ltiff $LIBS" +else + have_libtiff=true fi -$as_echo "#define HAVE_TIFF 1" >>confdefs.h +fi else @@ -7018,6 +7062,13 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } +fi +if test x$have_libtiff = xtrue; then : + + +$as_echo "#define HAVE_TIFF 1" >>confdefs.h + + fi diff --git a/configure.ac b/configure.ac index e35a7dda..c9f410da 100644 --- a/configure.ac +++ b/configure.ac @@ -157,13 +157,17 @@ AS_IF([test "x$enable_tiff" != "xno"], [ LIBTIFF_CFLAGS="-I$withval/include" LIBTIFF_LIBS="-L$withval/lib -ltiff" + have_libtiff=true ], [ - LIBTIFF_LIBS="-ltiff" + AC_CHECK_LIB([tiff], [TIFFOpen], [], [have_libtiff=true]) ]) - AC_DEFINE([HAVE_TIFF], [1], [Define to 1 if libTIFF is available]) ], [ AC_MSG_RESULT([no]) ]) +AS_IF([test x$have_libtiff = xtrue], +[ + AC_DEFINE([HAVE_TIFF], [1], [Define to 1 if libTIFF is available]) +]) AC_MSG_CHECKING([whether to use Cairo]) -- cgit v1.2.3