1dnl                                               -*- Autoconf -*-
2dnl Tag Image File Format (TIFF) Software
3dnl
4dnl Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
5dnl
6dnl Permission to use, copy, modify, distribute, and sell this software and
7dnl its documentation for any purpose is hereby granted without fee, provided
8dnl that (i) the above copyright notices and this permission notice appear in
9dnl all copies of the software and related documentation, and (ii) the names of
10dnl Sam Leffler and Silicon Graphics may not be used in any advertising or
11dnl publicity relating to the software without the specific, prior written
12dnl permission of Sam Leffler and Silicon Graphics.
13dnl
14dnl THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
15dnl EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
16dnl WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
17dnl
18dnl IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
19dnl ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
20dnl OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
21dnl WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
22dnl LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
23dnl OF THIS SOFTWARE.
24
25dnl Process this file with autoconf to produce a configure script.
26
27AC_PREREQ(2.64)
28AC_INIT([LibTIFF Software],[4.1.0],[tiff@lists.maptools.org],[tiff])
29AC_CONFIG_AUX_DIR(config)
30AC_CONFIG_MACRO_DIR(m4)
31AC_LANG(C)
32
33dnl Compute the canonical host (run-time) system type variable
34AC_CANONICAL_HOST
35
36AM_INIT_AUTOMAKE(tar-pax)
37dnl Do not rebuild generated files every time
38AM_MAINTAINER_MODE
39
40dnl Versioning.
41dnl Don't fill the ALPHA_VERSION field, if not applicable.
42LIBTIFF_MAJOR_VERSION=4
43LIBTIFF_MINOR_VERSION=1
44LIBTIFF_MICRO_VERSION=0
45LIBTIFF_ALPHA_VERSION=
46LIBTIFF_VERSION=$LIBTIFF_MAJOR_VERSION.$LIBTIFF_MINOR_VERSION.$LIBTIFF_MICRO_VERSION$LIBTIFF_ALPHA_VERSION
47dnl This will be used with the 'make release' target
48LIBTIFF_RELEASE_DATE=`date +"%Y%m%d"`
49
50dnl Libtool library revision control info
51dnl See the libtool documentation under the heading "Libtool's versioning
52dnl system" in order to understand the meaning of these fields
53dnl
54dnl current
55dnl      The most recent interface number that this library implements.
56dnl revision
57dnl      The implementation number of the current interface.
58dnl age
59dnl      The difference between the newest and oldest interfaces that
60dnl      this library implements. In other words, the library implements
61dnl      all the interface numbers in the range from number current -
62dnl      age to current.
63dnl
64dnl Here are a set of rules to help you update your library version
65dnl information:
66dnl
67dnl  1. Start with version information of `0:0:0' for each libtool library.
68dnl  2. Update the version information only immediately before a public
69dnl     release of your software. More frequent updates are unnecessary, and
70dnl     only guarantee that the current interface number gets larger faster.
71dnl  3. If the library source code has changed at all since the last update,
72dnl     then increment revision (`c:r:a' becomes `c:r+1:a').
73dnl  4. If any interfaces have been added, removed, or changed since the last
74dnl     update, increment current, and set revision to 0.
75dnl  5. If any interfaces have been added since the last public release, then
76dnl     increment age.
77dnl  6. If any interfaces have been removed since the last public release,
78dnl     then set age to 0.
79LIBTIFF_CURRENT=10
80LIBTIFF_REVISION=0
81LIBTIFF_AGE=5
82LIBTIFF_VERSION_INFO=$LIBTIFF_CURRENT:$LIBTIFF_REVISION:$LIBTIFF_AGE
83
84# This is a special hack for OpenBSD and MirOS systems. The dynamic linker
85# in OpenBSD uses some special semantics for shared libraries. Their soname
86# contains only two numbers, major and minor.
87# See http://bugzilla.remotesensing.org/show_bug.cgi?id=838 for details.
88#case "$host_os" in
89#    openbsd* | mirbsd*)
90#	LIBTIFF_VERSION_INFO=$LIBTIFF_MAJOR_VERSION$LIBTIFF_MINOR_VERSION:$LIBTIFF_MICRO_VERSION:0
91#	;;
92#    *)
93#	LIBTIFF_VERSION_INFO=$LIBTIFF_MAJOR_VERSION:$LIBTIFF_MINOR_VERSION:$LIBTIFF_MICRO_VERSION
94#	;;
95#esac
96
97AC_SUBST(LIBTIFF_MAJOR_VERSION)
98AC_SUBST(LIBTIFF_MINOR_VERSION)
99AC_SUBST(LIBTIFF_MICRO_VERSION)
100AC_SUBST(LIBTIFF_ALPHA_VERSION)
101AC_SUBST(LIBTIFF_VERSION)
102AC_SUBST(LIBTIFF_VERSION_INFO)
103AC_SUBST(LIBTIFF_RELEASE_DATE)
104
105dnl Checks for programs.
106AC_PROG_CC
107AM_PROG_CC_C_O
108
109dnl We want warnings. As many warnings as possible.
110VL_PROG_CC_WARNINGS()
111
112dnl Checks for programs
113AC_PROG_INSTALL
114AC_PROG_LN_S
115# Used only for validating the source distribution during distcheck
116AC_PATH_PROG(CMAKE, cmake)
117
118
119# Check if LD supports linker scripts, and define automake conditional
120# HAVE_LD_VERSION_SCRIPT if so.  This functionality is currently
121# constrained to compilers using GNU ld on ELF systems or systems
122# which provide an adequate emulation thereof.
123AC_ARG_ENABLE([ld-version-script],
124  AS_HELP_STRING([--enable-ld-version-script],
125    [enable linker version script (default is disabled)]),
126    [have_ld_version_script=$enableval], [have_ld_version_script=no])
127if test "$have_ld_version_script" != no; then
128  AC_MSG_CHECKING([if LD -Wl,--version-script works])
129  save_LDFLAGS="$LDFLAGS"
130  LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
131  cat > conftest.map <<EOF
132VERS_1 {
133        global: sym;
134};
135
136VERS_2 {
137        global: sym;
138} VERS_1;
139EOF
140  AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
141                 [have_ld_version_script=yes], [have_ld_version_script=no])
142  rm -f conftest.map
143  LDFLAGS="$save_LDFLAGS"
144  AC_MSG_RESULT($have_ld_version_script)
145fi
146AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
147
148
149dnl Tests for Windows
150AC_EXEEXT
151AC_OBJEXT
152
153dnl initialize libtool
154LT_INIT([win32-dll])
155LT_LANG([C++])
156
157# Enable support for silent build rules
158AM_SILENT_RULES
159
160tiff_libs_private=
161AC_SUBST(tiff_libs_private)
162
163dnl We don't need to add math library to all targets
164case "${host_os}" in
165    cygwin* | mingw32* | beos* | darwin*)
166        ;;
167    *)
168	AC_CHECK_LIB(m,sin,[libm_lib=yes], [libm_lib=no],)
169	if test "x$libm_lib" = "xyes" ; then
170	  LIBS="-lm $LIBS"
171	  tiff_libs_private="-lm ${tiff_libs_private}"
172	fi
173        ;;
174esac
175
176dnl Checks for header files.
177AC_CHECK_HEADERS([assert.h fcntl.h io.h search.h unistd.h])
178
179dnl Checks for typedefs, structures, and compiler characteristics.
180AC_C_CONST
181AC_C_INLINE
182AC_C_BIGENDIAN
183AC_TYPE_OFF_T
184AC_TYPE_SIZE_T
185AC_HEADER_TIME
186AC_STRUCT_TM
187
188dnl If the `fseeko' function is available, define `HAVE_FSEEKO'. Define
189dnl `_LARGEFILE_SOURCE' if necessary.
190AC_FUNC_FSEEKO
191
192dnl Check if optarg (and presumably related externs) already declared in headers
193AC_CHECK_DECLS([optarg])
194
195dnl ---------------------------------------------------------------------------
196dnl Compute sized types for current CPU and compiler options
197dnl ---------------------------------------------------------------------------
198
199# Obtain size of an 'signed int' and define as SIZEOF_SIGNED_INT
200AC_CHECK_SIZEOF(signed int)
201
202# Obtain size of an 'unsigned int' and define as SIZEOF_UNSIGNED_INT
203AC_CHECK_SIZEOF(unsigned int)
204
205# Obtain size of a 'signed long' and define as SIZEOF_SIGNED_LONG
206AC_CHECK_SIZEOF(signed long)
207
208# Obtain size of a 'unsigned long' and define as SIZEOF_UNSIGNED_LONG
209AC_CHECK_SIZEOF(unsigned long)
210
211# Obtain size of a 'long long' and define as SIZEOF_SIGNED_LONG_LONG.
212# If 'long long' is not supported then the value defined is zero.
213AC_CHECK_SIZEOF(signed long long)
214
215# Obtain size of a 'unsigned long long' and define as
216# SIZEOF_UNSIGNED_LONG_LONG.  If 'unsigned long long' is not
217# supported then the value defined is zero.
218AC_CHECK_SIZEOF(unsigned long long)
219
220# Obtain the size of an 'unsigned char *' and define as
221# SIZEOF_UNSIGNED_CHAR_P.  Result is available in
222# ac_cv_sizeof_unsigned_char_p.
223AC_CHECK_SIZEOF(unsigned char *)
224
225# Obtain the size of 'size_t' and define as SIZEOF_SIZE_T.  Result is
226# available in ac_cv_sizeof_size_t
227AC_CHECK_SIZEOF([size_t])
228
229AC_MSG_CHECKING(for signed 8-bit type)
230INT8_T='signed char'
231AC_MSG_RESULT($INT8_T)
232AC_DEFINE_UNQUOTED(TIFF_INT8_T,$INT8_T,[Signed 8-bit type])
233
234AC_MSG_CHECKING(for unsigned 8-bit type)
235UINT8_T='unsigned char'
236AC_MSG_RESULT($UINT8_T)
237AC_DEFINE_UNQUOTED(TIFF_UINT8_T,$UINT8_T,[Unsigned 8-bit type])
238
239AC_MSG_CHECKING(for signed 16-bit type)
240INT16_T='signed short'
241AC_MSG_RESULT($INT16_T)
242AC_DEFINE_UNQUOTED(TIFF_INT16_T,$INT16_T,[Signed 16-bit type])
243
244
245AC_MSG_CHECKING(for unsigned 16-bit type)
246UINT16_T='unsigned short'
247AC_MSG_RESULT($UINT16_T)
248AC_DEFINE_UNQUOTED(TIFF_UINT16_T,$UINT16_T,[Unsigned 16-bit type])
249
250AC_MSG_CHECKING(for signed 32-bit type)
251INT32_T='none'
252INT32_FORMAT='none'
253if test $ac_cv_sizeof_signed_int -eq 4
254then
255  INT32_T='signed int'
256  INT32_FORMAT='"%d"'
257elif test $ac_cv_sizeof_signed_long -eq 4
258then
259  INT32_T='signed long'
260  INT32_FORMAT='"%ld"'
261fi
262AC_MSG_RESULT($INT32_T)
263AC_DEFINE_UNQUOTED(TIFF_INT32_T,$INT32_T,[Signed 32-bit type])
264AC_DEFINE_UNQUOTED(TIFF_INT32_FORMAT,$INT32_FORMAT,[Signed 32-bit type formatter])
265
266AC_MSG_CHECKING(for unsigned 32-bit type)
267UINT32_T='none'
268UINT32_FORMAT='none'
269if test $ac_cv_sizeof_unsigned_int -eq 4
270then
271  UINT32_T='unsigned int'
272  UINT32_FORMAT='"%u"'
273elif test $ac_cv_sizeof_unsigned_long -eq 4
274then
275  UINT32_T='unsigned long'
276  UINT32_FORMAT='"%lu"'
277fi
278AC_MSG_RESULT($UINT32_T)
279AC_DEFINE_UNQUOTED(TIFF_UINT32_T,$UINT32_T,[Unsigned 32-bit type])
280AC_DEFINE_UNQUOTED(TIFF_UINT32_FORMAT,$UINT32_FORMAT,[Unsigned 32-bit type formatter])
281
282AC_MSG_CHECKING(for signed 64-bit type)
283INT64_T='none'
284INT64_FORMAT='none'
285if test $ac_cv_sizeof_signed_long -eq 8
286then
287  INT64_T='signed long'
288  INT64_FORMAT='"%ld"'
289elif test $ac_cv_sizeof_signed_long_long -eq 8
290then
291  INT64_T='signed long long'
292  case "${host_os}" in
293    mingw32*)
294      # MinGW32 understands 'long long', but uses printf from WIN32 CRT
295      INT64_FORMAT='"%I64d"'
296      ;;
297    *)
298      INT64_FORMAT='"%lld"'
299      ;;
300  esac
301fi
302
303
304AC_MSG_RESULT($INT64_T)
305AC_DEFINE_UNQUOTED(TIFF_INT64_T,$INT64_T,[Signed 64-bit type])
306AC_DEFINE_UNQUOTED(TIFF_INT64_FORMAT,$INT64_FORMAT,[Signed 64-bit type formatter])
307
308AC_MSG_CHECKING(for unsigned 64-bit type)
309UINT64_T='none'
310UINT64_FORMAT='none'
311if test $ac_cv_sizeof_unsigned_long -eq 8
312then
313  UINT64_T='unsigned long'
314  UINT64_FORMAT='"%lu"'
315elif test $ac_cv_sizeof_unsigned_long_long -eq 8
316then
317  UINT64_T='unsigned long long'
318  case "${host_os}" in
319    mingw32*)
320      # MinGW32 understands 'unsigned long long', but uses printf from WIN32 CRT
321      UINT64_FORMAT='"%I64u"'
322      ;;
323    *)
324      UINT64_FORMAT='"%llu"'
325      ;;
326  esac
327fi
328AC_MSG_RESULT($UINT64_T)
329AC_DEFINE_UNQUOTED(TIFF_UINT64_T,$UINT64_T,[Unsigned 64-bit type])
330AC_DEFINE_UNQUOTED(TIFF_UINT64_FORMAT,$UINT64_FORMAT,[Unsigned 64-bit type formatter])
331
332# Determine formatting specifier for 'size_t'.  While the size should
333# be precise, the type determined may not match the system definition.
334# A named type is provided to allow casting to the type we determined
335# without changing the actual size.
336AC_MSG_CHECKING([for 'size_t' format specifier])
337SIZE_T='unknown'
338SIZE_FORMAT='unknown'
339if test $ac_cv_sizeof_unsigned_int -eq $ac_cv_sizeof_size_t
340then
341  SIZE_T='unsigned int'
342  SIZE_FORMAT='"%u"'
343elif test $ac_cv_sizeof_unsigned_long -eq $ac_cv_sizeof_size_t
344then
345  SIZE_T='unsigned long'
346  SIZE_FORMAT='"%lu"'
347elif test $ac_cv_sizeof_unsigned_long_long -eq $ac_cv_sizeof_size_t
348then
349  SIZE_T='unsigned long long'
350  case "${host_os}" in
351    mingw32*)
352      # MinGW32 understands 'unsigned long long', but uses printf from WIN32 CRT
353      SIZE_FORMAT='"%I64u"'
354      ;;
355    *)
356      SIZE_FORMAT='"%llu"'
357      ;;
358  esac
359fi
360AC_MSG_RESULT([$SIZE_FORMAT])
361AC_DEFINE_UNQUOTED([TIFF_SIZE_T],[$SIZE_T],[Unsigned size type])
362AC_DEFINE_UNQUOTED([TIFF_SIZE_FORMAT],[$SIZE_FORMAT],[Size type formatter])
363
364# Determine TIFF equivalent of ssize_t
365AC_MSG_CHECKING(for signed size type)
366SSIZE_T='unknown'
367SSIZE_FORMAT='unknown'
368if test $ac_cv_sizeof_signed_int -eq $ac_cv_sizeof_size_t
369then
370  SSIZE_T='signed int'
371  SSIZE_FORMAT='"%d"'
372elif test $ac_cv_sizeof_signed_long -eq $ac_cv_sizeof_size_t
373then
374  SSIZE_T='signed long'
375  SSIZE_FORMAT='"%ld"'
376elif test $ac_cv_sizeof_signed_long_long -eq $ac_cv_sizeof_size_t
377then
378  SSIZE_T='signed long long'
379  case "${host_os}" in
380    mingw32*)
381      # MinGW32 understands 'long long', but uses printf from WIN32 CRT
382      SSIZE_FORMAT='"%I64d"'
383      ;;
384    *)
385      SSIZE_FORMAT='"%lld"'
386      ;;
387  esac
388fi
389AC_MSG_RESULT($SSIZE_T)
390AC_DEFINE_UNQUOTED(TIFF_SSIZE_T,$SSIZE_T,[Signed size type])
391AC_DEFINE_UNQUOTED(TIFF_SSIZE_FORMAT,$SSIZE_FORMAT,[Signed size type formatter])
392
393# Determine the type to use for the difference between two pointers.
394# We will default to the POSIX ptrdiff_t if it is available, but will
395# be prepared for the case when it is not.
396PTRDIFF_T='unknown'
397PTRDIFF_FORMAT='"%ld"'
398AC_CHECK_TYPE(ptrdiff_t,[PTRDIFF_T=ptrdiff_t])
399if test $PTRDIFF_T = unknown
400then
401  PTRDIFF_T=$SSIZE_T
402  PTRDIFF_FORMAT=$SSIZE_FORMAT
403fi
404AC_MSG_CHECKING(for pointer difference type)
405AC_MSG_RESULT($PTRDIFF_T)
406AC_DEFINE_UNQUOTED(TIFF_PTRDIFF_T,$PTRDIFF_T,[Pointer difference type])
407AC_DEFINE_UNQUOTED(TIFF_PTRDIFF_FORMAT,$PTRDIFF_FORMAT,[Pointer difference type formatter])
408
409dnl Checks for library functions.
410AC_CHECK_FUNCS([mmap setmode snprintf])
411
412dnl Will use local replacements for unavailable functions
413AC_REPLACE_FUNCS(getopt)
414AC_REPLACE_FUNCS(snprintf)
415AC_REPLACE_FUNCS(strcasecmp)
416AC_REPLACE_FUNCS(strtol)
417AC_REPLACE_FUNCS(strtoll)
418AC_REPLACE_FUNCS(strtoul)
419AC_REPLACE_FUNCS(strtoull)
420AC_REPLACE_FUNCS(lfind)
421
422dnl ---------------------------------------------------------------------------
423dnl Check the native cpu bit order.
424dnl ---------------------------------------------------------------------------
425AC_MSG_CHECKING([native cpu bit order])
426case "$host_cpu" in
427    i*86*|x86_64*)
428        HOST_FILLORDER=FILLORDER_LSB2MSB
429	AC_MSG_RESULT([lsb2msb])
430	;;
431    *)
432	HOST_FILLORDER=FILLORDER_MSB2LSB
433	AC_MSG_RESULT([msb2lsb])
434        ;;
435esac
436AC_DEFINE_UNQUOTED(HOST_FILLORDER, $HOST_FILLORDER, [Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB)])
437
438dnl ---------------------------------------------------------------------------
439dnl Configure legacy tifconf.h HOST_BIGENDIAN.
440dnl ---------------------------------------------------------------------------
441if test "$ac_cv_c_bigendian" = yes ; then
442    HOST_BIGENDIAN=1
443else
444    HOST_BIGENDIAN=0
445fi
446AC_DEFINE_UNQUOTED(HOST_BIGENDIAN,$HOST_BIGENDIAN,[Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian (Intel)])
447
448dnl ---------------------------------------------------------------------------
449dnl Make the POSIX.2 features available.
450dnl ---------------------------------------------------------------------------
451#_POSIX_C_SOURCE=2
452#AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE, $_POSIX_C_SOURCE, [Define this macro to a positive integer to control which POSIX functionality is made available.])
453
454dnl ---------------------------------------------------------------------------
455dnl Set the floating point format.
456dnl FIXME: write appropriate test.
457dnl ---------------------------------------------------------------------------
458HAVE_IEEEFP=1
459AC_DEFINE_UNQUOTED(HAVE_IEEEFP, $HAVE_IEEEFP, [Define as 0 or 1 according to the floating point format suported by the machine])
460
461dnl ---------------------------------------------------------------------------
462dnl Enable run-time paths to libraries usage.
463dnl ---------------------------------------------------------------------------
464
465AC_ARG_ENABLE(rpath,
466	      AS_HELP_STRING([--enable-rpath],
467			     [Enable runtime linker paths (-R libtool option)]),
468	      [HAVE_RPATH=$enableval], [HAVE_RPATH=no])
469AM_CONDITIONAL(HAVE_RPATH, test "$HAVE_RPATH" = "yes")
470
471dnl ---------------------------------------------------------------------------
472dnl Support large files.
473dnl ---------------------------------------------------------------------------
474
475AC_SYS_LARGEFILE
476
477dnl ---------------------------------------------------------------------------
478dnl Point to path where we should install documentation.
479dnl ---------------------------------------------------------------------------
480
481LIBTIFF_DOCDIR=\${prefix}/share/doc/${PACKAGE}-${LIBTIFF_VERSION}
482
483AC_ARG_WITH(docdir,
484	    AS_HELP_STRING([--with-docdir=DIR],
485			   [directory where documentation should be installed]),,)
486if test "x$with_docdir" != "x" ; then
487  LIBTIFF_DOCDIR=$with_docdir
488fi
489
490AC_SUBST(LIBTIFF_DOCDIR)
491
492dnl ---------------------------------------------------------------------------
493dnl Switch on/off internal codecs.
494dnl ---------------------------------------------------------------------------
495
496AC_ARG_ENABLE(ccitt,
497	      AS_HELP_STRING([--disable-ccitt],
498			     [disable support for CCITT Group 3 & 4 algorithms]),
499	      [HAVE_CCITT=$enableval], [HAVE_CCITT=yes])
500
501if test "$HAVE_CCITT" = "yes" ; then
502  AC_DEFINE(CCITT_SUPPORT,1,[Support CCITT Group 3 & 4 algorithms])
503fi
504
505AC_ARG_ENABLE(packbits,
506	      AS_HELP_STRING([--disable-packbits],
507			     [disable support for Macintosh PackBits algorithm]),
508	      [HAVE_PACKBITS=$enableval], [HAVE_PACKBITS=yes])
509
510if test "$HAVE_PACKBITS" = "yes" ; then
511  AC_DEFINE(PACKBITS_SUPPORT,1,[Support Macintosh PackBits algorithm])
512fi
513
514AC_ARG_ENABLE(lzw,
515	      AS_HELP_STRING([--disable-lzw],
516			     [disable support for LZW algorithm]),
517	      [HAVE_LZW=$enableval], [HAVE_LZW=yes])
518
519if test "$HAVE_LZW" = "yes" ; then
520  AC_DEFINE(LZW_SUPPORT,1,[Support LZW algorithm])
521fi
522
523AC_ARG_ENABLE(thunder,
524	      AS_HELP_STRING([--disable-thunder],
525			     [disable support for ThunderScan 4-bit RLE algorithm]),
526	      [HAVE_THUNDER=$enableval], [HAVE_THUNDER=yes])
527
528if test "$HAVE_THUNDER" = "yes" ; then
529  AC_DEFINE(THUNDER_SUPPORT,1,[Support ThunderScan 4-bit RLE algorithm])
530fi
531
532HAVE_NEXT=yes
533
534AC_ARG_ENABLE(next,
535	      AS_HELP_STRING([--disable-next],
536			     [disable support for NeXT 2-bit RLE algorithm]),
537	      [HAVE_NEXT=$enableval], [HAVE_NEXT=yes])
538
539if test "$HAVE_NEXT" = "yes" ; then
540  AC_DEFINE(NEXT_SUPPORT,1,[Support NeXT 2-bit RLE algorithm])
541fi
542
543AC_ARG_ENABLE(logluv,
544	      AS_HELP_STRING([--disable-logluv],
545			     [disable support for LogLuv high dynamic range encoding]),
546	      [HAVE_LOGLUV=$enableval], [HAVE_LOGLUV=yes])
547
548if test "$HAVE_LOGLUV" = "yes" ; then
549  AC_DEFINE(LOGLUV_SUPPORT,1,[Support LogLuv high dynamic range encoding])
550fi
551
552dnl ---------------------------------------------------------------------------
553dnl Switch on/off support for Microsoft Document Imaging
554dnl ---------------------------------------------------------------------------
555
556AC_ARG_ENABLE(mdi,
557	      AS_HELP_STRING([--disable-mdi],
558			     [disable support for Microsoft Document Imaging]),
559	      [HAVE_MDI=$enableval], [HAVE_MDI=yes])
560
561if test "$HAVE_MDI" = "yes" ; then
562  AC_DEFINE(MDI_SUPPORT,1,[Support Microsoft Document Imaging format])
563fi
564
565dnl ---------------------------------------------------------------------------
566dnl Check for ZLIB.
567dnl ---------------------------------------------------------------------------
568
569HAVE_ZLIB=no
570
571AC_ARG_ENABLE(zlib,
572	      AS_HELP_STRING([--disable-zlib],
573			     [disable Zlib usage (required for Deflate compression, enabled by default)]),,)
574AC_ARG_WITH(zlib-include-dir,
575	    AS_HELP_STRING([--with-zlib-include-dir=DIR],
576			   [location of Zlib headers]),,)
577AC_ARG_WITH(zlib-lib-dir,
578	    AS_HELP_STRING([--with-zlib-lib-dir=DIR],
579			   [location of Zlib library binary]),,)
580
581if test "x$enable_zlib" != "xno" ; then
582
583  if test "x$with_zlib_lib_dir" != "x" ; then
584    LDFLAGS="-L$with_zlib_lib_dir $LDFLAGS"
585  fi
586
587  AC_CHECK_LIB(z, inflateEnd, [zlib_lib=yes], [zlib_lib=no],)
588  if test "$zlib_lib" = "no" -a "x$with_zlib_lib_dir" != "x"; then
589    AC_MSG_ERROR([Zlib library not found at $with_zlib_lib_dir])
590  fi
591
592  if test "x$with_zlib_include_dir" != "x" ; then
593    CPPFLAGS="-I$with_zlib_include_dir $CPPFLAGS"
594  fi
595  AC_CHECK_HEADER(zlib.h, [zlib_h=yes], [zlib_h=no])
596  if test "$zlib_h" = "no" -a "x$with_zlib_include_dir" != "x" ; then
597    AC_MSG_ERROR([Zlib headers not found at $with_zlib_include_dir])
598  fi
599
600  if test "$zlib_lib" = "yes" -a "$zlib_h" = "yes" ; then
601    HAVE_ZLIB=yes
602  fi
603
604fi
605
606if test "$HAVE_ZLIB" = "yes" ; then
607  AC_DEFINE(ZIP_SUPPORT,1,[Support Deflate compression])
608  LIBS="-lz $LIBS"
609  tiff_libs_private="-lz ${tiff_libs_private}"
610
611  if test "$HAVE_RPATH" = "yes" -a "x$with_zlib_lib_dir" != "x" ; then
612    LIBDIR="-R $with_zlib_lib_dir $LIBDIR"
613  fi
614
615fi
616
617dnl ---------------------------------------------------------------------------
618dnl Check for Pixar log-format algorithm.
619dnl ---------------------------------------------------------------------------
620
621AC_ARG_ENABLE(pixarlog,
622	      AS_HELP_STRING([--disable-pixarlog],
623			     [disable support for Pixar log-format algorithm (requires Zlib)]),
624	      [HAVE_PIXARLOG=$enableval], [HAVE_PIXARLOG=yes])
625
626if test "$HAVE_ZLIB" = "yes" -a "$HAVE_PIXARLOG" = "yes" ; then
627  AC_DEFINE(PIXARLOG_SUPPORT, 1,
628	    [Support Pixar log-format algorithm (requires Zlib)])
629else
630  HAVE_PIXARLOG=no
631fi
632
633dnl ---------------------------------------------------------------------------
634dnl Check for JPEG.
635dnl ---------------------------------------------------------------------------
636
637HAVE_JPEG=no
638
639AC_ARG_ENABLE(jpeg,
640	      AS_HELP_STRING([--disable-jpeg],
641			     [disable IJG JPEG library usage (required for JPEG compression, enabled by default)]),,)
642AC_ARG_WITH(jpeg-include-dir,
643	    AS_HELP_STRING([--with-jpeg-include-dir=DIR],
644			   [location of IJG JPEG library headers]),,)
645AC_ARG_WITH(jpeg-lib-dir,
646	    AS_HELP_STRING([--with-jpeg-lib-dir=DIR],
647			   [location of IJG JPEG library binary]),,)
648
649if test "x$enable_jpeg" != "xno" ; then
650
651  if test "x$with_jpeg_lib_dir" != "x" ; then
652    LDFLAGS="-L$with_jpeg_lib_dir $LDFLAGS"
653
654  fi
655
656  AC_CHECK_LIB(jpeg, jpeg_read_scanlines, [jpeg_lib=yes], [jpeg_lib=no],)
657  if test "$jpeg_lib" = "no" -a "x$with_jpeg_lib_dir" != "x" ; then
658    AC_MSG_ERROR([IJG JPEG library not found at $with_jpeg_lib_dir])
659  fi
660
661  if test "x$with_jpeg_include_dir" != "x" ; then
662    CPPFLAGS="-I$with_jpeg_include_dir $CPPFLAGS"
663  fi
664  AC_CHECK_HEADER(jpeglib.h, [jpeg_h=yes], [jpeg_h=no])
665  if test "$jpeg_h" = "no" -a "x$with_jpeg_include_dir" != "x" ; then
666    AC_MSG_ERROR([IJG JPEG library headers not found at $with_jpeg_include_dir])
667  fi
668
669  if test "$jpeg_lib" = "yes" -a "$jpeg_h" = "yes" ; then
670    HAVE_JPEG=yes
671  fi
672
673fi
674
675if test "$HAVE_JPEG" = "yes" ; then
676  AC_DEFINE(JPEG_SUPPORT,1,[Support JPEG compression (requires IJG JPEG library)])
677  LIBS="-ljpeg $LIBS"
678  tiff_libs_private="-ljpeg ${tiff_libs_private}"
679
680  if test "$HAVE_RPATH" = "yes" -a "x$with_jpeg_lib_dir" != "x" ; then
681    LIBDIR="-R $with_jpeg_lib_dir $LIBDIR"
682  fi
683
684fi
685
686AM_CONDITIONAL(HAVE_JPEG, test "$HAVE_JPEG" = 'yes')
687
688dnl ---------------------------------------------------------------------------
689dnl Check for Old JPEG.
690dnl ---------------------------------------------------------------------------
691
692AC_ARG_ENABLE(old-jpeg,
693	      AS_HELP_STRING([--disable-old-jpeg],
694			     [disable support for Old JPEG compresson (read-only, enabled by default)]),
695	      [HAVE_OJPEG=${enableval}], [HAVE_OJPEG=yes])
696
697if test "$HAVE_JPEG" = "yes" -a "$HAVE_OJPEG" = "yes" ; then
698  AC_DEFINE(OJPEG_SUPPORT, 1,
699	    [Support Old JPEG compresson (read-only)])
700else
701  HAVE_OJPEG=no
702fi
703
704dnl ---------------------------------------------------------------------------
705dnl Check for JBIG-KIT.
706dnl ---------------------------------------------------------------------------
707
708HAVE_JBIG=no
709
710AC_ARG_ENABLE(jbig,
711	      AS_HELP_STRING([--disable-jbig],
712			     [disable JBIG-KIT usage (required for ISO JBIG compression, enabled by default)]),,)
713AC_ARG_WITH(jbig-include-dir,
714	    AS_HELP_STRING([--with-jbig-include-dir=DIR],
715			   [location of JBIG-KIT headers]),,)
716AC_ARG_WITH(jbig-lib-dir,
717	    AS_HELP_STRING([--with-jbig-lib-dir=DIR],
718			   [location of JBIG-KIT library binary]),,)
719
720if test "x$enable_jbig" != "xno" ; then
721
722  if test "x$with_jbig_lib_dir" != "x" ; then
723    LDFLAGS="-L$with_jbig_lib_dir $LDFLAGS"
724
725  fi
726
727  AC_CHECK_LIB(jbig, jbg_dec_init, [jbig_lib=yes], [jbig_lib=no],)
728  if test "$jbig_lib" = "no" -a "x$with_jbig_lib_dir" != "x" ; then
729    AC_MSG_ERROR([JBIG-KIT library not found at $with_jbig_lib_dir])
730  fi
731
732  if test "x$with_jbig_include_dir" != "x" ; then
733    CPPFLAGS="-I$with_jbig_include_dir $CPPFLAGS"
734  fi
735  AC_CHECK_HEADER(jbig.h, [jbig_h=yes], [jbig_h=no])
736  if test "$jbig_h" = "no" -a "x$with_jbig_include_dir" != "x" ; then
737    AC_MSG_ERROR([JBIG-KIT library headers not found at $with_jbig_include_dir])
738  fi
739
740  if test "$jbig_lib" = "yes" -a "$jbig_h" = "yes" ; then
741    HAVE_JBIG=yes
742  fi
743
744fi
745
746if test "$HAVE_JBIG" = "yes" ; then
747  AC_DEFINE(JBIG_SUPPORT,1,[Support ISO JBIG compression (requires JBIG-KIT library)])
748  LIBS="-ljbig $LIBS"
749  tiff_libs_private="-ljbig ${tiff_libs_private}"
750
751  if test "$HAVE_RPATH" = "yes" -a "x$with_jbig_lib_dir" != "x" ; then
752    LIBDIR="-R $with_jbig_lib_dir $LIBDIR"
753  fi
754
755  # Older versions of jbigkit lack jbg_newlen
756  AC_CHECK_FUNCS([jbg_newlen])
757
758fi
759
760AM_CONDITIONAL(HAVE_JBIG, test "$HAVE_JBIG" = 'yes')
761
762dnl ---------------------------------------------------------------------------
763dnl Check for liblzma2.
764dnl ---------------------------------------------------------------------------
765
766HAVE_LZMA=no
767
768AC_ARG_ENABLE(lzma,
769	      AS_HELP_STRING([--disable-lzma],
770			     [disable liblzma usage (required for LZMA2 compression, enabled by default)]),,)
771AC_ARG_WITH(lzma-include-dir,
772	    AS_HELP_STRING([--with-lzma-include-dir=DIR],
773			   [location of liblzma headers]),,)
774AC_ARG_WITH(lzma-lib-dir,
775	    AS_HELP_STRING([--with-lzma-lib-dir=DIR],
776			   [location of liblzma library binary]),,)
777
778if test "x$enable_lzma" != "xno" ; then
779
780  if test "x$with_lzma_lib_dir" != "x" ; then
781    LDFLAGS="-L$with_lzma_lib_dir $LDFLAGS"
782  fi
783
784  AC_CHECK_LIB(lzma, lzma_code, [lzma_lib=yes], [lzma_lib=no],)
785  if test "$lzma_lib" = "no" -a "x$with_lzma_lib_dir" != "x"; then
786    AC_MSG_ERROR([lzma library not found at $with_lzma_lib_dir])
787  fi
788
789  if test "x$with_lzma_include_dir" != "x" ; then
790    CPPFLAGS="-I$with_lzma_include_dir $CPPFLAGS"
791  fi
792  AC_CHECK_HEADER(lzma.h, [lzma_h=yes], [lzma_h=no])
793  if test "$lzma_h" = "no" -a "x$with_lzma_include_dir" != "x" ; then
794    AC_MSG_ERROR([Liblzma headers not found at $with_lzma_include_dir])
795  fi
796
797  if test "$lzma_lib" = "yes" -a "$lzma_h" = "yes" ; then
798    HAVE_LZMA=yes
799  fi
800
801fi
802
803if test "$HAVE_LZMA" = "yes" ; then
804  AC_DEFINE(LZMA_SUPPORT,1,[Support LZMA2 compression])
805  LIBS="-llzma $LIBS"
806  tiff_libs_private="-llzma ${tiff_libs_private}"
807
808  if test "$HAVE_RPATH" = "yes" -a "x$with_lzma_lib_dir" != "x" ; then
809    LIBDIR="-R $with_lzma_lib_dir $LIBDIR"
810  fi
811
812fi
813
814AM_CONDITIONAL(HAVE_LZMA, test "$HAVE_LZMA" = 'yes')
815
816dnl ---------------------------------------------------------------------------
817dnl Check for libzstd.
818dnl ---------------------------------------------------------------------------
819
820HAVE_ZSTD=no
821
822AC_ARG_ENABLE(zstd,
823	      AS_HELP_STRING([--disable-zstd],
824			     [disable libzstd usage (required for zstd compression, enabled by default)]),,)
825AC_ARG_WITH(zstd-include-dir,
826	    AS_HELP_STRING([--with-zstd-include-dir=DIR],
827			   [location of libzstd headers]),,)
828AC_ARG_WITH(zstd-lib-dir,
829	    AS_HELP_STRING([--with-zstd-lib-dir=DIR],
830			   [location of libzstd library binary]),,)
831
832if test "x$enable_zstd" != "xno" ; then
833
834  if test "x$with_zstd_lib_dir" != "x" ; then
835    LDFLAGS="-L$with_zstd_lib_dir $LDFLAGS"
836  fi
837
838  AC_CHECK_LIB(zstd, ZSTD_decompressStream, [zstd_lib=yes], [zstd_lib=no],)
839  if test "$zstd_lib" = "no" -a "x$with_zstd_lib_dir" != "x"; then
840    AC_MSG_ERROR([zstd library not found at $with_zstd_lib_dir])
841  fi
842
843  if test "x$with_zstd_include_dir" != "x" ; then
844    CPPFLAGS="-I$with_zstd_include_dir $CPPFLAGS"
845  fi
846  AC_CHECK_HEADER(zstd.h, [zstd_h=yes], [zstd_h=no])
847  if test "$zstd_h" = "no" -a "x$with_zstd_include_dir" != "x" ; then
848    AC_MSG_ERROR([Libzstd headers not found at $with_zstd_include_dir])
849  fi
850
851  if test "$zstd_lib" = "yes" -a "$zstd_h" = "yes" ; then
852    HAVE_ZSTD=yes
853  fi
854
855fi
856
857if test "$HAVE_ZSTD" = "yes" ; then
858  AC_DEFINE(ZSTD_SUPPORT,1,[Support zstd compression])
859  LIBS="-lzstd $LIBS"
860  tiff_libs_private="-lzstd ${tiff_libs_private}"
861
862  if test "$HAVE_RPATH" = "yes" -a "x$with_zstd_lib_dir" != "x" ; then
863    LIBDIR="-R $with_zstd_lib_dir $LIBDIR"
864  fi
865
866fi
867
868AM_CONDITIONAL(HAVE_ZSTD, test "$HAVE_ZSTD" = 'yes')
869
870dnl ---------------------------------------------------------------------------
871dnl Check for libwebp.
872dnl ---------------------------------------------------------------------------
873
874HAVE_WEBP=no
875
876AC_ARG_ENABLE(webp,
877	      AS_HELP_STRING([--disable-webp],
878			     [disable libwebp usage (required for webp compression, enabled by default)]),,)
879AC_ARG_WITH(webp-include-dir,
880	    AS_HELP_STRING([--with-webp-include-dir=DIR],
881			   [location of libwebp headers]),,)
882AC_ARG_WITH(webp-lib-dir,
883	    AS_HELP_STRING([--with-webp-lib-dir=DIR],
884			   [location of libwebp library binary]),,)
885
886if test "x$enable_webp" != "xno" ; then
887
888  if test "x$with_webp_lib_dir" != "x" ; then
889    LDFLAGS="-L$with_webp_lib_dir $LDFLAGS"
890  fi
891
892  AC_CHECK_LIB(webp, WebPDecode, [webp_lib=yes], [webp_lib=no],)
893  if test "$webp_lib" = "no" -a "x$with_webp_lib_dir" != "x"; then
894    AC_MSG_ERROR([webp library not found at $with_webp_lib_dir])
895  fi
896
897  if test "x$with_webp_include_dir" != "x" ; then
898    CPPFLAGS="-I$with_webp_include_dir $CPPFLAGS"
899  fi
900  AC_CHECK_HEADER(webp/decode.h, [webp_h=yes], [webp_h=no])
901  if test "$webp_h" = "no" -a "x$with_webp_include_dir" != "x" ; then
902    AC_MSG_ERROR([Libwebp headers not found at $with_webp_include_dir])
903  fi
904
905  if test "$webp_lib" = "yes" -a "$webp_h" = "yes" ; then
906    HAVE_WEBP=yes
907  fi
908
909fi
910
911if test "$HAVE_WEBP" = "yes" ; then
912  AC_DEFINE(WEBP_SUPPORT,1,[Support webp compression])
913  LIBS="-lwebp $LIBS"
914  tiff_libs_private="-lwebp ${tiff_libs_private}"
915
916  if test "$HAVE_RPATH" = "yes" -a "x$with_webp_lib_dir" != "x" ; then
917    LIBDIR="-R $with_webp_lib_dir $LIBDIR"
918  fi
919
920fi
921
922AM_CONDITIONAL(HAVE_WEBP, test "$HAVE_WEBP" = 'yes')
923
924dnl ---------------------------------------------------------------------------
925dnl Should 8/12 bit jpeg mode be enabled?
926dnl ---------------------------------------------------------------------------
927
928HAVE_JPEG12=no
929
930AC_ARG_ENABLE(jpeg12,
931	      AS_HELP_STRING([--enable-jpeg12],
932			     [enable libjpeg 8/12bit dual mode]),,)
933AC_ARG_WITH(jpeg12-include-dir,
934	    AS_HELP_STRING([--with-jpeg12-include-dir=DIR],
935			   [location of libjpeg 12bit headers]),,)
936AC_ARG_WITH(jpeg12-lib,
937	    AS_HELP_STRING([--with-jpeg12-lib=LIBRARY],
938			   [path to libjpeg 12bit library]),,)
939
940if test "x$enable_jpeg12" = "xyes" ; then
941
942  if test "x$with_jpeg12_lib" != "x" ; then
943    LIBS="$with_jpeg12_lib $LIBS"
944  fi
945
946  HAVE_JPEG12=yes
947
948  AC_DEFINE(JPEG_DUAL_MODE_8_12,1,[8/12 bit libjpeg dual mode enabled])
949  if test "x$with_jpeg12_include_dir" != "x" ; then
950    AC_DEFINE_UNQUOTED(LIBJPEG_12_PATH,"$with_jpeg12_include_dir/jpeglib.h",[12bit libjpeg primary include file with path])
951  fi
952fi
953
954
955dnl ---------------------------------------------------------------------------
956dnl Check for C++.
957dnl ---------------------------------------------------------------------------
958
959AC_ARG_ENABLE(cxx,
960	      AS_HELP_STRING([--enable-cxx],
961			     [enable C++ stream API building (requires C++ compiler)]),
962	      [HAVE_CXX=$enableval], [HAVE_CXX=yes])
963
964if test "$HAVE_CXX" = "yes" ; then
965  AC_DEFINE(CXX_SUPPORT, 1, [Support C++ stream API (requires C++ compiler)])
966else
967  HAVE_CXX=no
968fi
969
970AM_CONDITIONAL(HAVE_CXX, test "$HAVE_CXX" = "yes")
971
972dnl ---------------------------------------------------------------------------
973dnl Check for OpenGL and GLUT.
974dnl ---------------------------------------------------------------------------
975
976HAVE_OPENGL=no
977
978
979AC_PATH_XTRA
980
981dnl AX_CHECK_GL sets GL_CFLAGS & GL_LIBS.  Also PTHREAD_LIBS,
982dnl PTHREAD_CFLAGS, & PTHREAD_CC as a side-effect
983AX_CHECK_GL
984
985dnl AX_CHECK_GLU sets GLU_CFLAGS & GLU_LIBS
986AX_CHECK_GLU
987
988dnl AX_CHECK_GLUT sets GLUT_CFLAGS & GLUT_LIBS
989AX_CHECK_GLUT
990
991if test "$no_x" != "yes" -a "$no_gl" != "yes" \
992	-a "$no_glu" != "yes" -a "$no_glut" != "yes" ; then
993  HAVE_OPENGL=yes
994fi
995
996AM_CONDITIONAL(HAVE_OPENGL, test "$HAVE_OPENGL" = "yes")
997
998dnl ---------------------------------------------------------------------------
999dnl Check for Win32 IO: make sure we have windows.h but not cygwin
1000dnl this must be after the ogl test, since that looks for windows.h and we
1001dnl test it
1002dnl ---------------------------------------------------------------------------
1003
1004AC_ARG_ENABLE(win32-io,
1005	      AS_HELP_STRING([--disable-win32-io],
1006			     [disable Win32 I/O (Windows only, enabled by default except for Cygwin)]),,)
1007
1008win32_io_ok=no
1009case "${host_os}" in
1010    cygwin*)
1011        if test x"$ac_cv_header_windows_h" = xyes -a "x$enable_win32_io" = xyes ; then
1012            win32_io_ok=yes
1013	fi
1014        ;;
1015    *)
1016        if test x"$ac_cv_header_windows_h" = xyes -a ! "x$enable_win32_io" = xno ; then
1017            win32_io_ok=yes
1018	fi
1019        ;;
1020esac
1021
1022if test "$win32_io_ok" = "yes" ; then
1023    AC_DEFINE(USE_WIN32_FILEIO,1,[define to use win32 IO system])
1024fi
1025
1026AM_CONDITIONAL([WIN32_IO], [test "$win32_io_ok" = yes])
1027
1028dnl ---------------------------------------------------------------------------
1029dnl Check for X Athena Widgets
1030dnl ---------------------------------------------------------------------------
1031
1032dnl HAVE_XAW=no
1033
1034dnl ICE_FIND_ATHENA
1035
1036dnl if test "$no_xaw" != "yes" ; then
1037dnl   HAVE_XAW=yes
1038dnl fi
1039
1040dnl AM_CONDITIONAL(HAVE_XAW, test "$HAVE_XAW" = "yes")
1041
1042dnl ===========================================================================
1043dnl ``Orthogonal Features''
1044dnl ===========================================================================
1045
1046dnl ---------------------------------------------------------------------------
1047dnl Default handling of strip chopping support.
1048dnl ---------------------------------------------------------------------------
1049
1050AC_ARG_ENABLE(strip-chopping,
1051	      AS_HELP_STRING([--disable-strip-chopping],
1052			     [disable support for strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of specified size to reduce memory usage)]),
1053	      [HAVE_STRIPCHOP=$enableval], [HAVE_STRIPCHOP=yes])
1054AC_ARG_WITH(default-strip-size,
1055	    AS_HELP_STRING([--with-default-strip-size=SIZE],
1056			   [default size of the strip in bytes (when strip chopping enabled) [[default=8192]]]),,)
1057
1058if test "$HAVE_STRIPCHOP" = "yes" \
1059	-a "x$with_default_strip_size" != "xno"; then
1060  AC_DEFINE(STRIPCHOP_DEFAULT,TIFF_STRIPCHOP,[Support strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of specified size to reduce memory usage)])
1061
1062  if test "x$with_default_strip_size" = "x" \
1063	  -o "x$with_default_strip_size" = "xyes"; then
1064    with_default_strip_size="8192"
1065  fi
1066
1067  AC_DEFINE_UNQUOTED(STRIP_SIZE_DEFAULT,$with_default_strip_size,[Default size of the strip in bytes (when strip chopping enabled)])
1068
1069fi
1070
1071dnl ---------------------------------------------------------------------------
1072dnl Should we try to defer loading of strip/tile offsets and sizes to
1073dnl optimize directory scanning?
1074dnl ---------------------------------------------------------------------------
1075
1076AC_ARG_ENABLE(defer-strile-load,
1077	      AS_HELP_STRING([--enable-defer-strile-load],
1078			     [enable deferred strip/tile offset/size loading (also available at runtime with the 'D' flag of TIFFOpen()]),
1079	      [HAVE_DEFER_STRILE_LOAD=$enableval], [HAVE_DEFER_STRILE_LOAD=no])
1080
1081if test "$HAVE_DEFER_STRILE_LOAD" = "yes" ; then
1082  AC_DEFINE(DEFER_STRILE_LOAD,1,[enable deferred strip/tile offset/size loading])
1083
1084fi
1085
1086dnl ---------------------------------------------------------------------------
1087dnl Check for support of CHUNKY_STRIP_READ_SUPPORT, a mechanism to allowing
1088dnl reading large strips (usually one strip files) in chunks when using
1089dnl TIFFReadScanline().  This is an experimental feature in libtiff 4.0.
1090dnl ---------------------------------------------------------------------------
1091
1092AC_ARG_ENABLE(chunky-strip-read,
1093	      AS_HELP_STRING([--enable-chunky-strip-read],
1094			     [enable reading large strips in chunks for TIFFReadScanline() (experimental)]),
1095	      [HAVE_CHUNKY_STRIP_READ=$enableval], [HAVE_CHUNKY_STRIP_READ=no])
1096
1097if test "$HAVE_CHUNKY_STRIP_READ" = "yes" ; then
1098  AC_DEFINE(CHUNKY_STRIP_READ_SUPPORT,1,[enable partial strip reading for large strips (experimental)])
1099
1100fi
1101
1102dnl ---------------------------------------------------------------------------
1103dnl Default subifd support.
1104dnl ---------------------------------------------------------------------------
1105AC_DEFINE(SUBIFD_SUPPORT,1,[Enable SubIFD tag (330) support])
1106
1107dnl ---------------------------------------------------------------------------
1108dnl Default handling of ASSOCALPHA support.
1109dnl ---------------------------------------------------------------------------
1110
1111AC_ARG_ENABLE(extrasample-as-alpha,
1112	      AS_HELP_STRING([--disable-extrasample-as-alpha],
1113			     [the RGBA interface will treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA files but don't mark the alpha properly]),
1114	      [HAVE_EXTRASAMPLE_AS_ALPHA=$enableval],
1115	      [HAVE_EXTRASAMPLE_AS_ALPHA=yes])
1116
1117if test "$HAVE_EXTRASAMPLE_AS_ALPHA" = "yes" ; then
1118  AC_DEFINE(DEFAULT_EXTRASAMPLE_AS_ALPHA, 1,
1119	    [Treat extra sample as alpha (default enabled). The RGBA interface will treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA files but don't mark the alpha properly.])
1120fi
1121
1122dnl ---------------------------------------------------------------------------
1123dnl Default handling of YCbCr subsampling support.
1124dnl See Bug 168 in Bugzilla, and JPEGFixupTestSubsampling() for details.
1125dnl ---------------------------------------------------------------------------
1126
1127AC_ARG_ENABLE(check-ycbcr-subsampling,
1128	      AS_HELP_STRING([--disable-check-ycbcr-subsampling],
1129			     [disable picking up YCbCr subsampling info from the JPEG data stream to support files lacking the tag]),
1130	      [CHECK_JPEG_YCBCR_SUBSAMPLING=$enableval],
1131	      [CHECK_JPEG_YCBCR_SUBSAMPLING=yes])
1132
1133if test "$CHECK_JPEG_YCBCR_SUBSAMPLING" = "yes" ; then
1134  AC_DEFINE(CHECK_JPEG_YCBCR_SUBSAMPLING, 1,
1135	    [Pick up YCbCr subsampling info from the JPEG data stream to support files lacking the tag (default enabled).])
1136fi
1137
1138dnl ---------------------------------------------------------------------------
1139
1140AC_SUBST(LIBDIR)
1141
1142AC_CONFIG_HEADERS([libtiff/tif_config.h libtiff/tiffconf.h])
1143
1144AC_CONFIG_FILES([Makefile \
1145		 build/Makefile \
1146		 contrib/Makefile \
1147		 contrib/addtiffo/Makefile \
1148		 contrib/dbs/Makefile \
1149		 contrib/dbs/xtiff/Makefile \
1150		 contrib/iptcutil/Makefile \
1151		 contrib/mfs/Makefile \
1152		 contrib/pds/Makefile \
1153		 contrib/ras/Makefile \
1154		 contrib/stream/Makefile \
1155		 contrib/tags/Makefile \
1156		 contrib/win_dib/Makefile \
1157                 html/Makefile \
1158		 html/images/Makefile \
1159		 html/man/Makefile \
1160                 libtiff-4.pc \
1161                 libtiff/Makefile \
1162                 man/Makefile \
1163		 port/Makefile \
1164		 test/Makefile \
1165                 tools/Makefile])
1166AC_OUTPUT
1167
1168dnl ---------------------------------------------------------------------------
1169dnl Display configuration status
1170dnl ---------------------------------------------------------------------------
1171
1172LOC_MSG()
1173LOC_MSG([Libtiff is now configured for ${host}])
1174LOC_MSG()
1175LOC_MSG([  Installation directory:             ${prefix}])
1176LOC_MSG([  Documentation directory:            ${LIBTIFF_DOCDIR}])
1177LOC_MSG([  C compiler:                         ${CC} ${CFLAGS}])
1178LOC_MSG([  C++ compiler:                       ${CXX} ${CXXFLAGS}])
1179LOC_MSG([  Enable runtime linker paths:        ${HAVE_RPATH}])
1180LOC_MSG([  Enable linker symbol versioning:    ${have_ld_version_script}])
1181LOC_MSG([  Support Microsoft Document Imaging: ${HAVE_MDI}])
1182LOC_MSG([  Use win32 IO:                       ${win32_io_ok}])
1183LOC_MSG()
1184LOC_MSG([ Support for internal codecs:])
1185LOC_MSG([  CCITT Group 3 & 4 algorithms:       ${HAVE_CCITT}])
1186LOC_MSG([  Macintosh PackBits algorithm:       ${HAVE_PACKBITS}])
1187LOC_MSG([  LZW algorithm:                      ${HAVE_LZW}])
1188LOC_MSG([  ThunderScan 4-bit RLE algorithm:    ${HAVE_THUNDER}])
1189LOC_MSG([  NeXT 2-bit RLE algorithm:           ${HAVE_NEXT}])
1190LOC_MSG([  LogLuv high dynamic range encoding: ${HAVE_LOGLUV}])
1191LOC_MSG()
1192LOC_MSG([ Support for external codecs:])
1193LOC_MSG([  ZLIB support:                       ${HAVE_ZLIB}])
1194LOC_MSG([  Pixar log-format algorithm:         ${HAVE_PIXARLOG}])
1195LOC_MSG([  JPEG support:                       ${HAVE_JPEG}])
1196LOC_MSG([  Old JPEG support:                   ${HAVE_OJPEG}])
1197LOC_MSG([  JPEG 8/12 bit dual mode:            ${HAVE_JPEG12}])
1198LOC_MSG([  ISO JBIG support:                   ${HAVE_JBIG}])
1199LOC_MSG([  LZMA2 support:                      ${HAVE_LZMA}])
1200LOC_MSG([  ZSTD support:                       ${HAVE_ZSTD}])
1201LOC_MSG([  WEBP support:                       ${HAVE_WEBP}])
1202LOC_MSG()
1203LOC_MSG([  C++ support:                        ${HAVE_CXX}])
1204LOC_MSG()
1205dnl LOC_MSG([  X Athena Widgets support:           ${HAVE_XAW}])
1206LOC_MSG([  OpenGL support:                     ${HAVE_OPENGL}])
1207LOC_MSG()
1208
1209