roentgen b75cab
dnl                                               -*- Autoconf -*-
roentgen b75cab
dnl Tag Image File Format (TIFF) Software
roentgen b75cab
dnl
roentgen b75cab
dnl Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu></dron@ak4719.spb.edu>
roentgen b75cab
dnl
roentgen b75cab
dnl Permission to use, copy, modify, distribute, and sell this software and 
roentgen b75cab
dnl its documentation for any purpose is hereby granted without fee, provided
roentgen b75cab
dnl that (i) the above copyright notices and this permission notice appear in
roentgen b75cab
dnl all copies of the software and related documentation, and (ii) the names of
roentgen b75cab
dnl Sam Leffler and Silicon Graphics may not be used in any advertising or
roentgen b75cab
dnl publicity relating to the software without the specific, prior written
roentgen b75cab
dnl permission of Sam Leffler and Silicon Graphics.
roentgen b75cab
dnl 
roentgen b75cab
dnl THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
roentgen b75cab
dnl EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
roentgen b75cab
dnl WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
roentgen b75cab
dnl 
roentgen b75cab
dnl IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
roentgen b75cab
dnl ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
roentgen b75cab
dnl OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
roentgen b75cab
dnl WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
roentgen b75cab
dnl LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
roentgen b75cab
dnl OF THIS SOFTWARE.
roentgen b75cab
roentgen b75cab
dnl Process this file with autoconf to produce a configure script.
roentgen b75cab
roentgen b75cab
AC_PREREQ(2.64)
roentgen b75cab
AC_INIT([LibTIFF Software],[4.0.3],[tiff@lists.maptools.org],[tiff])
roentgen b75cab
AC_CONFIG_AUX_DIR(config)
roentgen b75cab
AC_CONFIG_MACRO_DIR(m4)
roentgen b75cab
AC_LANG(C)
roentgen b75cab
roentgen b75cab
dnl Compute the canonical host (run-time) system type variable
roentgen b75cab
AC_CANONICAL_HOST
roentgen b75cab
roentgen b75cab
AM_INIT_AUTOMAKE
roentgen b75cab
dnl Do not rebuild generated files every time
roentgen b75cab
AM_MAINTAINER_MODE
roentgen b75cab
roentgen b75cab
dnl Versioning.
roentgen b75cab
dnl Don't fill the ALPHA_VERSION field, if not applicable.
roentgen b75cab
LIBTIFF_MAJOR_VERSION=4
roentgen b75cab
LIBTIFF_MINOR_VERSION=0
roentgen b75cab
LIBTIFF_MICRO_VERSION=3
roentgen b75cab
LIBTIFF_ALPHA_VERSION=
roentgen b75cab
LIBTIFF_VERSION=$LIBTIFF_MAJOR_VERSION.$LIBTIFF_MINOR_VERSION.$LIBTIFF_MICRO_VERSION$LIBTIFF_ALPHA_VERSION
roentgen b75cab
dnl This will be used with the 'make release' target
roentgen b75cab
LIBTIFF_RELEASE_DATE=`date +"%Y%m%d"`
roentgen b75cab
roentgen b75cab
dnl Libtool library revision control info
roentgen b75cab
dnl See the libtool documentation under the heading "Libtool's versioning
roentgen b75cab
dnl system" in order to understand the meaning of these fields
roentgen b75cab
dnl
roentgen b75cab
dnl current
roentgen b75cab
dnl      The most recent interface number that this library implements.
roentgen b75cab
dnl revision
roentgen b75cab
dnl      The implementation number of the current interface.
roentgen b75cab
dnl age
roentgen b75cab
dnl      The difference between the newest and oldest interfaces that
roentgen b75cab
dnl      this library implements. In other words, the library implements
roentgen b75cab
dnl      all the interface numbers in the range from number current -
roentgen b75cab
dnl      age to current.
roentgen b75cab
dnl
roentgen b75cab
dnl Here are a set of rules to help you update your library version
roentgen b75cab
dnl information:
roentgen b75cab
dnl
roentgen b75cab
dnl  1. Start with version information of `0:0:0' for each libtool library.
roentgen b75cab
dnl  2. Update the version information only immediately before a public
roentgen b75cab
dnl     release of your software. More frequent updates are unnecessary, and
roentgen b75cab
dnl     only guarantee that the current interface number gets larger faster.
roentgen b75cab
dnl  3. If the library source code has changed at all since the last update,
roentgen b75cab
dnl     then increment revision (`c:r:a' becomes `c:r+1:a').
roentgen b75cab
dnl  4. If any interfaces have been added, removed, or changed since the last
roentgen b75cab
dnl     update, increment current, and set revision to 0.
roentgen b75cab
dnl  5. If any interfaces have been added since the last public release, then
roentgen b75cab
dnl     increment age.
roentgen b75cab
dnl  6. If any interfaces have been removed since the last public release,
roentgen b75cab
dnl     then set age to 0.                                
roentgen b75cab
LIBTIFF_CURRENT=7
roentgen b75cab
LIBTIFF_REVISION=0
roentgen b75cab
LIBTIFF_AGE=2
roentgen b75cab
LIBTIFF_VERSION_INFO=$LIBTIFF_CURRENT:$LIBTIFF_REVISION:$LIBTIFF_AGE
roentgen b75cab
roentgen b75cab
# This is a special hack for OpenBSD and MirOS systems. The dynamic linker
roentgen b75cab
# in OpenBSD uses some special semantics for shared libraries. Their soname
roentgen b75cab
# contains only two numbers, major and minor.
roentgen b75cab
# See http://bugzilla.remotesensing.org/show_bug.cgi?id=838 for details.
roentgen b75cab
#case "$host_os" in
roentgen b75cab
#    openbsd* | mirbsd*)
roentgen b75cab
#	LIBTIFF_VERSION_INFO=$LIBTIFF_MAJOR_VERSION$LIBTIFF_MINOR_VERSION:$LIBTIFF_MICRO_VERSION:0
roentgen b75cab
#	;;
roentgen b75cab
#    *)
roentgen b75cab
#	LIBTIFF_VERSION_INFO=$LIBTIFF_MAJOR_VERSION:$LIBTIFF_MINOR_VERSION:$LIBTIFF_MICRO_VERSION
roentgen b75cab
#	;;
roentgen b75cab
#esac
roentgen b75cab
roentgen b75cab
AC_SUBST(LIBTIFF_MAJOR_VERSION)
roentgen b75cab
AC_SUBST(LIBTIFF_MINOR_VERSION)
roentgen b75cab
AC_SUBST(LIBTIFF_MICRO_VERSION)
roentgen b75cab
AC_SUBST(LIBTIFF_ALPHA_VERSION)
roentgen b75cab
AC_SUBST(LIBTIFF_VERSION)
roentgen b75cab
AC_SUBST(LIBTIFF_VERSION_INFO)
roentgen b75cab
AC_SUBST(LIBTIFF_RELEASE_DATE)
roentgen b75cab
roentgen b75cab
dnl Checks for programs.
roentgen b75cab
AC_PROG_CC
roentgen b75cab
AM_PROG_CC_C_O
roentgen b75cab
roentgen b75cab
dnl We want warnings. As many warnings as possible.
roentgen b75cab
VL_PROG_CC_WARNINGS()
roentgen b75cab
roentgen b75cab
AC_PROG_INSTALL
roentgen b75cab
AC_PROG_LN_S
roentgen b75cab
roentgen b75cab
roentgen b75cab
# Check if LD supports linker scripts, and define automake conditional
roentgen b75cab
# HAVE_LD_VERSION_SCRIPT if so.  This functionality is currently
roentgen b75cab
# constrained to compilers using GNU ld on ELF systems or systems
roentgen b75cab
# which provide an adequate emulation thereof.
roentgen b75cab
AC_ARG_ENABLE([ld-version-script],
roentgen b75cab
  AS_HELP_STRING([--enable-ld-version-script],
roentgen b75cab
    [enable linker version script (default is disabled)]),
roentgen b75cab
    [have_ld_version_script=$enableval], [have_ld_version_script=no])
roentgen b75cab
if test "$have_ld_version_script" != no; then
roentgen b75cab
  AC_MSG_CHECKING([if LD -Wl,--version-script works])
roentgen b75cab
  save_LDFLAGS="$LDFLAGS"
roentgen b75cab
  LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
roentgen b75cab
  cat > conftest.map <
roentgen b75cab
VERS_1 {
roentgen b75cab
        global: sym;
roentgen b75cab
};
roentgen b75cab
roentgen b75cab
VERS_2 {
roentgen b75cab
        global: sym;
roentgen b75cab
} VERS_1;
roentgen b75cab
EOF
roentgen b75cab
  AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
roentgen b75cab
                 [have_ld_version_script=yes], [have_ld_version_script=no])
roentgen b75cab
  rm -f conftest.map
roentgen b75cab
  LDFLAGS="$save_LDFLAGS"
roentgen b75cab
  AC_MSG_RESULT($have_ld_version_script)
roentgen b75cab
fi
roentgen b75cab
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
roentgen b75cab
roentgen b75cab
roentgen b75cab
dnl Tests for Windows
roentgen b75cab
AC_EXEEXT
roentgen b75cab
AC_OBJEXT
roentgen b75cab
roentgen b75cab
dnl initialize libtool
roentgen b75cab
LT_INIT([win32-dll])
roentgen b75cab
LT_LANG([C++])
roentgen b75cab
roentgen b75cab
# Enable support for silent build rules
roentgen b75cab
AM_SILENT_RULES
roentgen b75cab
roentgen b75cab
dnl We don't need to add math library to all targets
roentgen b75cab
case "${host_os}" in
roentgen b75cab
    cygwin* | mingw32* | beos* | darwin*)
roentgen b75cab
        ;;
roentgen b75cab
    *)
roentgen b75cab
	AC_CHECK_LIB(m,sin,,,)
roentgen b75cab
        ;;
roentgen b75cab
esac
roentgen b75cab
roentgen b75cab
tiff_libs_private=
roentgen b75cab
AC_SUBST(tiff_libs_private)
roentgen b75cab
roentgen b75cab
dnl Checks for header files.
roentgen b75cab
AC_CHECK_HEADERS([assert.h fcntl.h io.h limits.h malloc.h search.h sys/time.h unistd.h])
roentgen b75cab
roentgen b75cab
dnl Checks for typedefs, structures, and compiler characteristics.
roentgen b75cab
AC_C_CONST
roentgen b75cab
AC_C_INLINE
roentgen b75cab
AC_C_BIGENDIAN
roentgen b75cab
AC_TYPE_OFF_T
roentgen b75cab
AC_TYPE_SIZE_T
roentgen b75cab
AC_HEADER_TIME
roentgen b75cab
AC_STRUCT_TM
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Compute sized types for current CPU and compiler options
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
roentgen b75cab
# Obtain size of an 'signed short' and define as SIZEOF_SIGNED_SHORT
roentgen b75cab
AC_CHECK_SIZEOF(signed short)
roentgen b75cab
roentgen b75cab
# Obtain size of an 'unsigned short' and define as SIZEOF_UNSIGNED_SHORT
roentgen b75cab
AC_CHECK_SIZEOF(unsigned short)
roentgen b75cab
roentgen b75cab
# Obtain size of an 'signed int' and define as SIZEOF_SIGNED_INT
roentgen b75cab
AC_CHECK_SIZEOF(signed int)
roentgen b75cab
roentgen b75cab
# Obtain size of an 'unsigned int' and define as SIZEOF_UNSIGNED_INT
roentgen b75cab
AC_CHECK_SIZEOF(unsigned int)
roentgen b75cab
roentgen b75cab
# Obtain size of a 'signed long' and define as SIZEOF_SIGNED_LONG
roentgen b75cab
AC_CHECK_SIZEOF(signed long)
roentgen b75cab
roentgen b75cab
# Obtain size of a 'unsigned long' and define as SIZEOF_UNSIGNED_LONG
roentgen b75cab
AC_CHECK_SIZEOF(unsigned long)
roentgen b75cab
roentgen b75cab
# Obtain size of a 'long long' and define as SIZEOF_SIGNED_LONG_LONG.
roentgen b75cab
# If 'long long' is not supported then the value defined is zero.
roentgen b75cab
AC_CHECK_SIZEOF(signed long long)
roentgen b75cab
roentgen b75cab
# Obtain size of a 'unsigned long long' and define as
roentgen b75cab
# SIZEOF_UNSIGNED_LONG_LONG.  If 'unsigned long long' is not
roentgen b75cab
# supported then the value defined is zero.
roentgen b75cab
AC_CHECK_SIZEOF(unsigned long long)
roentgen b75cab
roentgen b75cab
# Obtain the size of an 'unsigned char *' and define as
roentgen b75cab
# SIZEOF_UNSIGNED_CHAR_P.  Result is available in
roentgen b75cab
# ac_cv_sizeof_unsigned_char_p.
roentgen b75cab
AC_CHECK_SIZEOF(unsigned char *)
roentgen b75cab
roentgen b75cab
AC_MSG_CHECKING(for signed 8-bit type)
roentgen b75cab
INT8_T='signed char'
roentgen b75cab
AC_MSG_RESULT($INT8_T)
roentgen b75cab
AC_DEFINE_UNQUOTED(TIFF_INT8_T,$INT8_T,[Signed 8-bit type])
roentgen b75cab
roentgen b75cab
AC_MSG_CHECKING(for unsigned 8-bit type)
roentgen b75cab
UINT8_T='unsigned char'
roentgen b75cab
AC_MSG_RESULT($UINT8_T)
roentgen b75cab
AC_DEFINE_UNQUOTED(TIFF_UINT8_T,$UINT8_T,[Unsigned 8-bit type])
roentgen b75cab
roentgen b75cab
AC_MSG_CHECKING(for signed 16-bit type)
roentgen b75cab
INT16_T='signed short'
roentgen b75cab
AC_MSG_RESULT($INT16_T)
roentgen b75cab
AC_DEFINE_UNQUOTED(TIFF_INT16_T,$INT16_T,[Signed 16-bit type])
roentgen b75cab
roentgen b75cab
roentgen b75cab
AC_MSG_CHECKING(for unsigned 16-bit type)
roentgen b75cab
UINT16_T='unsigned short'
roentgen b75cab
AC_MSG_RESULT($UINT16_T)
roentgen b75cab
AC_DEFINE_UNQUOTED(TIFF_UINT16_T,$UINT16_T,[Unsigned 16-bit type])
roentgen b75cab
roentgen b75cab
AC_MSG_CHECKING(for signed 32-bit type)
roentgen b75cab
INT32_T='none'
roentgen b75cab
INT32_FORMAT='none'
roentgen b75cab
if test $ac_cv_sizeof_signed_int -eq 4
roentgen b75cab
then
roentgen b75cab
  INT32_T='signed int'
roentgen b75cab
  INT32_FORMAT='"%d"'
roentgen b75cab
elif test $ac_cv_sizeof_signed_long -eq 4
roentgen b75cab
then
roentgen b75cab
  INT32_T='signed long'
roentgen b75cab
  INT32_FORMAT='"%ld"'
roentgen b75cab
fi
roentgen b75cab
AC_MSG_RESULT($INT32_T)
roentgen b75cab
AC_DEFINE_UNQUOTED(TIFF_INT32_T,$INT32_T,[Signed 32-bit type])
roentgen b75cab
AC_DEFINE_UNQUOTED(TIFF_INT32_FORMAT,$INT32_FORMAT,[Signed 32-bit type formatter])
roentgen b75cab
roentgen b75cab
AC_MSG_CHECKING(for unsigned 32-bit type)
roentgen b75cab
UINT32_T='none'
roentgen b75cab
UINT32_FORMAT='none'
roentgen b75cab
if test $ac_cv_sizeof_unsigned_int -eq 4
roentgen b75cab
then
roentgen b75cab
  UINT32_T='unsigned int'
roentgen b75cab
  UINT32_FORMAT='"%u"'
roentgen b75cab
elif test $ac_cv_sizeof_unsigned_long -eq 4
roentgen b75cab
then
roentgen b75cab
  UINT32_T='unsigned long'
roentgen b75cab
  UINT32_FORMAT='"%lu"'
roentgen b75cab
fi
roentgen b75cab
AC_MSG_RESULT($UINT32_T)
roentgen b75cab
AC_DEFINE_UNQUOTED(TIFF_UINT32_T,$UINT32_T,[Unsigned 32-bit type])
roentgen b75cab
AC_DEFINE_UNQUOTED(TIFF_UINT32_FORMAT,$UINT32_FORMAT,[Unsigned 32-bit type formatter])
roentgen b75cab
roentgen b75cab
AC_MSG_CHECKING(for signed 64-bit type)
roentgen b75cab
INT64_T='none'
roentgen b75cab
INT64_FORMAT='none'
roentgen b75cab
if test $ac_cv_sizeof_signed_long -eq 8
roentgen b75cab
then
roentgen b75cab
  INT64_T='signed long'
roentgen b75cab
  INT64_FORMAT='"%ld"'
roentgen b75cab
elif test $ac_cv_sizeof_signed_long_long -eq 8
roentgen b75cab
then
roentgen b75cab
  INT64_T='signed long long'
roentgen b75cab
  case "${host_os}" in
roentgen b75cab
    mingw32*)
roentgen b75cab
      # MinGW32 understands 'long long', but uses printf from WIN32 CRT
roentgen b75cab
      INT64_FORMAT='"%I64d"'
roentgen b75cab
      ;;
roentgen b75cab
    *)
roentgen b75cab
      INT64_FORMAT='"%lld"'
roentgen b75cab
      ;;
roentgen b75cab
  esac
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
roentgen b75cab
AC_MSG_RESULT($INT64_T)
roentgen b75cab
AC_DEFINE_UNQUOTED(TIFF_INT64_T,$INT64_T,[Signed 64-bit type])
roentgen b75cab
AC_DEFINE_UNQUOTED(TIFF_INT64_FORMAT,$INT64_FORMAT,[Signed 64-bit type formatter])
roentgen b75cab
roentgen b75cab
AC_MSG_CHECKING(for unsigned 64-bit type)
roentgen b75cab
UINT64_T='none'
roentgen b75cab
UINT64_FORMAT='none'
roentgen b75cab
if test $ac_cv_sizeof_unsigned_long -eq 8
roentgen b75cab
then
roentgen b75cab
  UINT64_T='unsigned long'
roentgen b75cab
  UINT64_FORMAT='"%lu"'
roentgen b75cab
elif test $ac_cv_sizeof_unsigned_long_long -eq 8
roentgen b75cab
then
roentgen b75cab
  UINT64_T='unsigned long long'
roentgen b75cab
  case "${host_os}" in
roentgen b75cab
    mingw32*)
roentgen b75cab
      # MinGW32 understands 'unsigned long long', but uses printf from WIN32 CRT
roentgen b75cab
      UINT64_FORMAT='"%I64u"'
roentgen b75cab
      ;;
roentgen b75cab
    *)
roentgen b75cab
      UINT64_FORMAT='"%llu"'
roentgen b75cab
      ;;
roentgen b75cab
  esac
roentgen b75cab
fi
roentgen b75cab
AC_MSG_RESULT($UINT64_T)
roentgen b75cab
AC_DEFINE_UNQUOTED(TIFF_UINT64_T,$UINT64_T,[Unsigned 64-bit type])
roentgen b75cab
AC_DEFINE_UNQUOTED(TIFF_UINT64_FORMAT,$UINT64_FORMAT,[Unsigned 64-bit type formatter])
roentgen b75cab
roentgen b75cab
# Determine TIFF equivalent of ssize_t
roentgen b75cab
AC_MSG_CHECKING(for signed size type)
roentgen b75cab
SSIZE_T='unknown'
roentgen b75cab
SSIZE_FORMAT='unknown'
roentgen b75cab
if test $ac_cv_sizeof_signed_long -eq $ac_cv_sizeof_unsigned_char_p
roentgen b75cab
then
roentgen b75cab
  SSIZE_T='signed long'
roentgen b75cab
  SSIZE_FORMAT='"%ld"'
roentgen b75cab
elif test $ac_cv_sizeof_signed_long_long -eq $ac_cv_sizeof_unsigned_char_p
roentgen b75cab
then
roentgen b75cab
  SSIZE_T='signed long long'
roentgen b75cab
  SSIZE_FORMAT='"%lld"'
roentgen b75cab
fi
roentgen b75cab
AC_MSG_RESULT($SSIZE_T)
roentgen b75cab
AC_DEFINE_UNQUOTED(TIFF_SSIZE_T,$SSIZE_T,[Signed size type])
roentgen b75cab
AC_DEFINE_UNQUOTED(TIFF_SSIZE_FORMAT,$SSIZE_FORMAT,[Signed size type formatter])
roentgen b75cab
roentgen b75cab
# Determine the type to use for the difference between two pointers.
roentgen b75cab
# We will default to the POSIX ptrdiff_t if it is available, but will
roentgen b75cab
# be prepared for the case when it is not.
roentgen b75cab
PTRDIFF_T='unknown'
roentgen b75cab
PTRDIFF_FORMAT='"%ld"'
roentgen b75cab
AC_CHECK_TYPE(ptrdiff_t,[PTRDIFF_T=ptrdiff_t])
roentgen b75cab
if test $PTRDIFF_T = unknown
roentgen b75cab
then
roentgen b75cab
  PTRDIFF_T=$SSIZE_T
roentgen b75cab
  PTRDIFF_FORMAT=$SSIZE_FORMAT
roentgen b75cab
fi
roentgen b75cab
AC_MSG_CHECKING(for pointer difference type)
roentgen b75cab
AC_MSG_RESULT($PTRDIFF_T)
roentgen b75cab
AC_DEFINE_UNQUOTED(TIFF_PTRDIFF_T,$PTRDIFF_T,[Pointer difference type])
roentgen b75cab
AC_DEFINE_UNQUOTED(TIFF_PTRDIFF_FORMAT,$PTRDIFF_FORMAT,[Pointer difference type formatter])
roentgen b75cab
roentgen b75cab
dnl Some compilers (IBM VisualAge) has these types defined, so check it here:
roentgen b75cab
AC_CHECK_TYPES([int8, int16, int32],,,
roentgen b75cab
[
roentgen b75cab
#if HAVE_INTTYPES_H
roentgen b75cab
# include <inttypes.h></inttypes.h>
roentgen b75cab
#endif
roentgen b75cab
])
roentgen b75cab
roentgen b75cab
dnl Checks for library functions.
roentgen b75cab
AC_CHECK_FUNCS([floor isascii memmove memset mmap pow setmode sqrt strchr strrchr strstr strtol strtoull])
roentgen b75cab
roentgen b75cab
dnl Will use local replacements for unavailable functions
roentgen b75cab
AC_REPLACE_FUNCS(getopt)
roentgen b75cab
AC_REPLACE_FUNCS(strcasecmp)
roentgen b75cab
AC_REPLACE_FUNCS(strtoul)
roentgen b75cab
AC_REPLACE_FUNCS(strtoull)
roentgen b75cab
AC_REPLACE_FUNCS(lfind)
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Check the native cpu bit order.
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
AC_MSG_CHECKING([native cpu bit order])
roentgen b75cab
case "$host_cpu" in
roentgen b75cab
    i*86*|x86_64*)
roentgen b75cab
        HOST_FILLORDER=FILLORDER_LSB2MSB
roentgen b75cab
	AC_MSG_RESULT([lsb2msb])
roentgen b75cab
	;;
roentgen b75cab
    *)
roentgen b75cab
	HOST_FILLORDER=FILLORDER_MSB2LSB
roentgen b75cab
	AC_MSG_RESULT([msb2lsb])
roentgen b75cab
        ;;
roentgen b75cab
esac
roentgen b75cab
AC_DEFINE_UNQUOTED(HOST_FILLORDER, $HOST_FILLORDER, [Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB)])
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Configure legacy tifconf.h HOST_BIGENDIAN.
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
if test "$ac_cv_c_bigendian" = yes ; then
roentgen b75cab
    HOST_BIGENDIAN=1
roentgen b75cab
else
roentgen b75cab
    HOST_BIGENDIAN=0
roentgen b75cab
fi
roentgen b75cab
AC_DEFINE_UNQUOTED(HOST_BIGENDIAN,$HOST_BIGENDIAN,[Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian (Intel)])
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Make the POSIX.2 features available.
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
#_POSIX_C_SOURCE=2
roentgen b75cab
#AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE, $_POSIX_C_SOURCE, [Define this macro to a positive integer to control which POSIX functionality is made available.])
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Set the floating point format.
roentgen b75cab
dnl FIXME: write appropriate test.
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
HAVE_IEEEFP=1
roentgen b75cab
AC_DEFINE_UNQUOTED(HAVE_IEEEFP, $HAVE_IEEEFP, [Define as 0 or 1 according to the floating point format suported by the machine])
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Enable run-time paths to libraries usage.
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
roentgen b75cab
AC_ARG_ENABLE(rpath,
roentgen b75cab
	      AS_HELP_STRING([--enable-rpath],
roentgen b75cab
			     [Enable runtime linker paths (-R libtool option)]),
roentgen b75cab
	      [HAVE_RPATH=$enableval], [HAVE_RPATH=no])
roentgen b75cab
AM_CONDITIONAL(HAVE_RPATH, test "$HAVE_RPATH" = "yes")
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Support large files.
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
roentgen b75cab
AC_SYS_LARGEFILE
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Point to path where we should install documentation.
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
roentgen b75cab
LIBTIFF_DOCDIR=\${prefix}/share/doc/${PACKAGE}-${LIBTIFF_VERSION}
roentgen b75cab
roentgen b75cab
AC_ARG_WITH(docdir,
roentgen b75cab
	    AS_HELP_STRING([--with-docdir=DIR],
roentgen b75cab
			   [directory where documentation should be installed]),,)
roentgen b75cab
if test "x$with_docdir" != "x" ; then
roentgen b75cab
  LIBTIFF_DOCDIR=$with_docdir
roentgen b75cab
fi
roentgen b75cab
 
roentgen b75cab
AC_SUBST(LIBTIFF_DOCDIR)
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Switch on/off internal codecs.
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
roentgen b75cab
AC_ARG_ENABLE(ccitt,
roentgen b75cab
	      AS_HELP_STRING([--disable-ccitt],
roentgen b75cab
			     [disable support for CCITT Group 3 & 4 algorithms]),
roentgen b75cab
	      [HAVE_CCITT=$enableval], [HAVE_CCITT=yes])
roentgen b75cab
roentgen b75cab
if test "$HAVE_CCITT" = "yes" ; then
roentgen b75cab
  AC_DEFINE(CCITT_SUPPORT,1,[Support CCITT Group 3 & 4 algorithms])
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
AC_ARG_ENABLE(packbits,
roentgen b75cab
	      AS_HELP_STRING([--disable-packbits],
roentgen b75cab
			     [disable support for Macintosh PackBits algorithm]),
roentgen b75cab
	      [HAVE_PACKBITS=$enableval], [HAVE_PACKBITS=yes])
roentgen b75cab
roentgen b75cab
if test "$HAVE_PACKBITS" = "yes" ; then
roentgen b75cab
  AC_DEFINE(PACKBITS_SUPPORT,1,[Support Macintosh PackBits algorithm])
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
AC_ARG_ENABLE(lzw,
roentgen b75cab
	      AS_HELP_STRING([--disable-lzw],
roentgen b75cab
			     [disable support for LZW algorithm]),
roentgen b75cab
	      [HAVE_LZW=$enableval], [HAVE_LZW=yes])
roentgen b75cab
roentgen b75cab
if test "$HAVE_LZW" = "yes" ; then
roentgen b75cab
  AC_DEFINE(LZW_SUPPORT,1,[Support LZW algorithm])
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
AC_ARG_ENABLE(thunder,
roentgen b75cab
	      AS_HELP_STRING([--disable-thunder],
roentgen b75cab
			     [disable support for ThunderScan 4-bit RLE algorithm]),
roentgen b75cab
	      [HAVE_THUNDER=$enableval], [HAVE_THUNDER=yes])
roentgen b75cab
roentgen b75cab
if test "$HAVE_THUNDER" = "yes" ; then
roentgen b75cab
  AC_DEFINE(THUNDER_SUPPORT,1,[Support ThunderScan 4-bit RLE algorithm])
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
HAVE_NEXT=yes
roentgen b75cab
roentgen b75cab
AC_ARG_ENABLE(next,
roentgen b75cab
	      AS_HELP_STRING([--disable-next],
roentgen b75cab
			     [disable support for NeXT 2-bit RLE algorithm]),
roentgen b75cab
	      [HAVE_NEXT=$enableval], [HAVE_NEXT=yes])
roentgen b75cab
roentgen b75cab
if test "$HAVE_NEXT" = "yes" ; then
roentgen b75cab
  AC_DEFINE(NEXT_SUPPORT,1,[Support NeXT 2-bit RLE algorithm])
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
AC_ARG_ENABLE(logluv,
roentgen b75cab
	      AS_HELP_STRING([--disable-logluv],
roentgen b75cab
			     [disable support for LogLuv high dynamic range encoding]),
roentgen b75cab
	      [HAVE_LOGLUV=$enableval], [HAVE_LOGLUV=yes])
roentgen b75cab
roentgen b75cab
if test "$HAVE_LOGLUV" = "yes" ; then
roentgen b75cab
  AC_DEFINE(LOGLUV_SUPPORT,1,[Support LogLuv high dynamic range encoding])
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Switch on/off support for Microsoft Document Imaging
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
roentgen b75cab
AC_ARG_ENABLE(mdi,
roentgen b75cab
	      AS_HELP_STRING([--disable-mdi],
roentgen b75cab
			     [disable support for Microsoft Document Imaging]),
roentgen b75cab
	      [HAVE_MDI=$enableval], [HAVE_MDI=yes])
roentgen b75cab
roentgen b75cab
if test "$HAVE_MDI" = "yes" ; then
roentgen b75cab
  AC_DEFINE(MDI_SUPPORT,1,[Support Microsoft Document Imaging format])
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Check for ZLIB.
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
roentgen b75cab
HAVE_ZLIB=no
roentgen b75cab
roentgen b75cab
AC_ARG_ENABLE(zlib,
roentgen b75cab
	      AS_HELP_STRING([--disable-zlib],
roentgen b75cab
			     [disable Zlib usage (required for Deflate compression, enabled by default)]),,)
roentgen b75cab
AC_ARG_WITH(zlib-include-dir,
roentgen b75cab
	    AS_HELP_STRING([--with-zlib-include-dir=DIR],
roentgen b75cab
			   [location of Zlib headers]),,)
roentgen b75cab
AC_ARG_WITH(zlib-lib-dir,
roentgen b75cab
	    AS_HELP_STRING([--with-zlib-lib-dir=DIR],
roentgen b75cab
			   [location of Zlib library binary]),,)
roentgen b75cab
roentgen b75cab
if test "x$enable_zlib" != "xno" ; then
roentgen b75cab
roentgen b75cab
  if test "x$with_zlib_lib_dir" != "x" ; then
roentgen b75cab
    LDFLAGS="-L$with_zlib_lib_dir $LDFLAGS"
roentgen b75cab
  fi
roentgen b75cab
  
roentgen b75cab
  AC_CHECK_LIB(z, inflateEnd, [zlib_lib=yes], [zlib_lib=no],)
roentgen b75cab
  if test "$zlib_lib" = "no" -a "x$with_zlib_lib_dir" != "x"; then
roentgen b75cab
    AC_MSG_ERROR([Zlib library not found at $with_zlib_lib_dir])
roentgen b75cab
  fi
roentgen b75cab
    
roentgen b75cab
  if test "x$with_zlib_include_dir" != "x" ; then
roentgen b75cab
    CPPFLAGS="-I$with_zlib_include_dir $CPPFLAGS"
roentgen b75cab
  fi
roentgen b75cab
  AC_CHECK_HEADER(zlib.h, [zlib_h=yes], [zlib_h=no])
roentgen b75cab
  if test "$zlib_h" = "no" -a "x$with_zlib_include_dir" != "x" ; then
roentgen b75cab
    AC_MSG_ERROR([Zlib headers not found at $with_zlib_include_dir])
roentgen b75cab
  fi
roentgen b75cab
roentgen b75cab
  if test "$zlib_lib" = "yes" -a "$zlib_h" = "yes" ; then
roentgen b75cab
    HAVE_ZLIB=yes
roentgen b75cab
  fi
roentgen b75cab
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
if test "$HAVE_ZLIB" = "yes" ; then
roentgen b75cab
  AC_DEFINE(ZIP_SUPPORT,1,[Support Deflate compression])
roentgen b75cab
  LIBS="-lz $LIBS"
roentgen b75cab
  tiff_libs_private="-lz ${tiff_libs_private}"
roentgen b75cab
roentgen b75cab
  if test "$HAVE_RPATH" = "yes" -a "x$with_zlib_lib_dir" != "x" ; then
roentgen b75cab
    LIBDIR="-R $with_zlib_lib_dir $LIBDIR"
roentgen b75cab
  fi
roentgen b75cab
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Check for Pixar log-format algorithm.
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
roentgen b75cab
AC_ARG_ENABLE(pixarlog,
roentgen b75cab
	      AS_HELP_STRING([--disable-pixarlog],
roentgen b75cab
			     [disable support for Pixar log-format algorithm (requires Zlib)]),
roentgen b75cab
	      [HAVE_PIXARLOG=$enableval], [HAVE_PIXARLOG=yes])
roentgen b75cab
roentgen b75cab
if test "$HAVE_ZLIB" = "yes" -a "$HAVE_PIXARLOG" = "yes" ; then
roentgen b75cab
  AC_DEFINE(PIXARLOG_SUPPORT, 1,
roentgen b75cab
	    [Support Pixar log-format algorithm (requires Zlib)])
roentgen b75cab
else
roentgen b75cab
  HAVE_PIXARLOG=no
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Check for JPEG.
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
roentgen b75cab
HAVE_JPEG=no
roentgen b75cab
roentgen b75cab
AC_ARG_ENABLE(jpeg,
roentgen b75cab
	      AS_HELP_STRING([--disable-jpeg],
roentgen b75cab
			     [disable IJG JPEG library usage (required for JPEG compression, enabled by default)]),,)
roentgen b75cab
AC_ARG_WITH(jpeg-include-dir,
roentgen b75cab
	    AS_HELP_STRING([--with-jpeg-include-dir=DIR],
roentgen b75cab
			   [location of IJG JPEG library headers]),,)
roentgen b75cab
AC_ARG_WITH(jpeg-lib-dir,
roentgen b75cab
	    AS_HELP_STRING([--with-jpeg-lib-dir=DIR],
roentgen b75cab
			   [location of IJG JPEG library binary]),,)
roentgen b75cab
roentgen b75cab
if test "x$enable_jpeg" != "xno" ; then
roentgen b75cab
roentgen b75cab
  if test "x$with_jpeg_lib_dir" != "x" ; then
roentgen b75cab
    LDFLAGS="-L$with_jpeg_lib_dir $LDFLAGS"
roentgen b75cab
  
roentgen b75cab
  fi
roentgen b75cab
  
roentgen b75cab
  AC_CHECK_LIB(jpeg, jpeg_read_scanlines, [jpeg_lib=yes], [jpeg_lib=no],)
roentgen b75cab
  if test "$jpeg_lib" = "no" -a "x$with_jpeg_lib_dir" != "x" ; then
roentgen b75cab
    AC_MSG_ERROR([IJG JPEG library not found at $with_jpeg_lib_dir])
roentgen b75cab
  fi
roentgen b75cab
    
roentgen b75cab
  if test "x$with_jpeg_include_dir" != "x" ; then
roentgen b75cab
    CPPFLAGS="-I$with_jpeg_include_dir $CPPFLAGS"
roentgen b75cab
  fi
roentgen b75cab
  AC_CHECK_HEADER(jpeglib.h, [jpeg_h=yes], [jpeg_h=no])
roentgen b75cab
  if test "$jpeg_h" = "no" -a "x$with_jpeg_include_dir" != "x" ; then
roentgen b75cab
    AC_MSG_ERROR([IJG JPEG library headers not found at $with_jpeg_include_dir])
roentgen b75cab
  fi
roentgen b75cab
roentgen b75cab
  if test "$jpeg_lib" = "yes" -a "$jpeg_h" = "yes" ; then
roentgen b75cab
    HAVE_JPEG=yes
roentgen b75cab
  fi
roentgen b75cab
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
if test "$HAVE_JPEG" = "yes" ; then
roentgen b75cab
  AC_DEFINE(JPEG_SUPPORT,1,[Support JPEG compression (requires IJG JPEG library)])
roentgen b75cab
  LIBS="-ljpeg $LIBS"
roentgen b75cab
  tiff_libs_private="-ljpeg ${tiff_libs_private}"
roentgen b75cab
roentgen b75cab
  if test "$HAVE_RPATH" = "yes" -a "x$with_jpeg_lib_dir" != "x" ; then
roentgen b75cab
    LIBDIR="-R $with_jpeg_lib_dir $LIBDIR"
roentgen b75cab
  fi
roentgen b75cab
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Check for Old JPEG.
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
roentgen b75cab
AC_ARG_ENABLE(old-jpeg,
roentgen b75cab
	      AS_HELP_STRING([--disable-old-jpeg],
roentgen b75cab
			     [disable support for Old JPEG compresson (read-only, enabled by default)]),
roentgen b75cab
	      [HAVE_OJPEG=${enableval}], [HAVE_OJPEG=yes])
roentgen b75cab
roentgen b75cab
if test "$HAVE_JPEG" = "yes" -a "$HAVE_OJPEG" = "yes" ; then
roentgen b75cab
  AC_DEFINE(OJPEG_SUPPORT, 1,
roentgen b75cab
	    [Support Old JPEG compresson (read-only)])
roentgen b75cab
else
roentgen b75cab
  HAVE_OJPEG=no
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Check for JBIG-KIT.
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
roentgen b75cab
HAVE_JBIG=no
roentgen b75cab
roentgen b75cab
AC_ARG_ENABLE(jbig,
roentgen b75cab
	      AS_HELP_STRING([--disable-jbig],
roentgen b75cab
			     [disable JBIG-KIT usage (required for ISO JBIG compression, enabled by default)]),,)
roentgen b75cab
AC_ARG_WITH(jbig-include-dir,
roentgen b75cab
	    AS_HELP_STRING([--with-jbig-include-dir=DIR],
roentgen b75cab
			   [location of JBIG-KIT headers]),,)
roentgen b75cab
AC_ARG_WITH(jbig-lib-dir,
roentgen b75cab
	    AS_HELP_STRING([--with-jbig-lib-dir=DIR],
roentgen b75cab
			   [location of JBIG-KIT library binary]),,)
roentgen b75cab
roentgen b75cab
if test "x$enable_jbig" != "xno" ; then
roentgen b75cab
roentgen b75cab
  if test "x$with_jbig_lib_dir" != "x" ; then
roentgen b75cab
    LDFLAGS="-L$with_jbig_lib_dir $LDFLAGS"
roentgen b75cab
  
roentgen b75cab
  fi
roentgen b75cab
  
roentgen b75cab
  AC_CHECK_LIB(jbig, jbg_dec_init, [jbig_lib=yes], [jbig_lib=no],)
roentgen b75cab
  if test "$jbig_lib" = "no" -a "x$with_jbig_lib_dir" != "x" ; then
roentgen b75cab
    AC_MSG_ERROR([JBIG-KIT library not found at $with_jbig_lib_dir])
roentgen b75cab
  fi
roentgen b75cab
    
roentgen b75cab
  if test "x$with_jbig_include_dir" != "x" ; then
roentgen b75cab
    CPPFLAGS="-I$with_jbig_include_dir $CPPFLAGS"
roentgen b75cab
  fi
roentgen b75cab
  AC_CHECK_HEADER(jbig.h, [jbig_h=yes], [jbig_h=no])
roentgen b75cab
  if test "$jbig_h" = "no" -a "x$with_jbig_include_dir" != "x" ; then
roentgen b75cab
    AC_MSG_ERROR([JBIG-KIT library headers not found at $with_jbig_include_dir])
roentgen b75cab
  fi
roentgen b75cab
roentgen b75cab
  if test "$jbig_lib" = "yes" -a "$jbig_h" = "yes" ; then
roentgen b75cab
    HAVE_JBIG=yes
roentgen b75cab
  fi
roentgen b75cab
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
if test "$HAVE_JBIG" = "yes" ; then
roentgen b75cab
  AC_DEFINE(JBIG_SUPPORT,1,[Support ISO JBIG compression (requires JBIG-KIT library)])
roentgen b75cab
  LIBS="-ljbig $LIBS"
roentgen b75cab
  tiff_libs_private="-ljbig ${tiff_libs_private}"
roentgen b75cab
roentgen b75cab
  if test "$HAVE_RPATH" = "yes" -a "x$with_jbig_lib_dir" != "x" ; then
roentgen b75cab
    LIBDIR="-R $with_jbig_lib_dir $LIBDIR"
roentgen b75cab
  fi
roentgen b75cab
roentgen b75cab
  # Older versions of jbigkit lack jbg_newlen
roentgen b75cab
  AC_CHECK_FUNCS([jbg_newlen])
roentgen b75cab
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Check for liblzma2.
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
roentgen b75cab
HAVE_LZMA=no
roentgen b75cab
roentgen b75cab
AC_ARG_ENABLE(lzma,
roentgen b75cab
	      AS_HELP_STRING([--disable-lzma],
roentgen b75cab
			     [disable liblzma usage (required for LZMA2 compression, enabled by default)]),,)
roentgen b75cab
AC_ARG_WITH(lzma-include-dir,
roentgen b75cab
	    AS_HELP_STRING([--with-lzma-include-dir=DIR],
roentgen b75cab
			   [location of liblzma headers]),,)
roentgen b75cab
AC_ARG_WITH(lzma-lib-dir,
roentgen b75cab
	    AS_HELP_STRING([--with-lzma-lib-dir=DIR],
roentgen b75cab
			   [location of liblzma library binary]),,)
roentgen b75cab
roentgen b75cab
if test "x$enable_lzma" != "xno" ; then
roentgen b75cab
roentgen b75cab
  if test "x$with_lzma_lib_dir" != "x" ; then
roentgen b75cab
    LDFLAGS="-L$with_lzma_lib_dir $LDFLAGS"
roentgen b75cab
  fi
roentgen b75cab
  
roentgen b75cab
  AC_CHECK_LIB(lzma, lzma_code, [lzma_lib=yes], [lzma_lib=no],)
roentgen b75cab
  if test "$lzma_lib" = "no" -a "x$with_lzma_lib_dir" != "x"; then
roentgen b75cab
    AC_MSG_ERROR([lzma library not found at $with_lzma_lib_dir])
roentgen b75cab
  fi
roentgen b75cab
    
roentgen b75cab
  if test "x$with_lzma_include_dir" != "x" ; then
roentgen b75cab
    CPPFLAGS="-I$with_lzma_include_dir $CPPFLAGS"
roentgen b75cab
  fi
roentgen b75cab
  AC_CHECK_HEADER(lzma.h, [lzma_h=yes], [lzma_h=no])
roentgen b75cab
  if test "$lzma_h" = "no" -a "x$with_lzma_include_dir" != "x" ; then
roentgen b75cab
    AC_MSG_ERROR([Liblzma headers not found at $with_lzma_include_dir])
roentgen b75cab
  fi
roentgen b75cab
roentgen b75cab
  if test "$lzma_lib" = "yes" -a "$lzma_h" = "yes" ; then
roentgen b75cab
    HAVE_LZMA=yes
roentgen b75cab
  fi
roentgen b75cab
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
if test "$HAVE_LZMA" = "yes" ; then
roentgen b75cab
  AC_DEFINE(LZMA_SUPPORT,1,[Support LZMA2 compression])
roentgen b75cab
  LIBS="-llzma $LIBS"
roentgen b75cab
  tiff_libs_private="-llzma ${tiff_libs_private}"
roentgen b75cab
roentgen b75cab
  if test "$HAVE_RPATH" = "yes" -a "x$with_lzma_lib_dir" != "x" ; then
roentgen b75cab
    LIBDIR="-R $with_lzma_lib_dir $LIBDIR"
roentgen b75cab
  fi
roentgen b75cab
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Should 8/12 bit jpeg mode be enabled?
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
roentgen b75cab
HAVE_JPEG12=no
roentgen b75cab
roentgen b75cab
AC_ARG_ENABLE(jpeg12,
roentgen b75cab
	      AS_HELP_STRING([--enable-jpeg12],
roentgen b75cab
			     [enable libjpeg 8/12bit dual mode]),,)
roentgen b75cab
AC_ARG_WITH(jpeg12-include-dir,
roentgen b75cab
	    AS_HELP_STRING([--with-jpeg12-include-dir=DIR],
roentgen b75cab
			   [location of libjpeg 12bit headers]),,)
roentgen b75cab
AC_ARG_WITH(jpeg12-lib,
roentgen b75cab
	    AS_HELP_STRING([--with-jpeg12-lib=LIBRARY],
roentgen b75cab
			   [path to libjpeg 12bit library]),,)
roentgen b75cab
roentgen b75cab
if test "x$enable_jpeg12" == "xyes" ; then
roentgen b75cab
roentgen b75cab
  if test "x$with_jpeg12_lib" != "x" ; then
roentgen b75cab
    LIBS="$with_jpeg12_lib $LIBS"
roentgen b75cab
  fi
roentgen b75cab
  
roentgen b75cab
  HAVE_JPEG12=yes
roentgen b75cab
roentgen b75cab
  AC_DEFINE(JPEG_DUAL_MODE_8_12,1,[8/12 bit libjpeg dual mode enabled])
roentgen b75cab
  if test "x$with_jpeg12_include_dir" != "x" ; then
roentgen b75cab
    AC_DEFINE_UNQUOTED(LIBJPEG_12_PATH,"$with_jpeg12_include_dir/jpeglib.h",[12bit libjpeg primary include file with path])
roentgen b75cab
  fi
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Check for C++.
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
roentgen b75cab
AC_ARG_ENABLE(cxx,
roentgen b75cab
	      AS_HELP_STRING([--enable-cxx],
roentgen b75cab
			     [enable C++ stream API building (requires C++ compiler)]),
roentgen b75cab
	      [HAVE_CXX=$enableval], [HAVE_CXX=yes])
roentgen b75cab
roentgen b75cab
if test "$HAVE_CXX" = "yes" ; then
roentgen b75cab
  AC_DEFINE(CXX_SUPPORT, 1, [Support C++ stream API (requires C++ compiler)])
roentgen b75cab
else
roentgen b75cab
  HAVE_CXX=no
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
AM_CONDITIONAL(HAVE_CXX, test "$HAVE_CXX" = "yes")
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Check for OpenGL and GLUT.
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
roentgen b75cab
HAVE_OPENGL=no
roentgen b75cab
roentgen b75cab
roentgen b75cab
AC_PATH_XTRA
roentgen b75cab
roentgen b75cab
dnl AX_CHECK_GL sets GL_CFLAGS & GL_LIBS.  Also PTHREAD_LIBS,
roentgen b75cab
dnl PTHREAD_CFLAGS, & PTHREAD_CC as a side-effect
roentgen b75cab
AX_CHECK_GL
roentgen b75cab
roentgen b75cab
dnl AX_CHECK_GLU sets GLU_CFLAGS & GLU_LIBS
roentgen b75cab
AX_CHECK_GLU
roentgen b75cab
roentgen b75cab
dnl AX_CHECK_GLUT sets GLUT_CFLAGS & GLUT_LIBS
roentgen b75cab
AX_CHECK_GLUT
roentgen b75cab
roentgen b75cab
if test "$no_x" != "yes" -a "$no_gl" != "yes" \
roentgen b75cab
	-a "$no_glu" != "yes" -a "$no_glut" != "yes" ; then
roentgen b75cab
  HAVE_OPENGL=yes
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
AM_CONDITIONAL(HAVE_OPENGL, test "$HAVE_OPENGL" = "yes")
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Check for Win32 IO: make sure we have windows.h but not cygwin
roentgen b75cab
dnl this must be after the ogl test, since that looks for windows.h and we
roentgen b75cab
dnl test it
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
roentgen b75cab
win32_io_ok=no
roentgen b75cab
case "${host_os}" in
roentgen b75cab
    cygwin*)
roentgen b75cab
        ;;
roentgen b75cab
    *)
roentgen b75cab
        if test x"$ac_cv_header_windows_h" = xyes; then 
roentgen b75cab
            win32_io_ok=yes
roentgen b75cab
	    AC_DEFINE(USE_WIN32_FILEIO,1,[define to use win32 IO system])
roentgen b75cab
	fi
roentgen b75cab
        ;;
roentgen b75cab
esac
roentgen b75cab
AM_CONDITIONAL([WIN32_IO], [test "$win32_io_ok" = yes])
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Check for X Athena Widgets
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
roentgen b75cab
dnl HAVE_XAW=no
roentgen b75cab
roentgen b75cab
dnl ICE_FIND_ATHENA
roentgen b75cab
roentgen b75cab
dnl if test "$no_xaw" != "yes" ; then
roentgen b75cab
dnl   HAVE_XAW=yes
roentgen b75cab
dnl fi
roentgen b75cab
roentgen b75cab
dnl AM_CONDITIONAL(HAVE_XAW, test "$HAVE_XAW" = "yes")
roentgen b75cab
roentgen b75cab
dnl ===========================================================================
roentgen b75cab
dnl ``Orthogonal Features''
roentgen b75cab
dnl ===========================================================================
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Default handling of strip chopping support.
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
roentgen b75cab
AC_ARG_ENABLE(strip-chopping,
roentgen b75cab
	      AS_HELP_STRING([--disable-strip-chopping],
roentgen b75cab
			     [disable support for strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of specified size to reduce memory usage)]),
roentgen b75cab
	      [HAVE_STRIPCHOP=$enableval], [HAVE_STRIPCHOP=yes])
roentgen b75cab
AC_ARG_WITH(default-strip-size,
roentgen b75cab
	    AS_HELP_STRING([--with-default-strip-size=SIZE],
roentgen b75cab
			   [default size of the strip in bytes (when strip chopping enabled) [[default=8192]]]),,)
roentgen b75cab
roentgen b75cab
if test "$HAVE_STRIPCHOP" = "yes" \
roentgen b75cab
	-a "x$with_default_strip_size" != "xno"; then
roentgen b75cab
  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)])
roentgen b75cab
roentgen b75cab
  if test "x$with_default_strip_size" = "x" \
roentgen b75cab
	  -o "x$with_default_strip_size" = "xyes"; then
roentgen b75cab
    with_default_strip_size="8192"
roentgen b75cab
  fi
roentgen b75cab
roentgen b75cab
  AC_DEFINE_UNQUOTED(STRIP_SIZE_DEFAULT,$with_default_strip_size,[Default size of the strip in bytes (when strip chopping enabled)])
roentgen b75cab
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Should we try to defer loading of strip/tile offsets and sizes to 
roentgen b75cab
dnl optimize directory scanning?  These is an experimental feature for 
roentgen b75cab
dnl libtiff 4.0.
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
roentgen b75cab
AC_ARG_ENABLE(defer-strile-load,
roentgen b75cab
	      AS_HELP_STRING([--enable-defer-strile-load],
roentgen b75cab
			     [enable deferred strip/tile offset/size loading (experimental)]),
roentgen b75cab
	      [HAVE_DEFER_STRILE_LOAD=$enableval], [HAVE_DEFER_STRILE_LOAD=no])
roentgen b75cab
roentgen b75cab
if test "$HAVE_DEFER_STRILE_LOAD" = "yes" ; then
roentgen b75cab
  AC_DEFINE(DEFER_STRILE_LOAD,1,[enable deferred strip/tile offset/size loading (experimental)])
roentgen b75cab
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Check for support of CHUNKY_STRIP_READ_SUPPORT, a mechanism to allowing
roentgen b75cab
dnl reading large strips (usually one strip files) in chunks when using
roentgen b75cab
dnl TIFFReadScanline().  This is an experimental feature in libtiff 4.0.
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
roentgen b75cab
AC_ARG_ENABLE(chunky-strip-read,
roentgen b75cab
	      AS_HELP_STRING([--enable-chunky-strip-read],
roentgen b75cab
			     [enable reading large strips in chunks for TIFFReadScanline() (experimental)]),
roentgen b75cab
	      [HAVE_CHUNKY_STRIP_READ=$enableval], [HAVE_CHUNKY_STRIP_READ=no])
roentgen b75cab
roentgen b75cab
if test "$HAVE_CHUNKY_STRIP_READ" = "yes" ; then
roentgen b75cab
  AC_DEFINE(CHUNKY_STRIP_READ_SUPPORT,1,[enable partial strip reading for large strips (experimental)])
roentgen b75cab
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Default subifd support.
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
AC_DEFINE(SUBIFD_SUPPORT,1,[Enable SubIFD tag (330) support])
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Default handling of ASSOCALPHA support.
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
roentgen b75cab
AC_ARG_ENABLE(extrasample-as-alpha,
roentgen b75cab
	      AS_HELP_STRING([--disable-extrasample-as-alpha],
roentgen b75cab
			     [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]),
roentgen b75cab
	      [HAVE_EXTRASAMPLE_AS_ALPHA=$enableval],
roentgen b75cab
	      [HAVE_EXTRASAMPLE_AS_ALPHA=yes])
roentgen b75cab
roentgen b75cab
if test "$HAVE_EXTRASAMPLE_AS_ALPHA" = "yes" ; then
roentgen b75cab
  AC_DEFINE(DEFAULT_EXTRASAMPLE_AS_ALPHA, 1,
roentgen b75cab
	    [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.])
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Default handling of YCbCr subsampling support.
roentgen b75cab
dnl See Bug 168 in Bugzilla, and JPEGFixupTestSubsampling() for details.
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
roentgen b75cab
AC_ARG_ENABLE(check-ycbcr-subsampling,
roentgen b75cab
	      AS_HELP_STRING([--disable-check-ycbcr-subsampling],
roentgen b75cab
			     [disable picking up YCbCr subsampling info from the JPEG data stream to support files lacking the tag]),
roentgen b75cab
	      [CHECK_JPEG_YCBCR_SUBSAMPLING=$enableval],
roentgen b75cab
	      [CHECK_JPEG_YCBCR_SUBSAMPLING=yes])
roentgen b75cab
roentgen b75cab
if test "$CHECK_JPEG_YCBCR_SUBSAMPLING" = "yes" ; then
roentgen b75cab
  AC_DEFINE(CHECK_JPEG_YCBCR_SUBSAMPLING, 1,
roentgen b75cab
	    [Pick up YCbCr subsampling info from the JPEG data stream to support files lacking the tag (default enabled).])
roentgen b75cab
fi
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
roentgen b75cab
AC_SUBST(LIBDIR)
roentgen b75cab
roentgen b75cab
AC_CONFIG_HEADERS([libtiff/tif_config.h libtiff/tiffconf.h])
roentgen b75cab
roentgen b75cab
AC_CONFIG_FILES([Makefile \
roentgen b75cab
		 build/Makefile \
roentgen b75cab
		 contrib/Makefile \
roentgen b75cab
		 contrib/addtiffo/Makefile \
roentgen b75cab
		 contrib/dbs/Makefile \
roentgen b75cab
		 contrib/dbs/xtiff/Makefile \
roentgen b75cab
		 contrib/iptcutil/Makefile \
roentgen b75cab
		 contrib/mfs/Makefile \
roentgen b75cab
		 contrib/pds/Makefile \
roentgen b75cab
		 contrib/ras/Makefile \
roentgen b75cab
		 contrib/stream/Makefile \
roentgen b75cab
		 contrib/tags/Makefile \
roentgen b75cab
		 contrib/win_dib/Makefile \
roentgen b75cab
                 html/Makefile \
roentgen b75cab
		 html/images/Makefile \
roentgen b75cab
		 html/man/Makefile \
roentgen b75cab
                 libtiff-4.pc \
roentgen b75cab
                 libtiff/Makefile \
roentgen b75cab
                 man/Makefile \
roentgen b75cab
		 port/Makefile \
roentgen b75cab
		 test/Makefile \
roentgen b75cab
                 tools/Makefile])
roentgen b75cab
AC_OUTPUT
roentgen b75cab
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
dnl Display configuration status
roentgen b75cab
dnl ---------------------------------------------------------------------------
roentgen b75cab
roentgen b75cab
LOC_MSG()
roentgen b75cab
LOC_MSG([Libtiff is now configured for ${host}])
roentgen b75cab
LOC_MSG()
roentgen b75cab
LOC_MSG([  Installation directory:             ${prefix}])
roentgen b75cab
LOC_MSG([  Documentation directory:            ${LIBTIFF_DOCDIR}])
roentgen b75cab
LOC_MSG([  C compiler:                         ${CC} ${CFLAGS}])
roentgen b75cab
LOC_MSG([  C++ compiler:                       ${CXX} ${CXXFLAGS}])
roentgen b75cab
LOC_MSG([  Enable runtime linker paths:        ${HAVE_RPATH}])
roentgen b75cab
LOC_MSG([  Enable linker symbol versioning:    ${have_ld_version_script}])
roentgen b75cab
LOC_MSG([  Support Microsoft Document Imaging: ${HAVE_MDI}])
roentgen b75cab
LOC_MSG([  Use win32 IO:                       ${win32_io_ok}])
roentgen b75cab
LOC_MSG()
roentgen b75cab
LOC_MSG([ Support for internal codecs:])
roentgen b75cab
LOC_MSG([  CCITT Group 3 & 4 algorithms:       ${HAVE_CCITT}])
roentgen b75cab
LOC_MSG([  Macintosh PackBits algorithm:       ${HAVE_PACKBITS}])
roentgen b75cab
LOC_MSG([  LZW algorithm:                      ${HAVE_LZW}])
roentgen b75cab
LOC_MSG([  ThunderScan 4-bit RLE algorithm:    ${HAVE_THUNDER}])
roentgen b75cab
LOC_MSG([  NeXT 2-bit RLE algorithm:           ${HAVE_NEXT}])
roentgen b75cab
LOC_MSG([  LogLuv high dynamic range encoding: ${HAVE_LOGLUV}])
roentgen b75cab
LOC_MSG()
roentgen b75cab
LOC_MSG([ Support for external codecs:])
roentgen b75cab
LOC_MSG([  ZLIB support:                       ${HAVE_ZLIB}])
roentgen b75cab
LOC_MSG([  Pixar log-format algorithm:         ${HAVE_PIXARLOG}])
roentgen b75cab
LOC_MSG([  JPEG support:                       ${HAVE_JPEG}])
roentgen b75cab
LOC_MSG([  Old JPEG support:                   ${HAVE_OJPEG}])
roentgen b75cab
LOC_MSG([  JPEG 8/12 bit dual mode:            ${HAVE_JPEG12}])
roentgen b75cab
LOC_MSG([  ISO JBIG support:                   ${HAVE_JBIG}])
roentgen b75cab
LOC_MSG([  LZMA2 support:                      ${HAVE_LZMA}])
roentgen b75cab
LOC_MSG()
roentgen b75cab
LOC_MSG([  C++ support:                        ${HAVE_CXX}])
roentgen b75cab
LOC_MSG()
roentgen b75cab
dnl LOC_MSG([  X Athena Widgets support:           ${HAVE_XAW}])
roentgen b75cab
LOC_MSG([  OpenGL support:                     ${HAVE_OPENGL}])
roentgen b75cab
LOC_MSG()
roentgen b75cab