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