AC_ARG_VAR(LIBTIFF_LIBS,[Tiff library to link against])
AC_ARG_VAR(LIBTIFF_CFLAGS,[Compile flags needed for TIFF support])
ac_libtiff=no
AC_ARG_WITH(libtiff,
AC_HELP_STRING([--with-libtiff=DIR],
[where the www.libtiff.org libtiff library is located]),
[ac_libtiff=$withval], [ac_libtiff=yes] )
AC_MSG_CHECKING([for Leffler libtiff library])
# Need to define TOP_SRCDIR for the cases where the LIBTIFF library
# is checked in with the code, at the top-level
TOP_SRCDIR=`cd $srcdir; pwd`
LOCAL_LIBTIFFDIR=$TOP_SRCDIR/libtiff
# First of all, deal with the case when 'cl.exe' is used as compiler
# indeed, when this is the case, we can only rely on finding
# the right library and includes, but we can't try compiling
# and linking. In addition, library needs to be specifically
# supplied on the link line and special flags are needed...
if test "x$CXX" = "xcl.exe" ; then
if test "x$ac_libtiff" = "xyes" ; then
# If LIBTIFF_LIBS has been set on configure command line
# or as environment variable, just use it if it exists
if test "x$LIBTIFF_LIBS" != "x" ; then
AC_MSG_RESULT(user specified as $LIBTIFF_LIBS)
if test "x$LIBTIFF_CFLAGS" = "x" ; then
AC_MSG_WARN(LIBTIFF_CFLAGS is empty)
fi
fi
# Otherwise, test if libtiff is at top level directory, under libtiff
if test "x$LIBTIFF_LIBS" = "x" && test -r "$LOCAL_LIBTIFFDIR/lib/libtiff.a" && test -r "$LOCAL_LIBTIFFDIR/lib/libjpeg.a" && test -r "$LOCAL_LIBTIFFDIR/lib/libz.a" ; then
if test "x$LIBTIFF_LIBS" = "x" && test -r "$GNUWIN32_BASE/lib/libtiff.a" && test -r "$GNUWIN32_BASE/lib/libjpeg.a" && test -r "$GNUWIN32_BASE/lib/libz.a" ; then
AC_MSG_RESULT($GNUWIN32_BASE/lib/libtiff.a)
AC_MSG_WARN($GNUWIN32_BASE/lib/libtiff.a version 3.5.7 works. Some versions like 3.6.1 do not!)
test x${LIBTIFF_LIBS+set} != xset && LIBTIFF_LIBS="$ac_libtiff/libtiff"
test x${LIBTIFF_CFLAGS+set} != xset && LIBTIFF_CFLAGS="-I$ac_libtiff"
fi
# If we are not using CL, that is we are either using gcc/cygwin
# or we are not running under Windows:
else
# Process specification
if test "x$ac_libtiff" = "xyes" ; then
if test "x$LIBTIFF_LIBS" = "x" ; then
# If local libtiff exists at top level, and we are running windows, use it first:
if test "x$USING_WIN" = "xyes" && test -r "$LOCAL_LIBTIFFDIR/lib/libtiff.a" && test -r "$LOCAL_LIBTIFFDIR/lib/libjpeg.a" && test -r "$LOCAL_LIBTIFFDIR/lib/libz.a" ; then