1 # uintptr_t.m4 serial 2
3 # Copyright (C) 2004 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation,
17 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 # Written by Paul Eggert.
21 AC_DEFUN([gl_AC_TYPE_UINTPTR_T],
23 AC_CACHE_CHECK([for uintptr_t], gl_cv_c_uintptr_t,
25 for ac_type in "uintptr_t" "unsigned int" \
26 "unsigned long int" "unsigned long long int"; do
28 [AC_LANG_BOOL_COMPILE_TRY(
29 [AC_INCLUDES_DEFAULT],
30 [[sizeof (void *) <= sizeof (uintptr_t)]])],
31 [gl_cv_c_uintptr_t=$ac_type])
32 test $gl_cv_c_uintptr_t != no && break
34 case $gl_cv_c_uintptr_t in
37 AC_DEFINE_UNQUOTED(uintptr_t, $gl_cv_c_uintptr_t,
38 [Define to the type of a unsigned integer type wide enough to
39 hold a pointer, if such a type exists.])
43 dnl Check whether UINTPTR_MAX is defined, not whether it has the
44 dnl right value. Alas, Solaris 8 defines it to empty!
45 dnl Applications should use (uintptr_t) -1 rather than UINTPTR_MAX.
46 AC_CACHE_CHECK([for UINTPTR_MAX], gl_cv_c_uintptr_max,
49 [AC_INCLUDES_DEFAULT],
51 error: UINTPTR_MAX is not defined.
53 [gl_cv_c_uintptr_max=yes],
54 [gl_cv_c_uintptr_max=no])])
55 case $gl_cv_c_uintptr_max,$gl_cv_c_uintptr_t in
59 AC_DEFINE(UINTPTR_MAX, ((uintptr_t) -1),
60 [Define to its maximum value if an unsigned integer type wide enough
61 to hold a pointer exists and the standard includes do not define