9ff0261999-04-07Per Hedbor AC_INIT(image_tiff.c) AC_CONFIG_HEADER(config.h) AC_ARG_WITH(tifflib, [ --with(out)-tifflib Support TIFF (Image.TIFF)],[],[with_tifflib=yes]) AC_MODULE_INIT()
8c885e2001-02-13Mirar (Pontus Hagland) PIKE_FEATURE_WITHOUT(Image.TIFF)
774c0d2001-02-13Mirar (Pontus Hagland) 
9ff0261999-04-07Per Hedbor if test x$with_tifflib = xyes ; then
8c885e2001-02-13Mirar (Pontus Hagland)  PIKE_FEATURE_NODEP(Image.TIFF)
774c0d2001-02-13Mirar (Pontus Hagland) 
f9ba572003-07-24Henrik Grubbström (Grubba)  AC_CHECK_HEADERS(tiff.h tiffvers.h tiffio.h tiffiop.h)
91428f1999-04-10Per Hedbor  if test $ac_cv_header_tiff_h = yes ; then
46468a2004-03-04Henrik Grubbström (Grubba)  AC_CHECK_LIB(m, floor)
9845e92004-11-03Henrik Grubbström (Grubba)  AC_CHECK_LIB(jpeg, jpeg_CreateCompress)
6f2b3c2008-07-18Martin Stjernholm  AC_SEARCH_LIBS(inflate, z gz zlib) AC_SEARCH_LIBS(TIFFOpen, tiff libtiff)
46468a2004-03-04Henrik Grubbström (Grubba) 
52a3012002-08-20Henrik Grubbström (Grubba)  AC_MSG_CHECKING([if this tifflib is working])
28499f2002-08-20Henrik Grubbström (Grubba)  AC_CACHE_VAL(pike_cv_working_tiff, [
46468a2004-03-04Henrik Grubbström (Grubba)  # Some tiff libraries are broken, and will thrash memory. # eg the one on RedHat 7.1/ia64.
e234fd2004-03-05Henrik Grubbström (Grubba)  # Copy the test image to the build directory, so that our # test program can find it. if cmp "$srcdir/test_image.tiff" "test_image.tiff" 2>/dev/null; then : else if test -f "test_image.tiff"; then rm -f "test_image.tiff" fi cp "$srcdir/test_image.tiff" "test_image.tiff" fi
46468a2004-03-04Henrik Grubbström (Grubba)  AC_TRY_RUN([ #ifdef INLINE #undef INLINE #endif #include <tiff.h> #ifdef HAVE_TIFFIOP_H #include <tiffiop.h> #endif #include <tiffio.h> #include <stdio.h> #include <errno.h> int main(int argc, char **argv) { TIFF *tif = TIFFOpen("test_image.tiff", "r"); uint32 w, h, *raster; if (!tif) { fprintf(stderr, "Failed to open image. errno:%d\n", errno); return 1; } TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w); TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h); if (!(raster = (void *)malloc(w*h*sizeof(uint32)))) { fprintf(stderr, "Failed to allocate memory for image (%d * %d).\n", w, h); return 1; } if (!TIFFReadRGBAImage(tif, w, h, raster, 0)) { fprintf(stderr, "Failed to decode image.\n"); return 1; } return 0; } ], [ pike_cv_working_tiff=yes ], [ pike_cv_working_tiff=no ], [ AC_TRY_COMPILE([ #ifdef INLINE #undef INLINE #endif
28499f2002-08-20Henrik Grubbström (Grubba) #include <tiff.h>
46468a2004-03-04Henrik Grubbström (Grubba) #ifdef HAVE_TIFFIOP_H #include <tiffiop.h> #endif #include <tiffio.h> #include <stdio.h> #include <errno.h> ], [ { TIFF *tif = TIFFOpen("test_image.tiff", "r"); uint32 w, h, *raster; if (!tif) { fprintf(stderr, "Failed to open image. errno:%d\n", errno); return 1; } TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w); TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h); if (!(raster = (void *)malloc(w*h*sizeof(uint32)))) { fprintf(stderr, "Failed to allocate memory for image (%d * %d).\n", w, h); return 1; } if (!TIFFReadRGBAImage(tif, w, h, raster, 0)) { fprintf(stderr, "Failed to decode image.\n"); return 1; } return 0; } ], [ pike_cv_working_tiff=yes ], [ pike_cv_working_tiff=no ]) ])
28499f2002-08-20Henrik Grubbström (Grubba)  ]) if test "x$pike_cv_working_tiff" = "xno"; then AC_MSG_RESULT([no])
52a3012002-08-20Henrik Grubbström (Grubba)  PIKE_FEATURE([Image.TIFF],[no (tifflib version 42)])
28499f2002-08-20Henrik Grubbström (Grubba)  else AC_MSG_RESULT([yes])
13670c2015-05-25Martin Nilsson  AC_DEFINE(HAVE_WORKING_LIBTIFF)
46468a2004-03-04Henrik Grubbström (Grubba)  PIKE_FEATURE_OK(Image.TIFF)
f9ba572003-07-24Henrik Grubbström (Grubba)  AC_MSG_CHECKING(for version of tifflib) if test "x$ac_cv_header_tiffvers_h" = "xyes"; then cat >conftest.$ac_ext <<EOF #include <tiffvers.h> VERSION:TIFFLIB_VERSION EOF vers=`eval "$ac_cpp conftest.$ac_ext" 2>&5 | sed -e '/VERSION:/s/VERSION://p' -ed` if test "x$vers" = "x"; then AC_MSG_RESULT([Unknown (failed to parse tiffvers.h)]) else AC_MSG_RESULT([$vers]) fi rm -f conftest* else AC_MSG_RESULT([Unknown (no tiffvers.h)]) fi
28499f2002-08-20Henrik Grubbström (Grubba)  fi
9ff0261999-04-07Per Hedbor  fi fi AC_OUTPUT(Makefile,echo FOO >stamp-h )