1 # uintptr_t.m4 serial 3
3 # Copyright (C) 2004 Free Software Foundation, Inc.
4 # This file is free software; the Free Software Foundation
5 # gives unlimited permission to copy and/or distribute it,
6 # with or without modifications, as long as this notice is preserved.
8 # Written by Paul Eggert.
10 AC_DEFUN([gl_AC_TYPE_UINTPTR_T],
12 AC_CACHE_CHECK([for uintptr_t], gl_cv_c_uintptr_t,
14 for ac_type in "uintptr_t" "unsigned int" \
15 "unsigned long int" "unsigned long long int"; do
17 [AC_LANG_BOOL_COMPILE_TRY(
18 [AC_INCLUDES_DEFAULT],
19 [[sizeof (void *) <= sizeof (uintptr_t)]])],
20 [gl_cv_c_uintptr_t=$ac_type])
21 test $gl_cv_c_uintptr_t != no && break
23 case $gl_cv_c_uintptr_t in
26 AC_DEFINE_UNQUOTED(uintptr_t, $gl_cv_c_uintptr_t,
27 [Define to the type of a unsigned integer type wide enough to
28 hold a pointer, if such a type exists.])
32 dnl Check whether UINTPTR_MAX is defined, not whether it has the
33 dnl right value. Alas, Solaris 8 defines it to empty!
34 dnl Applications should use (uintptr_t) -1 rather than UINTPTR_MAX.
35 AC_CACHE_CHECK([for UINTPTR_MAX], gl_cv_c_uintptr_max,
38 [AC_INCLUDES_DEFAULT],
40 error: UINTPTR_MAX is not defined.
42 [gl_cv_c_uintptr_max=yes],
43 [gl_cv_c_uintptr_max=no])])
44 case $gl_cv_c_uintptr_max,$gl_cv_c_uintptr_t in
48 AC_DEFINE(UINTPTR_MAX, ((uintptr_t) -1),
49 [Define to its maximum value if an unsigned integer type wide enough
50 to hold a pointer exists and the standard includes do not define