| 1 | dnl ******** AC_COMPILE_CHECK_SIZEOF |
|---|
| 2 | dnl Available from the GNU Autoconf Macro Archive at: |
|---|
| 3 | dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_compile_check_sizeof.html |
|---|
| 4 | dnl |
|---|
| 5 | AC_DEFUN([AC_COMPILE_CHECK_SIZEOF], |
|---|
| 6 | [changequote(<<, >>)dnl |
|---|
| 7 | dnl The name to #define. |
|---|
| 8 | define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl |
|---|
| 9 | dnl The cache variable name. |
|---|
| 10 | define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl |
|---|
| 11 | changequote([, ])dnl |
|---|
| 12 | AC_MSG_CHECKING(size of $1) |
|---|
| 13 | AC_CACHE_VAL(AC_CV_NAME, |
|---|
| 14 | [for ac_size in 4 8 1 2 16 $2 ; do # List sizes in rough order of prevalence. |
|---|
| 15 | AC_TRY_COMPILE([#include "confdefs.h" |
|---|
| 16 | #include <sys/types.h> |
|---|
| 17 | $2 |
|---|
| 18 | ], [switch (0) case 0: case (sizeof ($1) == $ac_size):;], AC_CV_NAME=$ac_size) |
|---|
| 19 | if test x$AC_CV_NAME != x ; then break; fi |
|---|
| 20 | done |
|---|
| 21 | ]) |
|---|
| 22 | if test x$AC_CV_NAME = x ; then |
|---|
| 23 | AC_MSG_ERROR([cannot determine a size for $1]) |
|---|
| 24 | fi |
|---|
| 25 | AC_MSG_RESULT($AC_CV_NAME) |
|---|
| 26 | AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1]) |
|---|
| 27 | undefine([AC_TYPE_NAME])dnl |
|---|
| 28 | undefine([AC_CV_NAME])dnl |
|---|
| 29 | ]) |
|---|
| 30 | |
|---|
| 31 | dnl ******** AC_CREATE_STDINT_H |
|---|
| 32 | dnl Available from the GNU Autoconf Macro Archive at: |
|---|
| 33 | dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_create_stdint_h.html |
|---|
| 34 | dnl |
|---|
| 35 | AC_DEFUN([AC_CREATE_STDINT_H], |
|---|
| 36 | [# ------ AC CREATE STDINT H ------------------------------------- |
|---|
| 37 | AC_MSG_CHECKING([for stdint-types....]) |
|---|
| 38 | ac_stdint_h=`echo ifelse($1, , _stdint.h, $1)` |
|---|
| 39 | if test "$ac_stdint_h" = "stdint.h" ; then |
|---|
| 40 | AC_MSG_RESULT("(are you sure you want them in ./stdint.h?)") |
|---|
| 41 | elif test "$ac_stdint_h" = "inttypes.h" ; then |
|---|
| 42 | AC_MSG_RESULT("(are you sure you want them in ./inttypes.h?)") |
|---|
| 43 | else |
|---|
| 44 | AC_MSG_RESULT("(putting them into $ac_stdint_h)") |
|---|
| 45 | fi |
|---|
| 46 | |
|---|
| 47 | inttype_headers=`echo inttypes.h sys/inttypes.h sys/inttypes.h $2 \ |
|---|
| 48 | | sed -e 's/,/ /g'` |
|---|
| 49 | |
|---|
| 50 | ac_cv_header_stdint_x="no-file" |
|---|
| 51 | ac_cv_header_stdint_o="no-file" |
|---|
| 52 | ac_cv_header_stdint_u="no-file" |
|---|
| 53 | for i in stdint.h $inttype_headers ; do |
|---|
| 54 | unset ac_cv_type_uintptr_t |
|---|
| 55 | unset ac_cv_type_uint64_t |
|---|
| 56 | _AC_CHECK_TYPE_NEW(uintptr_t,[ac_cv_header_stdint_x=$i],dnl |
|---|
| 57 | continue,[#include <$i>]) |
|---|
| 58 | AC_CHECK_TYPE(uint64_t,[and64="(uint64_t too)"],[and64=""],[#include<$i>]) |
|---|
| 59 | AC_MSG_RESULT(... seen our uintptr_t in $i $and64) |
|---|
| 60 | break; |
|---|
| 61 | done |
|---|
| 62 | if test "$ac_cv_header_stdint_x" = "no-file" ; then |
|---|
| 63 | for i in stdint.h $inttype_headers ; do |
|---|
| 64 | unset ac_cv_type_uint32_t |
|---|
| 65 | unset ac_cv_type_uint64_t |
|---|
| 66 | AC_CHECK_TYPE(uint32_t,[ac_cv_header_stdint_o=$i],dnl |
|---|
| 67 | continue,[#include <$i>]) |
|---|
| 68 | AC_CHECK_TYPE(uint64_t,[and64="(uint64_t too)"],[and64=""],[#include<$i>]) |
|---|
| 69 | AC_MSG_RESULT(... seen our uint32_t in $i $and64) |
|---|
| 70 | break; |
|---|
| 71 | done |
|---|
| 72 | if test "$ac_cv_header_stdint_o" = "no-file" ; then |
|---|
| 73 | for i in sys/types.h $inttype_headers ; do |
|---|
| 74 | unset ac_cv_type_u_int32_t |
|---|
| 75 | unset ac_cv_type_u_int64_t |
|---|
| 76 | AC_CHECK_TYPE(u_int32_t,[ac_cv_header_stdint_u=$i],dnl |
|---|
| 77 | continue,[#include <$i>]) |
|---|
| 78 | AC_CHECK_TYPE(uint64_t,[and64="(u_int64_t too)"],[and64=""],[#include<$i>]) |
|---|
| 79 | AC_MSG_RESULT(... seen our u_int32_t in $i $and64) |
|---|
| 80 | break; |
|---|
| 81 | done |
|---|
| 82 | fi |
|---|
| 83 | fi |
|---|
| 84 | |
|---|
| 85 | # ----------------- DONE inttypes.h checks MAYBE C basic types -------- |
|---|
| 86 | |
|---|
| 87 | if test "$ac_cv_header_stdint_x" = "no-file" ; then |
|---|
| 88 | AC_COMPILE_CHECK_SIZEOF(char) |
|---|
| 89 | AC_COMPILE_CHECK_SIZEOF(short) |
|---|
| 90 | AC_COMPILE_CHECK_SIZEOF(int) |
|---|
| 91 | AC_COMPILE_CHECK_SIZEOF(long) |
|---|
| 92 | AC_COMPILE_CHECK_SIZEOF(void*) |
|---|
| 93 | ac_cv_header_stdint_test="yes" |
|---|
| 94 | else |
|---|
| 95 | ac_cv_header_stdint_test="no" |
|---|
| 96 | fi |
|---|
| 97 | |
|---|
| 98 | # ----------------- DONE inttypes.h checks START header ------------- |
|---|
| 99 | _ac_stdint_h=AS_TR_CPP(_$ac_stdint_h) |
|---|
| 100 | AC_MSG_RESULT(creating $ac_stdint_h : $_ac_stdint_h) |
|---|
| 101 | echo "#ifndef" $_ac_stdint_h >$ac_stdint_h |
|---|
| 102 | echo "#define" $_ac_stdint_h "1" >>$ac_stdint_h |
|---|
| 103 | echo "#ifndef" _GENERATED_STDINT_H >>$ac_stdint_h |
|---|
| 104 | echo "#define" _GENERATED_STDINT_H '"'$PACKAGE $VERSION'"' >>$ac_stdint_h |
|---|
| 105 | if test "$GCC" = "yes" ; then |
|---|
| 106 | echo "/* generated using a gnu compiler version" `$CC --version` "*/" \ |
|---|
| 107 | >>$ac_stdint_h |
|---|
| 108 | else |
|---|
| 109 | echo "/* generated using $CC */" >>$ac_stdint_h |
|---|
| 110 | fi |
|---|
| 111 | echo "" >>$ac_stdint_h |
|---|
| 112 | |
|---|
| 113 | if test "$ac_cv_header_stdint_x" != "no-file" ; then |
|---|
| 114 | ac_cv_header_stdint="$ac_cv_header_stdint_x" |
|---|
| 115 | elif test "$ac_cv_header_stdint_o" != "no-file" ; then |
|---|
| 116 | ac_cv_header_stdint="$ac_cv_header_stdint_o" |
|---|
| 117 | elif test "$ac_cv_header_stdint_u" != "no-file" ; then |
|---|
| 118 | ac_cv_header_stdint="$ac_cv_header_stdint_u" |
|---|
| 119 | else |
|---|
| 120 | ac_cv_header_stdint="stddef.h" |
|---|
| 121 | fi |
|---|
| 122 | |
|---|
| 123 | # ----------------- See if int_least and int_fast types are present |
|---|
| 124 | unset ac_cv_type_int_least32_t |
|---|
| 125 | unset ac_cv_type_int_fast32_t |
|---|
| 126 | AC_CHECK_TYPE(int_least32_t,,,[#include <$ac_cv_header_stdint>]) |
|---|
| 127 | AC_CHECK_TYPE(int_fast32_t,,,[#include<$ac_cv_header_stdint>]) |
|---|
| 128 | |
|---|
| 129 | if test "$ac_cv_header_stdint" != "stddef.h" ; then |
|---|
| 130 | if test "$ac_cv_header_stdint" != "stdint.h" ; then |
|---|
| 131 | AC_MSG_RESULT(..adding include stddef.h) |
|---|
| 132 | echo "#include <stddef.h>" >>$ac_stdint_h |
|---|
| 133 | fi ; fi |
|---|
| 134 | AC_MSG_RESULT(..adding include $ac_cv_header_stdint) |
|---|
| 135 | echo "#include <$ac_cv_header_stdint>" >>$ac_stdint_h |
|---|
| 136 | echo "" >>$ac_stdint_h |
|---|
| 137 | |
|---|
| 138 | # ----------------- DONE header START basic int types ------------- |
|---|
| 139 | if test "$ac_cv_header_stdint_x" = "no-file" ; then |
|---|
| 140 | AC_MSG_RESULT(... need to look at C basic types) |
|---|
| 141 | dnl ac_cv_header_stdint_test="yes" # moved up before creating the file |
|---|
| 142 | else |
|---|
| 143 | AC_MSG_RESULT(... seen good stdint.h inttypes) |
|---|
| 144 | dnl ac_cv_header_stdint_test="no" # moved up before creating the file |
|---|
| 145 | fi |
|---|
| 146 | |
|---|
| 147 | if test "$ac_cv_header_stdint_u" != "no-file" ; then |
|---|
| 148 | AC_MSG_RESULT(... seen bsd/sysv typedefs) |
|---|
| 149 | cat >>$ac_stdint_h <<EOF |
|---|
| 150 | |
|---|
| 151 | /* int8_t int16_t int32_t defined by inet code, redeclare the u_intXX types */ |
|---|
| 152 | typedef u_int8_t uint8_t; |
|---|
| 153 | typedef u_int16_t uint16_t; |
|---|
| 154 | typedef u_int32_t uint32_t; |
|---|
| 155 | EOF |
|---|
| 156 | cat >>$ac_stdint_h <<EOF |
|---|
| 157 | |
|---|
| 158 | /* glibc compatibility */ |
|---|
| 159 | #ifndef __int8_t_defined |
|---|
| 160 | #define __int8_t_defined |
|---|
| 161 | #endif |
|---|
| 162 | EOF |
|---|
| 163 | fi |
|---|
| 164 | |
|---|
| 165 | ac_cv_sizeof_x="$ac_cv_sizeof_char:$ac_cv_sizeof_short" |
|---|
| 166 | ac_cv_sizeof_X="$ac_cv_sizeof_x:$ac_cv_sizeof_int" |
|---|
| 167 | ac_cv_sizeof_X="$ac_cv_sizeof_X:$ac_cv_sizeof_voidp:$ac_cv_sizeof_long" |
|---|
| 168 | if test "$ac_cv_header_stdint" = "stddef.h" ; then |
|---|
| 169 | # we must guess all the basic types. Apart from byte-adressable system, |
|---|
| 170 | # there a few 32-bit-only dsp-systems. nibble-addressable systems are way off. |
|---|
| 171 | cat >>$ac_stdint_h <<EOF |
|---|
| 172 | /* ------------ BITSPECIFIC INTTYPES SECTION --------------- */ |
|---|
| 173 | EOF |
|---|
| 174 | t="typedefs for a" |
|---|
| 175 | case "$ac_cv_sizeof_X" in |
|---|
| 176 | 1:2:2:2:4) AC_MSG_RESULT(..adding $t normal 16-bit system) |
|---|
| 177 | cat >>$ac_stdint_h <<EOF |
|---|
| 178 | /* a normal 16-bit system */ |
|---|
| 179 | typedef unsigned char uint8_t; |
|---|
| 180 | typedef unsigned short uint16_t; |
|---|
| 181 | typedef unsigned long uint32_t; |
|---|
| 182 | #ifndef __int8_t_defined |
|---|
| 183 | #define __int8_t_defined |
|---|
| 184 | typedef char int8_t; |
|---|
| 185 | typedef short int16_t; |
|---|
| 186 | typedef long int32_t; |
|---|
| 187 | #endif |
|---|
| 188 | EOF |
|---|
| 189 | ;; |
|---|
| 190 | 1:2:2:4:4) AC_MSG_RESULT(..adding $t 32-bit system derived from a 16-bit) |
|---|
| 191 | cat >>$ac_stdint_h <<EOF |
|---|
| 192 | /* a 32-bit system derived from a 16-bit */ |
|---|
| 193 | typedef unsigned char uint8_t; |
|---|
| 194 | typedef unsigned short uint16_t; |
|---|
| 195 | typedef unsigned int uint32_t; |
|---|
| 196 | #ifndef __int8_t_defined |
|---|
| 197 | #define __int8_t_defined |
|---|
| 198 | typedef char int8_t; |
|---|
| 199 | typedef short int16_t; |
|---|
| 200 | typedef int int32_t; |
|---|
| 201 | #endif |
|---|
| 202 | EOF |
|---|
| 203 | ;; |
|---|
| 204 | 1:2:4:4:4) AC_MSG_RESULT(..adding $t normal 32-bit system) |
|---|
| 205 | cat >>$ac_stdint_h <<EOF |
|---|
| 206 | /* a normal 32-bit system */ |
|---|
| 207 | typedef unsigned char uint8_t; |
|---|
| 208 | typedef unsigned short uint16_t; |
|---|
| 209 | typedef unsigned int uint32_t; |
|---|
| 210 | #ifndef __int8_t_defined |
|---|
| 211 | #define __int8_t_defined |
|---|
| 212 | typedef char int8_t; |
|---|
| 213 | typedef short int16_t; |
|---|
| 214 | typedef int int32_t; |
|---|
| 215 | #endif |
|---|
| 216 | EOF |
|---|
| 217 | ;; |
|---|
| 218 | 1:2:4:4:8) AC_MSG_RESULT(..adding $t 32-bit system prepared for 64-bit) |
|---|
| 219 | cat >>$ac_stdint_h <<EOF |
|---|
| 220 | |
|---|
| 221 | /* a 32-bit system prepared for 64-bit */ |
|---|
| 222 | typedef unsigned char uint8_t; |
|---|
| 223 | typedef unsigned short uint16_t; |
|---|
| 224 | typedef unsigned int uint32_t; |
|---|
| 225 | #ifndef __int8_t_defined |
|---|
| 226 | #define __int8_t_defined |
|---|
| 227 | typedef char int8_t; |
|---|
| 228 | typedef short int16_t; |
|---|
| 229 | typedef int int32_t; |
|---|
| 230 | #endif |
|---|
| 231 | EOF |
|---|
| 232 | ;; |
|---|
| 233 | 1:2:4:8:8) AC_MSG_RESULT(..adding $t normal 64-bit system) |
|---|
| 234 | cat >>$ac_stdint_h <<EOF |
|---|
| 235 | |
|---|
| 236 | /* a normal 64-bit system */ |
|---|
| 237 | typedef unsigned char uint8_t; |
|---|
| 238 | typedef unsigned short uint16_t; |
|---|
| 239 | typedef unsigned int uint32_t; |
|---|
| 240 | #ifndef __int8_t_defined |
|---|
| 241 | #define __int8_t_defined |
|---|
| 242 | typedef char int8_t; |
|---|
| 243 | typedef short int16_t; |
|---|
| 244 | typedef int int32_t; |
|---|
| 245 | #endif |
|---|
| 246 | EOF |
|---|
| 247 | ;; |
|---|
| 248 | 1:2:4:8:4) AC_MSG_RESULT(..adding $t 64-bit system derived from a 32-bit) |
|---|
| 249 | cat >>$ac_stdint_h <<EOF |
|---|
| 250 | |
|---|
| 251 | /* a 64-bit system derived from a 32-bit system */ |
|---|
| 252 | typedef unsigned char uint8_t; |
|---|
| 253 | typedef unsigned short uint16_t; |
|---|
| 254 | typedef unsigned int uint32_t; |
|---|
| 255 | #ifndef __int8_t_defined |
|---|
| 256 | #define __int8_t_defined |
|---|
| 257 | typedef char int8_t; |
|---|
| 258 | typedef short int16_t; |
|---|
| 259 | typedef int int32_t; |
|---|
| 260 | #endif |
|---|
| 261 | EOF |
|---|
| 262 | ;; |
|---|
| 263 | *) |
|---|
| 264 | AC_MSG_ERROR([ $ac_cv_sizeof_X dnl |
|---|
| 265 | what is that a system? contact the author, quick! http://ac-archive.sf.net]) |
|---|
| 266 | exit 1 |
|---|
| 267 | ;; |
|---|
| 268 | esac |
|---|
| 269 | fi |
|---|
| 270 | |
|---|
| 271 | # ------------- DONE basic int types START int64_t types ------------ |
|---|
| 272 | if test "$ac_cv_type_uint64_t" = "yes" |
|---|
| 273 | then AC_MSG_RESULT(... seen good uint64_t) |
|---|
| 274 | cat >>$ac_stdint_h <<EOF |
|---|
| 275 | |
|---|
| 276 | /* system headers have good uint64_t */ |
|---|
| 277 | #ifndef _HAVE_UINT64_T |
|---|
| 278 | #define _HAVE_UINT64_T |
|---|
| 279 | #endif |
|---|
| 280 | EOF |
|---|
| 281 | |
|---|
| 282 | elif test "$ac_cv_type_u_int64_t" = "yes" |
|---|
| 283 | then AC_MSG_RESULT(..adding typedef u_int64_t uint64_t) |
|---|
| 284 | cat >>$ac_stdint_h <<EOF |
|---|
| 285 | |
|---|
| 286 | /* system headers have an u_int64_t */ |
|---|
| 287 | #ifndef _HAVE_UINT64_T |
|---|
| 288 | #define _HAVE_UINT64_T |
|---|
| 289 | typedef u_int64_t uint64_t; |
|---|
| 290 | #endif |
|---|
| 291 | EOF |
|---|
| 292 | else AC_MSG_RESULT(..adding generic uint64_t runtime checks) |
|---|
| 293 | cat >>$ac_stdint_h <<EOF |
|---|
| 294 | |
|---|
| 295 | /* -------------------- 64 BIT GENERIC SECTION -------------------- */ |
|---|
| 296 | /* here are some common heuristics using compiler runtime specifics */ |
|---|
| 297 | #if defined __STDC_VERSION__ && defined __STDC_VERSION__ > 199901L |
|---|
| 298 | |
|---|
| 299 | #ifndef _HAVE_UINT64_T |
|---|
| 300 | #define _HAVE_UINT64_T |
|---|
| 301 | typedef long long int64_t; |
|---|
| 302 | typedef unsigned long long uint64_t; |
|---|
| 303 | #endif |
|---|
| 304 | |
|---|
| 305 | #elif !defined __STRICT_ANSI__ |
|---|
| 306 | #if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__ |
|---|
| 307 | |
|---|
| 308 | #ifndef _HAVE_UINT64_T |
|---|
| 309 | #define _HAVE_UINT64_T |
|---|
| 310 | typedef __int64 int64_t; |
|---|
| 311 | typedef unsigned __int64 uint64_t; |
|---|
| 312 | #endif |
|---|
| 313 | |
|---|
| 314 | #elif defined __GNUC__ || defined __MWERKS__ || defined __ELF__ |
|---|
| 315 | dnl /* note: all ELF-systems seem to have loff-support which needs 64-bit */ |
|---|
| 316 | |
|---|
| 317 | #if !defined _NO_LONGLONG |
|---|
| 318 | #ifndef _HAVE_UINT64_T |
|---|
| 319 | #define _HAVE_UINT64_T |
|---|
| 320 | typedef long long int64_t; |
|---|
| 321 | typedef unsigned long long uint64_t; |
|---|
| 322 | #endif |
|---|
| 323 | #endif |
|---|
| 324 | |
|---|
| 325 | #elif defined __alpha || (defined __mips && defined _ABIN32) |
|---|
| 326 | |
|---|
| 327 | #if !defined _NO_LONGLONG |
|---|
| 328 | #ifndef _HAVE_UINT64_T |
|---|
| 329 | #define _HAVE_UINT64_T |
|---|
| 330 | typedef long int64_t; |
|---|
| 331 | typedef unsigned long uint64_t; |
|---|
| 332 | #endif |
|---|
| 333 | #endif |
|---|
| 334 | /* compiler/cpu type ... or just ISO C99 */ |
|---|
| 335 | #endif |
|---|
| 336 | #endif |
|---|
| 337 | EOF |
|---|
| 338 | |
|---|
| 339 | # plus a default 64-bit for systems that are likely to be 64-bit ready |
|---|
| 340 | case "$ac_cv_sizeof_x:$ac_cv_sizeof_voidp:$ac_cv_sizeof_long" in |
|---|
| 341 | 1:2:8:8) AC_MSG_RESULT(..adding uint64_t default, normal 64-bit system) |
|---|
| 342 | cat >>$ac_stdint_h <<EOF |
|---|
| 343 | /* DEFAULT: */ |
|---|
| 344 | /* seen normal 64-bit system, CC has sizeof(long and void*) == 8 bytes */ |
|---|
| 345 | #ifndef _HAVE_UINT64_T |
|---|
| 346 | #define _HAVE_UINT64_T |
|---|
| 347 | typedef long int64_t; |
|---|
| 348 | typedef unsigned long uint64_t; |
|---|
| 349 | #endif |
|---|
| 350 | EOF |
|---|
| 351 | ;; |
|---|
| 352 | 1:2:4:8) AC_MSG_RESULT(..adding uint64_t default, typedef to long) |
|---|
| 353 | cat >>$ac_stdint_h <<EOF |
|---|
| 354 | /* DEFAULT: */ |
|---|
| 355 | /* seen 32-bit system prepared for 64-bit, CC has sizeof(long) == 8 bytes */ |
|---|
| 356 | #ifndef _HAVE_UINT64_T |
|---|
| 357 | #define _HAVE_UINT64_T |
|---|
| 358 | typedef long int64_t; |
|---|
| 359 | typedef unsigned long uint64_t; |
|---|
| 360 | #endif |
|---|
| 361 | EOF |
|---|
| 362 | ;; |
|---|
| 363 | 1:2:8:4) AC_MSG_RESULT(..adding uint64_t default, typedef long long) |
|---|
| 364 | cat >>$ac_stdint_h <<EOF |
|---|
| 365 | /* DEFAULT: */ |
|---|
| 366 | /* seen 64-bit derived from a 32-bit, CC has sizeof(long) == 4 bytes */ |
|---|
| 367 | #ifndef _HAVE_UINT64_T |
|---|
| 368 | #define _HAVE_UINT64_T |
|---|
| 369 | typedef long long int64_t; |
|---|
| 370 | typedef unsigned long long uint64_t; |
|---|
| 371 | #endif |
|---|
| 372 | EOF |
|---|
| 373 | ;; |
|---|
| 374 | *) |
|---|
| 375 | cat >>$ac_stdint_h <<EOF |
|---|
| 376 | /* NOTE: */ |
|---|
| 377 | /* the configure-checks for the basic types did not make us believe */ |
|---|
| 378 | /* that we could add a fallback to a 'long long' typedef to int64_t */ |
|---|
| 379 | EOF |
|---|
| 380 | esac |
|---|
| 381 | fi |
|---|
| 382 | |
|---|
| 383 | # ------------- DONE int64_t types START intptr types ------------ |
|---|
| 384 | if test "$ac_cv_header_stdint_x" = "no-file" ; then |
|---|
| 385 | cat >>$ac_stdint_h <<EOF |
|---|
| 386 | |
|---|
| 387 | /* -------------------------- INPTR SECTION --------------------------- */ |
|---|
| 388 | EOF |
|---|
| 389 | case "$ac_cv_sizeof_x:$ac_cv_sizeof_voidp" in |
|---|
| 390 | 1:2:2) |
|---|
| 391 | a="int16_t" ; cat >>$ac_stdint_h <<EOF |
|---|
| 392 | /* we tested sizeof(void*) to be of 2 chars, hence we declare it 16-bit */ |
|---|
| 393 | |
|---|
| 394 | typedef uint16_t uintptr_t; |
|---|
| 395 | typedef int16_t intptr_t; |
|---|
| 396 | EOF |
|---|
| 397 | ;; |
|---|
| 398 | 1:2:4) |
|---|
| 399 | a="int32_t" ; cat >>$ac_stdint_h <<EOF |
|---|
| 400 | /* we tested sizeof(void*) to be of 4 chars, hence we declare it 32-bit */ |
|---|
| 401 | |
|---|
| 402 | typedef uint32_t uintptr_t; |
|---|
| 403 | typedef int32_t intptr_t; |
|---|
| 404 | EOF |
|---|
| 405 | ;; |
|---|
| 406 | 1:2:8) |
|---|
| 407 | a="int64_t" ; cat >>$ac_stdint_h <<EOF |
|---|
| 408 | /* we tested sizeof(void*) to be of 8 chars, hence we declare it 64-bit */ |
|---|
| 409 | |
|---|
| 410 | typedef uint64_t uintptr_t; |
|---|
| 411 | typedef int64_t intptr_t; |
|---|
| 412 | EOF |
|---|
| 413 | ;; |
|---|
| 414 | *) |
|---|
| 415 | a="long" ; cat >>$ac_stdint_h <<EOF |
|---|
| 416 | /* we tested sizeof(void*) but got no guess, hence we declare it as if long */ |
|---|
| 417 | |
|---|
| 418 | typedef unsigned long uintptr_t; |
|---|
| 419 | typedef long intptr_t; |
|---|
| 420 | EOF |
|---|
| 421 | ;; |
|---|
| 422 | esac |
|---|
| 423 | AC_MSG_RESULT(..adding typedef $a intptr_t) |
|---|
| 424 | fi |
|---|
| 425 | |
|---|
| 426 | # ------------- DONE intptr types START int_least types ------------ |
|---|
| 427 | if test "$ac_cv_type_int_least32_t" = "no"; then |
|---|
| 428 | AC_MSG_RESULT(..adding generic int_least-types) |
|---|
| 429 | cat >>$ac_stdint_h <<EOF |
|---|
| 430 | |
|---|
| 431 | /* --------------GENERIC INT_LEAST ------------------ */ |
|---|
| 432 | |
|---|
| 433 | typedef int8_t int_least8_t; |
|---|
| 434 | typedef int16_t int_least16_t; |
|---|
| 435 | typedef int32_t int_least32_t; |
|---|
| 436 | #ifdef _HAVE_UINT64_T |
|---|
| 437 | typedef int64_t int_least64_t; |
|---|
| 438 | #endif |
|---|
| 439 | |
|---|
| 440 | typedef uint8_t uint_least8_t; |
|---|
| 441 | typedef uint16_t uint_least16_t; |
|---|
| 442 | typedef uint32_t uint_least32_t; |
|---|
| 443 | #ifdef _HAVE_UINT64_T |
|---|
| 444 | typedef uint64_t uint_least64_t; |
|---|
| 445 | #endif |
|---|
| 446 | EOF |
|---|
| 447 | fi |
|---|
| 448 | |
|---|
| 449 | # ------------- DONE intptr types START int_least types ------------ |
|---|
| 450 | if test "$ac_cv_type_int_fast32_t" = "no"; then |
|---|
| 451 | AC_MSG_RESULT(..adding generic int_fast-types) |
|---|
| 452 | cat >>$ac_stdint_h <<EOF |
|---|
| 453 | |
|---|
| 454 | /* --------------GENERIC INT_FAST ------------------ */ |
|---|
| 455 | |
|---|
| 456 | typedef int8_t int_fast8_t; |
|---|
| 457 | typedef int32_t int_fast16_t; |
|---|
| 458 | typedef int32_t int_fast32_t; |
|---|
| 459 | #ifdef _HAVE_UINT64_T |
|---|
| 460 | typedef int64_t int_fast64_t; |
|---|
| 461 | #endif |
|---|
| 462 | |
|---|
| 463 | typedef uint8_t uint_fast8_t; |
|---|
| 464 | typedef uint32_t uint_fast16_t; |
|---|
| 465 | typedef uint32_t uint_fast32_t; |
|---|
| 466 | #ifdef _HAVE_UINT64_T |
|---|
| 467 | typedef uint64_t uint_fast64_t; |
|---|
| 468 | #endif |
|---|
| 469 | EOF |
|---|
| 470 | fi |
|---|
| 471 | |
|---|
| 472 | if test "$ac_cv_header_stdint_x" = "no-file" ; then |
|---|
| 473 | cat >>$ac_stdint_h <<EOF |
|---|
| 474 | |
|---|
| 475 | #ifdef _HAVE_UINT64_T |
|---|
| 476 | typedef int64_t intmax_t; |
|---|
| 477 | typedef uint64_t uintmax_t; |
|---|
| 478 | #else |
|---|
| 479 | typedef long int intmax_t; |
|---|
| 480 | typedef unsigned long uintmax_t; |
|---|
| 481 | #endif |
|---|
| 482 | EOF |
|---|
| 483 | fi |
|---|
| 484 | |
|---|
| 485 | AC_MSG_RESULT(... DONE $ac_stdint_h) |
|---|
| 486 | cat >>$ac_stdint_h <<EOF |
|---|
| 487 | |
|---|
| 488 | /* once */ |
|---|
| 489 | #endif |
|---|
| 490 | #endif |
|---|
| 491 | EOF |
|---|
| 492 | ]) |
|---|
| 493 | |
|---|
| 494 | dnl quote from SunOS-5.8 sys/inttypes.h: |
|---|
| 495 | dnl Use at your own risk. As of February 1996, the committee is squarely |
|---|
| 496 | dnl behind the fixed sized types; the "least" and "fast" types are still being |
|---|
| 497 | dnl discussed. The probability that the "fast" types may be removed before |
|---|
| 498 | dnl the standard is finalized is high enough that they are not currently |
|---|
| 499 | dnl implemented. |
|---|