2 dnl Copyright (C) 1997-2004 Free Software Foundation, Inc.
3 dnl This file is free software, distributed under the terms of the GNU
4 dnl General Public License. As a special exception to the GNU General
5 dnl Public License, this file may be distributed as part of a program
6 dnl that contains a configuration script generated by Autoconf, under
7 dnl the same distribution terms as the rest of that program.
13 # Define intmax_t to 'long' or 'long long'
14 # if it is not already defined in <stdint.h> or <inttypes.h>.
16 AC_DEFUN([gl_AC_TYPE_INTMAX_T],
18 dnl For simplicity, we assume that a header file defines 'intmax_t' if and
19 dnl only if it defines 'uintmax_t'.
20 AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
21 AC_REQUIRE([gl_AC_HEADER_STDINT_H])
22 if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then
23 AC_REQUIRE([gl_AC_TYPE_LONG_LONG])
24 test $ac_cv_type_long_long = yes \
25 && ac_type='long long' \
27 AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
28 [Define to long or long long if <inttypes.h> and <stdint.h> don't define.])
30 AC_DEFINE(HAVE_INTMAX_T, 1,
31 [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
35 dnl An alternative would be to explicitly test for 'intmax_t'.
37 AC_DEFUN([gt_AC_TYPE_INTMAX_T],
39 AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
40 AC_REQUIRE([gl_AC_HEADER_STDINT_H])
41 AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t,
45 #if HAVE_STDINT_H_WITH_UINTMAX
48 #if HAVE_INTTYPES_H_WITH_UINTMAX
51 ], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)])
52 if test $gt_cv_c_intmax_t = yes; then
53 AC_DEFINE(HAVE_INTMAX_T, 1,
54 [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
56 AC_REQUIRE([gl_AC_TYPE_LONG_LONG])
57 test $ac_cv_type_long_long = yes \
58 && ac_type='long long' \
60 AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
61 [Define to long or long long if <stdint.h> and <inttypes.h> don't define.])