xref: /libtiff-4.0.7/configure.ac (revision bb96a66b)
1dnl                                               -*- Autoconf -*-
2dnl Tag Image File Format (TIFF) Software
3dnl
4dnl Copyright (C) 2004, Andrey Kiselev <[email protected]>
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.0.0beta7],[[email protected]],[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
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=0
44LIBTIFF_MICRO_VERSION=0
45LIBTIFF_ALPHA_VERSION=beta7
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=5
80LIBTIFF_REVISION=4
81LIBTIFF_AGE=0
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
112AC_PROG_INSTALL
113AC_PROG_LN_S
114
115dnl Tests for Windows
116AC_EXEEXT
117AC_OBJEXT
118
119dnl initialize libtool
120LT_INIT([win32-dll])
121LT_LANG([C++])
122
123# Enable support for silent build rules
124AM_SILENT_RULES
125
126dnl Checks for libraries.
127AC_CHECK_LIB([c], [main])
128
129dnl We don't need to add math library to all targets
130case "${host_os}" in
131    cygwin* | mingw32* | beos* | darwin*)
132        ;;
133    *)
134	AC_CHECK_LIB(m,sin,,,)
135        ;;
136esac
137
138tiff_libs_private=
139AC_SUBST(tiff_libs_private)
140
141dnl Checks for header files.
142AC_CHECK_HEADERS([assert.h fcntl.h io.h limits.h malloc.h search.h sys/time.h unistd.h])
143
144dnl Checks for typedefs, structures, and compiler characteristics.
145AC_C_CONST
146AC_C_INLINE
147AC_C_BIGENDIAN
148AC_TYPE_OFF_T
149AC_TYPE_SIZE_T
150AC_HEADER_TIME
151AC_STRUCT_TM
152
153dnl ---------------------------------------------------------------------------
154dnl Compute sized types for current CPU and compiler options
155dnl ---------------------------------------------------------------------------
156
157# Obtain size of an 'signed short' and define as SIZEOF_SIGNED_SHORT
158AC_CHECK_SIZEOF(signed short)
159
160# Obtain size of an 'unsigned short' and define as SIZEOF_UNSIGNED_SHORT
161AC_CHECK_SIZEOF(unsigned short)
162
163# Obtain size of an 'signed int' and define as SIZEOF_SIGNED_INT
164AC_CHECK_SIZEOF(signed int)
165
166# Obtain size of an 'unsigned int' and define as SIZEOF_UNSIGNED_INT
167AC_CHECK_SIZEOF(unsigned int)
168
169# Obtain size of a 'signed long' and define as SIZEOF_SIGNED_LONG
170AC_CHECK_SIZEOF(signed long)
171
172# Obtain size of a 'unsigned long' and define as SIZEOF_UNSIGNED_LONG
173AC_CHECK_SIZEOF(unsigned long)
174
175# Obtain size of a 'long long' and define as SIZEOF_SIGNED_LONG_LONG.
176# If 'long long' is not supported then the value defined is zero.
177AC_CHECK_SIZEOF(signed long long)
178
179# Obtain size of a 'unsigned long long' and define as
180# SIZEOF_UNSIGNED_LONG_LONG.  If 'unsigned long long' is not
181# supported then the value defined is zero.
182AC_CHECK_SIZEOF(unsigned long long)
183
184# Obtain the size of an 'unsigned char *' and define as
185# SIZEOF_UNSIGNED_CHAR_P.  Result is available in
186# ac_cv_sizeof_unsigned_char_p.
187AC_CHECK_SIZEOF(unsigned char *)
188
189AC_MSG_CHECKING(for signed 8-bit type)
190INT8_T='signed char'
191AC_MSG_RESULT($INT8_T)
192AC_DEFINE_UNQUOTED(TIFF_INT8_T,$INT8_T,[Signed 8-bit type])
193
194AC_MSG_CHECKING(for unsigned 8-bit type)
195UINT8_T='unsigned char'
196AC_MSG_RESULT($UINT8_T)
197AC_DEFINE_UNQUOTED(TIFF_UINT8_T,$UINT8_T,[Unsigned 8-bit type])
198
199AC_MSG_CHECKING(for signed 16-bit type)
200INT16_T='signed short'
201AC_MSG_RESULT($INT16_T)
202AC_DEFINE_UNQUOTED(TIFF_INT16_T,$INT16_T,[Signed 16-bit type])
203
204
205AC_MSG_CHECKING(for unsigned 16-bit type)
206UINT16_T='unsigned short'
207AC_MSG_RESULT($UINT16_T)
208AC_DEFINE_UNQUOTED(TIFF_UINT16_T,$UINT16_T,[Unsigned 16-bit type])
209
210AC_MSG_CHECKING(for signed 32-bit type)
211INT32_T='none'
212INT32_FORMAT='none'
213if test $ac_cv_sizeof_signed_int -eq 4
214then
215  INT32_T='signed int'
216  INT32_FORMAT='"%d"'
217elif test $ac_cv_sizeof_signed_long -eq 4
218then
219  INT32_T='signed long'
220  INT32_FORMAT='"%ld"'
221fi
222AC_MSG_RESULT($INT32_T)
223AC_DEFINE_UNQUOTED(TIFF_INT32_T,$INT32_T,[Signed 32-bit type])
224AC_DEFINE_UNQUOTED(TIFF_INT32_FORMAT,$INT32_FORMAT,[Signed 32-bit type formatter])
225
226AC_MSG_CHECKING(for unsigned 32-bit type)
227UINT32_T='none'
228UINT32_FORMAT='none'
229if test $ac_cv_sizeof_unsigned_int -eq 4
230then
231  UINT32_T='unsigned int'
232  UINT32_FORMAT='"%u"'
233elif test $ac_cv_sizeof_unsigned_long -eq 4
234then
235  UINT32_T='unsigned long'
236  UINT32_FORMAT='"%lu"'
237fi
238AC_MSG_RESULT($UINT32_T)
239AC_DEFINE_UNQUOTED(TIFF_UINT32_T,$UINT32_T,[Unsigned 32-bit type])
240AC_DEFINE_UNQUOTED(TIFF_UINT32_FORMAT,$UINT32_FORMAT,[Unsigned 32-bit type formatter])
241
242AC_MSG_CHECKING(for signed 64-bit type)
243INT64_T='none'
244INT64_FORMAT='none'
245if test $ac_cv_sizeof_signed_long -eq 8
246then
247  INT64_T='signed long'
248  INT64_FORMAT='"%ld"'
249elif test $ac_cv_sizeof_signed_long_long -eq 8
250then
251  INT64_T='signed long long'
252  case "${host_os}" in
253    mingw32*)
254      # MinGW32 understands 'long long', but uses printf from WIN32 CRT
255      INT64_FORMAT='"%I64d"'
256      ;;
257    *)
258      INT64_FORMAT='"%lld"'
259      ;;
260  esac
261fi
262
263
264AC_MSG_RESULT($INT64_T)
265AC_DEFINE_UNQUOTED(TIFF_INT64_T,$INT64_T,[Signed 64-bit type])
266AC_DEFINE_UNQUOTED(TIFF_INT64_FORMAT,$INT64_FORMAT,[Signed 64-bit type formatter])
267
268AC_MSG_CHECKING(for unsigned 64-bit type)
269UINT64_T='none'
270UINT64_FORMAT='none'
271if test $ac_cv_sizeof_unsigned_long -eq 8
272then
273  UINT64_T='unsigned long'
274  UINT64_FORMAT='"%lu"'
275elif test $ac_cv_sizeof_unsigned_long_long -eq 8
276then
277  UINT64_T='unsigned long long'
278  case "${host_os}" in
279    mingw32*)
280      # MinGW32 understands 'unsigned long long', but uses printf from WIN32 CRT
281      UINT64_FORMAT='"%I64u"'
282      ;;
283    *)
284      UINT64_FORMAT='"%llu"'
285      ;;
286  esac
287fi
288AC_MSG_RESULT($UINT64_T)
289AC_DEFINE_UNQUOTED(TIFF_UINT64_T,$UINT64_T,[Unsigned 64-bit type])
290AC_DEFINE_UNQUOTED(TIFF_UINT64_FORMAT,$UINT64_FORMAT,[Unsigned 64-bit type formatter])
291
292# Determine TIFF equivalent of ssize_t
293AC_MSG_CHECKING(for signed size type)
294SSIZE_T='unknown'
295SSIZE_FORMAT='unknown'
296if test $ac_cv_sizeof_signed_long -eq $ac_cv_sizeof_unsigned_char_p
297then
298  SSIZE_T='signed long'
299  SSIZE_FORMAT='"%ld"'
300elif test $ac_cv_sizeof_signed_long_long -eq $ac_cv_sizeof_unsigned_char_p
301then
302  SSIZE_T='signed long long'
303  SSIZE_FORMAT='"%lld"'
304fi
305AC_MSG_RESULT($SSIZE_T)
306AC_DEFINE_UNQUOTED(TIFF_SSIZE_T,$SSIZE_T,[Signed size type])
307AC_DEFINE_UNQUOTED(TIFF_SSIZE_FORMAT,$SSIZE_FORMAT,[Signed size type formatter])
308
309# Determine the type to use for the difference between two pointers.
310# We will default to the POSIX ptrdiff_t if it is available, but will
311# be prepared for the case when it is not.
312PTRDIFF_T='unknown'
313PTRDIFF_FORMAT='"%ld"'
314AC_CHECK_TYPE(ptrdiff_t,[PTRDIFF_T=ptrdiff_t])
315if test $PTRDIFF_T = unknown
316then
317  PTRDIFF_T=$SSIZE_T
318  PTRDIFF_FORMAT=$SSIZE_FORMAT
319fi
320AC_MSG_CHECKING(for pointer difference type)
321AC_MSG_RESULT($PTRDIFF_T)
322AC_DEFINE_UNQUOTED(TIFF_PTRDIFF_T,$PTRDIFF_T,[Pointer difference type])
323AC_DEFINE_UNQUOTED(TIFF_PTRDIFF_FORMAT,$PTRDIFF_FORMAT,[Pointer difference type formatter])
324
325dnl Some compilers (IBM VisualAge) has these types defined, so check it here:
326AC_CHECK_TYPES([int8, int16, int32],,,
327[
328#if HAVE_INTTYPES_H
329# include <inttypes.h>
330#endif
331])
332
333dnl Checks for library functions.
334AC_CHECK_FUNCS([floor isascii memmove memset mmap pow setmode sqrt strchr strrchr strstr strtol strtoull])
335
336dnl Will use local replacements for unavailable functions
337AC_REPLACE_FUNCS(getopt)
338AC_REPLACE_FUNCS(strcasecmp)
339AC_REPLACE_FUNCS(strtoul)
340AC_REPLACE_FUNCS(strtoull)
341AC_REPLACE_FUNCS(lfind)
342
343dnl ---------------------------------------------------------------------------
344dnl Check the native cpu bit order.
345dnl ---------------------------------------------------------------------------
346AC_MSG_CHECKING([native cpu bit order])
347case "$host_cpu" in
348    i*86*|x86_64*)
349        HOST_FILLORDER=FILLORDER_LSB2MSB
350	AC_MSG_RESULT([lsb2msb])
351	;;
352    *)
353	HOST_FILLORDER=FILLORDER_MSB2LSB
354	AC_MSG_RESULT([msb2lsb])
355        ;;
356esac
357AC_DEFINE_UNQUOTED(HOST_FILLORDER, $HOST_FILLORDER, [Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB)])
358
359dnl ---------------------------------------------------------------------------
360dnl Configure legacy tifconf.h HOST_BIGENDIAN.
361dnl ---------------------------------------------------------------------------
362if test "$ac_cv_c_bigendian" = yes ; then
363    HOST_BIGENDIAN=1
364else
365    HOST_BIGENDIAN=0
366fi
367AC_DEFINE_UNQUOTED(HOST_BIGENDIAN,$HOST_BIGENDIAN,[Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian (Intel)])
368
369dnl ---------------------------------------------------------------------------
370dnl Make the POSIX.2 features available.
371dnl ---------------------------------------------------------------------------
372#_POSIX_C_SOURCE=2
373#AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE, $_POSIX_C_SOURCE, [Define this macro to a positive integer to control which POSIX functionality is made available.])
374
375dnl ---------------------------------------------------------------------------
376dnl Set the floating point format.
377dnl FIXME: write appropriate test.
378dnl ---------------------------------------------------------------------------
379HAVE_IEEEFP=1
380AC_DEFINE_UNQUOTED(HAVE_IEEEFP, $HAVE_IEEEFP, [Define as 0 or 1 according to the floating point format suported by the machine])
381
382dnl ---------------------------------------------------------------------------
383dnl Enable run-time paths to libraries usage.
384dnl ---------------------------------------------------------------------------
385
386AC_ARG_ENABLE(rpath,
387	      AS_HELP_STRING([--enable-rpath],
388			     [Enable runtime linker paths (-R libtool option)]),
389	      [HAVE_RPATH=$enableval], [HAVE_RPATH=no])
390AM_CONDITIONAL(HAVE_RPATH, test "$HAVE_RPATH" = "yes")
391
392dnl ---------------------------------------------------------------------------
393dnl Support large files.
394dnl ---------------------------------------------------------------------------
395
396AC_SYS_LARGEFILE
397
398dnl ---------------------------------------------------------------------------
399dnl Point to path where we should install documentation.
400dnl ---------------------------------------------------------------------------
401
402LIBTIFF_DOCDIR=\${prefix}/share/doc/${PACKAGE}-${LIBTIFF_VERSION}
403
404AC_ARG_WITH(docdir,
405	    AS_HELP_STRING([--with-docdir=DIR],
406			   [directory where documentation should be installed]),,)
407if test "x$with_docdir" != "x" ; then
408  LIBTIFF_DOCDIR=$with_docdir
409fi
410
411AC_SUBST(LIBTIFF_DOCDIR)
412
413dnl ---------------------------------------------------------------------------
414dnl Switch on/off internal codecs.
415dnl ---------------------------------------------------------------------------
416
417AC_ARG_ENABLE(ccitt,
418	      AS_HELP_STRING([--disable-ccitt],
419			     [disable support for CCITT Group 3 & 4 algorithms]),
420	      [HAVE_CCITT=$enableval], [HAVE_CCITT=yes])
421
422if test "$HAVE_CCITT" = "yes" ; then
423  AC_DEFINE(CCITT_SUPPORT,1,[Support CCITT Group 3 & 4 algorithms])
424fi
425
426AC_ARG_ENABLE(packbits,
427	      AS_HELP_STRING([--disable-packbits],
428			     [disable support for Macintosh PackBits algorithm]),
429	      [HAVE_PACKBITS=$enableval], [HAVE_PACKBITS=yes])
430
431if test "$HAVE_PACKBITS" = "yes" ; then
432  AC_DEFINE(PACKBITS_SUPPORT,1,[Support Macintosh PackBits algorithm])
433fi
434
435AC_ARG_ENABLE(lzw,
436	      AS_HELP_STRING([--disable-lzw],
437			     [disable support for LZW algorithm]),
438	      [HAVE_LZW=$enableval], [HAVE_LZW=yes])
439
440if test "$HAVE_LZW" = "yes" ; then
441  AC_DEFINE(LZW_SUPPORT,1,[Support LZW algorithm])
442fi
443
444AC_ARG_ENABLE(thunder,
445	      AS_HELP_STRING([--disable-thunder],
446			     [disable support for ThunderScan 4-bit RLE algorithm]),
447	      [HAVE_THUNDER=$enableval], [HAVE_THUNDER=yes])
448
449if test "$HAVE_THUNDER" = "yes" ; then
450  AC_DEFINE(THUNDER_SUPPORT,1,[Support ThunderScan 4-bit RLE algorithm])
451fi
452
453HAVE_NEXT=yes
454
455AC_ARG_ENABLE(next,
456	      AS_HELP_STRING([--disable-next],
457			     [disable support for NeXT 2-bit RLE algorithm]),
458	      [HAVE_NEXT=$enableval], [HAVE_NEXT=yes])
459
460if test "$HAVE_NEXT" = "yes" ; then
461  AC_DEFINE(NEXT_SUPPORT,1,[Support NeXT 2-bit RLE algorithm])
462fi
463
464AC_ARG_ENABLE(logluv,
465	      AS_HELP_STRING([--disable-logluv],
466			     [disable support for LogLuv high dynamic range encoding]),
467	      [HAVE_LOGLUV=$enableval], [HAVE_LOGLUV=yes])
468
469if test "$HAVE_LOGLUV" = "yes" ; then
470  AC_DEFINE(LOGLUV_SUPPORT,1,[Support LogLuv high dynamic range encoding])
471fi
472
473dnl ---------------------------------------------------------------------------
474dnl Switch on/off support for Microsoft Document Imaging
475dnl ---------------------------------------------------------------------------
476
477AC_ARG_ENABLE(mdi,
478	      AS_HELP_STRING([--disable-mdi],
479			     [disable support for Microsoft Document Imaging]),
480	      [HAVE_MDI=$enableval], [HAVE_MDI=yes])
481
482if test "$HAVE_MDI" = "yes" ; then
483  AC_DEFINE(MDI_SUPPORT,1,[Support Microsoft Document Imaging format])
484fi
485
486dnl ---------------------------------------------------------------------------
487dnl Check for ZLIB.
488dnl ---------------------------------------------------------------------------
489
490HAVE_ZLIB=no
491
492AC_ARG_ENABLE(zlib,
493	      AS_HELP_STRING([--disable-zlib],
494			     [disable Zlib usage (required for Deflate compression, enabled by default)]),,)
495AC_ARG_WITH(zlib-include-dir,
496	    AS_HELP_STRING([--with-zlib-include-dir=DIR],
497			   [location of Zlib headers]),,)
498AC_ARG_WITH(zlib-lib-dir,
499	    AS_HELP_STRING([--with-zlib-lib-dir=DIR],
500			   [location of Zlib library binary]),,)
501
502if test "x$enable_zlib" != "xno" ; then
503
504  if test "x$with_zlib_lib_dir" != "x" ; then
505    LDFLAGS="-L$with_zlib_lib_dir $LDFLAGS"
506  fi
507
508  AC_CHECK_LIB(z, inflateEnd, [zlib_lib=yes], [zlib_lib=no],)
509  if test "$zlib_lib" = "no" -a "x$with_zlib_lib_dir" != "x"; then
510    AC_MSG_ERROR([Zlib library not found at $with_zlib_lib_dir])
511  fi
512
513  if test "x$with_zlib_include_dir" != "x" ; then
514    CPPFLAGS="-I$with_zlib_include_dir $CPPFLAGS"
515  fi
516  AC_CHECK_HEADER(zlib.h, [zlib_h=yes], [zlib_h=no])
517  if test "$zlib_h" = "no" -a "x$with_zlib_include_dir" != "x" ; then
518    AC_MSG_ERROR([Zlib headers not found at $with_zlib_include_dir])
519  fi
520
521  if test "$zlib_lib" = "yes" -a "$zlib_h" = "yes" ; then
522    HAVE_ZLIB=yes
523  fi
524
525fi
526
527if test "$HAVE_ZLIB" = "yes" ; then
528  AC_DEFINE(ZIP_SUPPORT,1,[Support Deflate compression])
529  LIBS="-lz $LIBS"
530  tiff_libs_private="-lz ${tiff_libs_private}"
531
532  if test "$HAVE_RPATH" = "yes" -a "x$with_zlib_lib_dir" != "x" ; then
533    LIBDIR="-R $with_zlib_lib_dir $LIBDIR"
534  fi
535
536fi
537
538dnl ---------------------------------------------------------------------------
539dnl Check for Pixar log-format algorithm.
540dnl ---------------------------------------------------------------------------
541
542AC_ARG_ENABLE(pixarlog,
543	      AS_HELP_STRING([--disable-pixarlog],
544			     [disable support for Pixar log-format algorithm (requires Zlib)]),
545	      [HAVE_PIXARLOG=$enableval], [HAVE_PIXARLOG=yes])
546
547if test "$HAVE_ZLIB" = "yes" -a "$HAVE_PIXARLOG" = "yes" ; then
548  AC_DEFINE(PIXARLOG_SUPPORT, 1,
549	    [Support Pixar log-format algorithm (requires Zlib)])
550else
551  HAVE_PIXARLOG=no
552fi
553
554dnl ---------------------------------------------------------------------------
555dnl Check for JPEG.
556dnl ---------------------------------------------------------------------------
557
558HAVE_JPEG=no
559
560AC_ARG_ENABLE(jpeg,
561	      AS_HELP_STRING([--disable-jpeg],
562			     [disable IJG JPEG library usage (required for JPEG compression, enabled by default)]),,)
563AC_ARG_WITH(jpeg-include-dir,
564	    AS_HELP_STRING([--with-jpeg-include-dir=DIR],
565			   [location of IJG JPEG library headers]),,)
566AC_ARG_WITH(jpeg-lib-dir,
567	    AS_HELP_STRING([--with-jpeg-lib-dir=DIR],
568			   [location of IJG JPEG library binary]),,)
569
570if test "x$enable_jpeg" != "xno" ; then
571
572  if test "x$with_jpeg_lib_dir" != "x" ; then
573    LDFLAGS="-L$with_jpeg_lib_dir $LDFLAGS"
574
575  fi
576
577  AC_CHECK_LIB(jpeg, jpeg_read_scanlines, [jpeg_lib=yes], [jpeg_lib=no],)
578  if test "$jpeg_lib" = "no" -a "x$with_jpeg_lib_dir" != "x" ; then
579    AC_MSG_ERROR([IJG JPEG library not found at $with_jpeg_lib_dir])
580  fi
581
582  if test "x$with_jpeg_include_dir" != "x" ; then
583    CPPFLAGS="-I$with_jpeg_include_dir $CPPFLAGS"
584  fi
585  AC_CHECK_HEADER(jpeglib.h, [jpeg_h=yes], [jpeg_h=no])
586  if test "$jpeg_h" = "no" -a "x$with_jpeg_include_dir" != "x" ; then
587    AC_MSG_ERROR([IJG JPEG library headers not found at $with_jpeg_include_dir])
588  fi
589
590  if test "$jpeg_lib" = "yes" -a "$jpeg_h" = "yes" ; then
591    HAVE_JPEG=yes
592  fi
593
594fi
595
596if test "$HAVE_JPEG" = "yes" ; then
597  AC_DEFINE(JPEG_SUPPORT,1,[Support JPEG compression (requires IJG JPEG library)])
598  LIBS="-ljpeg $LIBS"
599  tiff_libs_private="-ljpeg ${tiff_libs_private}"
600
601  if test "$HAVE_RPATH" = "yes" -a "x$with_jpeg_lib_dir" != "x" ; then
602    LIBDIR="-R $with_jpeg_lib_dir $LIBDIR"
603  fi
604
605fi
606
607dnl ---------------------------------------------------------------------------
608dnl Check for Old JPEG.
609dnl ---------------------------------------------------------------------------
610
611AC_ARG_ENABLE(old-jpeg,
612	      AS_HELP_STRING([--disable-old-jpeg],
613			     [disable support for Old JPEG compresson (read-only, enabled by default)]),
614	      [HAVE_OJPEG=${enableval}], [HAVE_OJPEG=yes])
615
616if test "$HAVE_JPEG" = "yes" -a "$HAVE_OJPEG" = "yes" ; then
617  AC_DEFINE(OJPEG_SUPPORT, 1,
618	    [Support Old JPEG compresson (read-only)])
619else
620  HAVE_OJPEG=no
621fi
622
623dnl ---------------------------------------------------------------------------
624dnl Check for JBIG-KIT.
625dnl ---------------------------------------------------------------------------
626
627HAVE_JBIG=no
628
629AC_ARG_ENABLE(jbig,
630	      AS_HELP_STRING([--disable-jbig],
631			     [disable JBIG-KIT usage (required for ISO JBIG compression, enabled by default)]),,)
632AC_ARG_WITH(jbig-include-dir,
633	    AS_HELP_STRING([--with-jbig-include-dir=DIR],
634			   [location of JBIG-KIT headers]),,)
635AC_ARG_WITH(jbig-lib-dir,
636	    AS_HELP_STRING([--with-jbig-lib-dir=DIR],
637			   [location of JBIG-KIT library binary]),,)
638
639if test "x$enable_jbig" != "xno" ; then
640
641  if test "x$with_jbig_lib_dir" != "x" ; then
642    LDFLAGS="-L$with_jbig_lib_dir $LDFLAGS"
643
644  fi
645
646  AC_CHECK_LIB(jbig, jbg_dec_init, [jbig_lib=yes], [jbig_lib=no],)
647  if test "$jbig_lib" = "no" -a "x$with_jbig_lib_dir" != "x" ; then
648    AC_MSG_ERROR([JBIG-KIT library not found at $with_jbig_lib_dir])
649  fi
650
651  if test "x$with_jbig_include_dir" != "x" ; then
652    CPPFLAGS="-I$with_jbig_include_dir $CPPFLAGS"
653  fi
654  AC_CHECK_HEADER(jbig.h, [jbig_h=yes], [jbig_h=no])
655  if test "$jbig_h" = "no" -a "x$with_jbig_include_dir" != "x" ; then
656    AC_MSG_ERROR([JBIG-KIT library headers not found at $with_jbig_include_dir])
657  fi
658
659  if test "$jbig_lib" = "yes" -a "$jbig_h" = "yes" ; then
660    HAVE_JBIG=yes
661  fi
662
663fi
664
665if test "$HAVE_JBIG" = "yes" ; then
666  AC_DEFINE(JBIG_SUPPORT,1,[Support ISO JBIG compression (requires JBIG-KIT library)])
667  LIBS="-ljbig $LIBS"
668  tiff_libs_private="-ljbig ${tiff_libs_private}"
669
670  if test "$HAVE_RPATH" = "yes" -a "x$with_jbig_lib_dir" != "x" ; then
671    LIBDIR="-R $with_jbig_lib_dir $LIBDIR"
672  fi
673
674  # Older versions of jbigkit lack jbg_newlen
675  AC_CHECK_FUNCS([jbg_newlen])
676
677fi
678
679dnl ---------------------------------------------------------------------------
680dnl Check for liblzma2.
681dnl ---------------------------------------------------------------------------
682
683HAVE_LZMA=no
684
685AC_ARG_ENABLE(lzma,
686	      AS_HELP_STRING([--disable-lzma],
687			     [disable liblzma usage (required for LZMA2 compression, enabled by default)]),,)
688AC_ARG_WITH(lzma-include-dir,
689	    AS_HELP_STRING([--with-lzma-include-dir=DIR],
690			   [location of liblzma headers]),,)
691AC_ARG_WITH(lzma-lib-dir,
692	    AS_HELP_STRING([--with-lzma-lib-dir=DIR],
693			   [location of liblzma library binary]),,)
694
695if test "x$enable_lzma" != "xno" ; then
696
697  if test "x$with_lzma_lib_dir" != "x" ; then
698    LDFLAGS="-L$with_lzma_lib_dir $LDFLAGS"
699  fi
700
701  AC_CHECK_LIB(lzma, lzma_code, [lzma_lib=yes], [lzma_lib=no],)
702  if test "$lzma_lib" = "no" -a "x$with_lzma_lib_dir" != "x"; then
703    AC_MSG_ERROR([lzma library not found at $with_lzma_lib_dir])
704  fi
705
706  if test "x$with_lzma_include_dir" != "x" ; then
707    CPPFLAGS="-I$with_lzma_include_dir $CPPFLAGS"
708  fi
709  AC_CHECK_HEADER(lzma.h, [lzma_h=yes], [lzma_h=no])
710  if test "$lzma_h" = "no" -a "x$with_lzma_include_dir" != "x" ; then
711    AC_MSG_ERROR([Liblzma headers not found at $with_lzma_include_dir])
712  fi
713
714  if test "$lzma_lib" = "yes" -a "$lzma_h" = "yes" ; then
715    HAVE_LZMA=yes
716  fi
717
718fi
719
720if test "$HAVE_LZMA" = "yes" ; then
721  AC_DEFINE(LZMA_SUPPORT,1,[Support LZMA2 compression])
722  LIBS="-llzma $LIBS"
723
724  if test "$HAVE_RPATH" = "yes" -a "x$with_lzma_lib_dir" != "x" ; then
725    LIBDIR="-R $with_lzma_lib_dir $LIBDIR"
726  fi
727
728fi
729
730dnl ---------------------------------------------------------------------------
731dnl Should 8/12 bit jpeg mode be enabled?
732dnl ---------------------------------------------------------------------------
733
734HAVE_JPEG12=no
735
736AC_ARG_ENABLE(jpeg12,
737	      AS_HELP_STRING([--enable-jpeg12],
738			     [enable libjpeg 8/12bit dual mode]),,)
739AC_ARG_WITH(jpeg12-include-dir,
740	    AS_HELP_STRING([--with-jpeg12-include-dir=DIR],
741			   [location of libjpeg 12bit headers]),,)
742AC_ARG_WITH(jpeg12-lib,
743	    AS_HELP_STRING([--with-jpeg12-lib=LIBRARY],
744			   [path to libjpeg 12bit library]),,)
745
746if test "x$enable_jpeg12" == "xyes" ; then
747
748  if test "x$with_jpeg12_lib" != "x" ; then
749    LIBS="$with_jpeg12_lib $LIBS"
750  fi
751
752  HAVE_JPEG12=yes
753
754  AC_DEFINE(JPEG_DUAL_MODE_8_12,1,[8/12 bit libjpeg dual mode enabled])
755  if test "x$with_jpeg12_include_dir" != "x" ; then
756    AC_DEFINE_UNQUOTED(LIBJPEG_12_PATH,"$with_jpeg12_include_dir/jpeglib.h",[12bit libjpeg primary include file with path])
757  fi
758fi
759
760
761dnl ---------------------------------------------------------------------------
762dnl Check for C++.
763dnl ---------------------------------------------------------------------------
764
765AC_ARG_ENABLE(cxx,
766	      AS_HELP_STRING([--enable-cxx],
767			     [enable C++ stream API building (requires C++ compiler)]),
768	      [HAVE_CXX=$enableval], [HAVE_CXX=yes])
769
770if test "$HAVE_CXX" = "yes" ; then
771  AC_DEFINE(CXX_SUPPORT, 1, [Support C++ stream API (requires C++ compiler)])
772else
773  HAVE_CXX=no
774fi
775
776AM_CONDITIONAL(HAVE_CXX, test "$HAVE_CXX" = "yes")
777
778dnl ---------------------------------------------------------------------------
779dnl Check for OpenGL and GLUT.
780dnl ---------------------------------------------------------------------------
781
782HAVE_OPENGL=no
783
784AC_PATH_XTRA
785
786AX_CHECK_GL
787AX_CHECK_GLU
788AX_CHECK_GLUT
789
790if test "$no_x" != "yes" -a "$no_gl" != "yes" \
791	-a "$no_glu" != "yes" -a "$no_glut" != "yes" ; then
792  HAVE_OPENGL=yes
793fi
794
795AM_CONDITIONAL(HAVE_OPENGL, test "$HAVE_OPENGL" = "yes")
796
797dnl ---------------------------------------------------------------------------
798dnl Check for Win32 IO: make sure we have windows.h but not cygwin
799dnl this must be after the ogl test, since that looks for windows.h and we
800dnl test it
801dnl ---------------------------------------------------------------------------
802
803win32_io_ok=no
804case "${host_os}" in
805    cygwin*)
806        ;;
807    *)
808        if test x"$ac_cv_header_windows_h" = xyes; then
809            win32_io_ok=yes
810	    AC_DEFINE(USE_WIN32_FILEIO,1,[define to use win32 IO system])
811	fi
812        ;;
813esac
814AM_CONDITIONAL([WIN32_IO], [test "$win32_io_ok" = yes])
815
816dnl ---------------------------------------------------------------------------
817dnl Check for X Athena Widgets
818dnl ---------------------------------------------------------------------------
819
820dnl HAVE_XAW=no
821
822dnl ICE_FIND_ATHENA
823
824dnl if test "$no_xaw" != "yes" ; then
825dnl   HAVE_XAW=yes
826dnl fi
827
828dnl AM_CONDITIONAL(HAVE_XAW, test "$HAVE_XAW" = "yes")
829
830dnl ===========================================================================
831dnl ``Orthogonal Features''
832dnl ===========================================================================
833
834dnl ---------------------------------------------------------------------------
835dnl Default handling of strip chopping support.
836dnl ---------------------------------------------------------------------------
837
838AC_ARG_ENABLE(strip-chopping,
839	      AS_HELP_STRING([--disable-strip-chopping],
840			     [disable support for strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of specified size to reduce memory usage)]),
841	      [HAVE_STRIPCHOP=$enableval], [HAVE_STRIPCHOP=yes])
842AC_ARG_WITH(default-strip-size,
843	    AS_HELP_STRING([--with-default-strip-size=SIZE],
844			   [default size of the strip in bytes (when strip chopping enabled) [[default=8192]]]),,)
845
846if test "$HAVE_STRIPCHOP" = "yes" \
847	-a "x$with_default_strip_size" != "xno"; then
848  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)])
849
850  if test "x$with_default_strip_size" = "x" \
851	  -o "x$with_default_strip_size" = "xyes"; then
852    with_default_strip_size="8192"
853  fi
854
855  AC_DEFINE_UNQUOTED(STRIP_SIZE_DEFAULT,$with_default_strip_size,[Default size of the strip in bytes (when strip chopping enabled)])
856
857fi
858
859dnl ---------------------------------------------------------------------------
860dnl Should we try to defer loading of strip/tile offsets and sizes to
861dnl optimize directory scanning?  These is an experimental feature for
862dnl libtiff 4.0.
863dnl ---------------------------------------------------------------------------
864
865AC_ARG_ENABLE(defer-strile-load,
866	      AS_HELP_STRING([--enable-defer-strile-load],
867			     [enable deferred strip/tile offset/size loading (experimental)]),
868	      [HAVE_DEFER_STRILE_LOAD=$enableval], [HAVE_DEFER_STRILE_LOAD=no])
869
870if test "$HAVE_DEFER_STRILE_LOAD" = "yes" ; then
871  AC_DEFINE(DEFER_STRILE_LOAD,1,[enable deferred strip/tile offset/size loading (experimental)])
872
873fi
874
875dnl ---------------------------------------------------------------------------
876dnl Check for support of CHUNKY_STRIP_READ_SUPPORT, a mechanism to allowing
877dnl reading large strips (usually one strip files) in chunks when using
878dnl TIFFReadScanline().  This is an experimental feature in libtiff 4.0.
879dnl ---------------------------------------------------------------------------
880
881AC_ARG_ENABLE(chunky-strip-read,
882	      AS_HELP_STRING([--enable-chunky-strip-read],
883			     [enable reading large strips in chunks for TIFFReadScanline() (experimental)]),
884	      [HAVE_CHUNKY_STRIP_READ=$enableval], [HAVE_CHUNKY_STRIP_READ=no])
885
886if test "$HAVE_CHUNKY_STRIP_READ" = "yes" ; then
887  AC_DEFINE(CHUNKY_STRIP_READ_SUPPORT,1,[enable partial strip reading for large strips (experimental)])
888
889fi
890
891dnl ---------------------------------------------------------------------------
892dnl Default subifd support.
893dnl ---------------------------------------------------------------------------
894AC_DEFINE(SUBIFD_SUPPORT,1,[Enable SubIFD tag (330) support])
895
896dnl ---------------------------------------------------------------------------
897dnl Default handling of ASSOCALPHA support.
898dnl ---------------------------------------------------------------------------
899
900AC_ARG_ENABLE(extrasample-as-alpha,
901	      AS_HELP_STRING([--disable-extrasample-as-alpha],
902			     [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]),
903	      [HAVE_EXTRASAMPLE_AS_ALPHA=$enableval],
904	      [HAVE_EXTRASAMPLE_AS_ALPHA=yes])
905
906if test "$HAVE_EXTRASAMPLE_AS_ALPHA" = "yes" ; then
907  AC_DEFINE(DEFAULT_EXTRASAMPLE_AS_ALPHA, 1,
908	    [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.])
909fi
910
911dnl ---------------------------------------------------------------------------
912dnl Default handling of YCbCr subsampling support.
913dnl See Bug 168 in Bugzilla, and JPEGFixupTestSubsampling() for details.
914dnl ---------------------------------------------------------------------------
915
916AC_ARG_ENABLE(check-ycbcr-subsampling,
917	      AS_HELP_STRING([--disable-check-ycbcr-subsampling],
918			     [disable picking up YCbCr subsampling info from the JPEG data stream to support files lacking the tag]),
919	      [CHECK_JPEG_YCBCR_SUBSAMPLING=$enableval],
920	      [CHECK_JPEG_YCBCR_SUBSAMPLING=yes])
921
922if test "$CHECK_JPEG_YCBCR_SUBSAMPLING" = "yes" ; then
923  AC_DEFINE(CHECK_JPEG_YCBCR_SUBSAMPLING, 1,
924	    [Pick up YCbCr subsampling info from the JPEG data stream to support files lacking the tag (default enabled).])
925fi
926
927dnl ---------------------------------------------------------------------------
928
929AC_SUBST(LIBDIR)
930
931AC_CONFIG_HEADERS([libtiff/tif_config.h libtiff/tiffconf.h])
932
933AC_CONFIG_FILES([Makefile \
934		 build/Makefile \
935		 contrib/Makefile \
936		 contrib/addtiffo/Makefile \
937		 contrib/dbs/Makefile \
938		 contrib/dbs/xtiff/Makefile \
939		 contrib/iptcutil/Makefile \
940		 contrib/mfs/Makefile \
941		 contrib/pds/Makefile \
942		 contrib/ras/Makefile \
943		 contrib/stream/Makefile \
944		 contrib/tags/Makefile \
945		 contrib/win_dib/Makefile \
946                 html/Makefile \
947		 html/images/Makefile \
948		 html/man/Makefile \
949                 libtiff-4.pc \
950                 libtiff/Makefile \
951                 man/Makefile \
952		 port/Makefile \
953		 test/Makefile \
954                 tools/Makefile])
955AC_OUTPUT
956
957dnl ---------------------------------------------------------------------------
958dnl Display configuration status
959dnl ---------------------------------------------------------------------------
960
961LOC_MSG()
962LOC_MSG([Libtiff is now configured for ${host}])
963LOC_MSG()
964LOC_MSG([  Installation directory:             ${prefix}])
965LOC_MSG([  Documentation directory:            ${LIBTIFF_DOCDIR}])
966LOC_MSG([  C compiler:                         ${CC} ${CFLAGS}])
967LOC_MSG([  C++ compiler:                       ${CXX} ${CXXFLAGS}])
968LOC_MSG([  Enable runtime linker paths:        ${HAVE_RPATH}])
969LOC_MSG([  Support Microsoft Document Imaging: ${HAVE_MDI}])
970LOC_MSG([  Use win32 IO:                       ${win32_io_ok}])
971LOC_MSG()
972LOC_MSG([ Support for internal codecs:])
973LOC_MSG([  CCITT Group 3 & 4 algorithms:       ${HAVE_CCITT}])
974LOC_MSG([  Macintosh PackBits algorithm:       ${HAVE_PACKBITS}])
975LOC_MSG([  LZW algorithm:                      ${HAVE_LZW}])
976LOC_MSG([  ThunderScan 4-bit RLE algorithm:    ${HAVE_THUNDER}])
977LOC_MSG([  NeXT 2-bit RLE algorithm:           ${HAVE_NEXT}])
978LOC_MSG([  LogLuv high dynamic range encoding: ${HAVE_LOGLUV}])
979LOC_MSG()
980LOC_MSG([ Support for external codecs:])
981LOC_MSG([  ZLIB support:                       ${HAVE_ZLIB}])
982LOC_MSG([  Pixar log-format algorithm:         ${HAVE_PIXARLOG}])
983LOC_MSG([  JPEG support:                       ${HAVE_JPEG}])
984LOC_MSG([  Old JPEG support:                   ${HAVE_OJPEG}])
985LOC_MSG([  JPEG 8/12 bit dual mode:            ${HAVE_JPEG12}])
986LOC_MSG([  ISO JBIG support:                   ${HAVE_JBIG}])
987LOC_MSG([  LZMA2 support:                      ${HAVE_LZMA}])
988LOC_MSG()
989LOC_MSG([  C++ support:                        ${HAVE_CXX}])
990LOC_MSG()
991dnl LOC_MSG([  X Athena Widgets support:           ${HAVE_XAW}])
992LOC_MSG([  OpenGL support:                     ${HAVE_OPENGL}])
993LOC_MSG()
994
995