1# uint32_t.m4 serial 4
2
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.
7
8# Written by Paul Eggert.
9
10AC_DEFUN([gl_AC_TYPE_UINT32_T],
11[
12  AC_CACHE_CHECK([for uint32_t], gl_cv_c_uint32_t,
13    [gl_cv_c_uint32_t=no
14     for ac_type in "uint32_t" "unsigned int" \
15	 "unsigned long int" "unsigned short int"; do
16       AC_COMPILE_IFELSE(
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
22     done])
23  case "$gl_cv_c_uint32_t" in
24  no|uint32_t) ;;
25  *)
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.])
33    ;;
34  esac
35
36  AC_CACHE_CHECK([for UINT32_MAX], gl_cv_c_uint32_max,
37    [AC_COMPILE_IFELSE(
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
44  yes,*) ;;
45  *,no) ;;
46  *)
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
50       UINT32_MAX.])
51    ;;
52  esac
53])
54