summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorBob Friesenhahn <bfriesen@simple.dallas.tx.us>2015-06-21 01:09:09 +0000
committerBob Friesenhahn <bfriesen@simple.dallas.tx.us>2015-06-21 01:09:09 +0000
commitd21d2b30577965e21bab284838b5a4aad02294e6 (patch)
treebf55a8dbcaa1b6d242a7f3829e675bb626b8a832 /configure.ac
parent108fe0c6609cc5fce6822a141110083b13794b1d (diff)
downloadlibtiff-git-d21d2b30577965e21bab284838b5a4aad02294e6.tar.gz
* libtiff/tif_config.vc.h: Make adjustments to match the new
definitions that configure produces, including for WIN64. Still needs to be tested. 'lld' is not assured by the run-time DLLs and so GCC warns. Add TIFF_SIZE_T and TIFF_SIZE_FORMAT to provide a type definition and printf format specifier to deal with printing values of 'size_t' type. In particular, this was necessary for WIN64. Added a configure test for if the system headers provide 'optarg' (normal case) and block out the many explicit 'extern' statements in the utilities. This was found to be necessary under Windows when getopt is in a DLL and the symbols are already imported with dllimport via standard header files.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac45
1 files changed, 44 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 7dd42e3d..7851956c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -182,6 +182,9 @@ AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
+dnl Check if optarg (and presumably related externs) already declared in headers
+AC_CHECK_DECLS([optarg])
+
dnl ---------------------------------------------------------------------------
dnl Compute sized types for current CPU and compiler options
dnl ---------------------------------------------------------------------------
@@ -218,6 +221,10 @@ AC_CHECK_SIZEOF(unsigned long long)
# ac_cv_sizeof_unsigned_char_p.
AC_CHECK_SIZEOF(unsigned char *)
+# Obtain the size of 'size_t' and define as SIZEOF_SIZE_T. Result is
+# available in ac_cv_sizeof_size_t
+AC_CHECK_SIZEOF([size_t])
+
AC_MSG_CHECKING(for signed 8-bit type)
INT8_T='signed char'
AC_MSG_RESULT($INT8_T)
@@ -321,11 +328,47 @@ AC_MSG_RESULT($UINT64_T)
AC_DEFINE_UNQUOTED(TIFF_UINT64_T,$UINT64_T,[Unsigned 64-bit type])
AC_DEFINE_UNQUOTED(TIFF_UINT64_FORMAT,$UINT64_FORMAT,[Unsigned 64-bit type formatter])
+# Determine formatting specifier for 'size_t'. While the size should
+# be precise, the type determined may not match the system definition.
+# A named type is provided to allow casting to the type we determined
+# without changing the actual size.
+AC_MSG_CHECKING([for 'size_t' format specifier])
+SIZE_T='unknown'
+SIZE_FORMAT='unknown'
+if test $ac_cv_sizeof_unsigned_int -eq $ac_cv_sizeof_size_t
+then
+ SIZE_T='unsigned int'
+ SIZE_FORMAT='"%u"'
+elif test $ac_cv_sizeof_unsigned_long -eq $ac_cv_sizeof_size_t
+then
+ SIZE_T='unsigned long'
+ SIZE_FORMAT='"%lu"'
+elif test $ac_cv_sizeof_unsigned_long_long -eq $ac_cv_sizeof_size_t
+then
+ SIZE_T='unsigned long long'
+ case "${host_os}" in
+ mingw32*)
+ # MinGW32 understands 'unsigned long long', but uses printf from WIN32 CRT
+ SIZE_FORMAT='"%I64u"'
+ ;;
+ *)
+ SIZE_FORMAT='"%llu"'
+ ;;
+ esac
+fi
+AC_MSG_RESULT([$SIZE_FORMAT])
+AC_DEFINE_UNQUOTED([TIFF_SIZE_T],[$SIZE_T],[Unsigned size type])
+AC_DEFINE_UNQUOTED([TIFF_SIZE_FORMAT],[$SIZE_FORMAT],[Size type formatter])
+
# Determine TIFF equivalent of ssize_t
AC_MSG_CHECKING(for signed size type)
SSIZE_T='unknown'
SSIZE_FORMAT='unknown'
-if test $ac_cv_sizeof_signed_long -eq $ac_cv_sizeof_unsigned_char_p
+if test $ac_cv_sizeof_signed_int -eq $ac_cv_sizeof_unsigned_char_p
+then
+ SSIZE_T='signed int'
+ SSIZE_FORMAT='"%d"'
+elif test $ac_cv_sizeof_signed_long -eq $ac_cv_sizeof_unsigned_char_p
then
SSIZE_T='signed long'
SSIZE_FORMAT='"%ld"'