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_UINT32_T],
12 AC_CACHE_CHECK([for uint32_t], gl_cv_c_uint32_t,
14 for ac_type in "uint32_t" "unsigned int" \
15 "unsigned long int" "unsigned short int"; do
17 [AC_LANG_BOOL_COMPILE_TRY(
18 [AC_INCLUDES_DEFAULT],
19 [[($ac_type) -1 == 4294967295U]])],
20 [gl_cv_c_uint32_t=$ac_type])
21 test "$gl_cv_c_uint32_t" != no && break
23 case "$gl_cv_c_uint32_t" in
26 AC_DEFINE(_UINT32_T, 1,
27 [Define for Solaris 2.5.1 so uint32_t typedef from <sys/synch.h>,
28 <pthread.h>, or <semaphore.h> is not used. If the typedef was
29 allowed, the #define below would cause a syntax error.])
30 AC_DEFINE_UNQUOTED(uint32_t, $gl_cv_c_uint32_t,
31 [Define to the type of a unsigned integer type of width exactly 32 bits
32 if such a type exists and the standard includes do not define it.])
36 AC_CACHE_CHECK([for UINT32_MAX], gl_cv_c_uint32_max,
38 [AC_LANG_BOOL_COMPILE_TRY(
39 [AC_INCLUDES_DEFAULT],
40 [[UINT32_MAX == 4294967295U]])],
41 [gl_cv_c_uint32_max=yes],
42 [gl_cv_c_uint32_max=no])])
43 case $gl_cv_c_uint32_max,$gl_cv_c_uint32_t in
47 AC_DEFINE(UINT32_MAX, 4294967295U,
48 [Define to its maximum value if an unsigned integer type of width
49 exactly 32 bits exists and the standard includes do not define