1# =========================================================================== 2# http://www.gnu.org/software/autoconf-archive/ax_create_stdint_h.html 3# =========================================================================== 4# 5# SYNOPSIS 6# 7# AX_CREATE_STDINT_H [( HEADER-TO-GENERATE [, HEDERS-TO-CHECK])] 8# 9# DESCRIPTION 10# 11# the "ISO C9X: 7.18 Integer types <stdint.h>" section requires the 12# existence of an include file <stdint.h> that defines a set of typedefs, 13# especially uint8_t,int32_t,uintptr_t. Many older installations will not 14# provide this file, but some will have the very same definitions in 15# <inttypes.h>. In other enviroments we can use the inet-types in 16# <sys/types.h> which would define the typedefs int8_t and u_int8_t 17# respectivly. 18# 19# This macros will create a local "_stdint.h" or the headerfile given as 20# an argument. In many cases that file will just "#include <stdint.h>" or 21# "#include <inttypes.h>", while in other environments it will provide the 22# set of basic 'stdint's definitions/typedefs: 23# 24# int8_t,uint8_t,int16_t,uint16_t,int32_t,uint32_t,intptr_t,uintptr_t 25# int_least32_t.. int_fast32_t.. intmax_t 26# 27# which may or may not rely on the definitions of other files, or using 28# the AC_CHECK_SIZEOF macro to determine the actual sizeof each type. 29# 30# if your header files require the stdint-types you will want to create an 31# installable file mylib-int.h that all your other installable header may 32# include. So if you have a library package named "mylib", just use 33# 34# AX_CREATE_STDINT_H(mylib-int.h) 35# 36# in configure.ac and go to install that very header file in Makefile.am 37# along with the other headers (mylib.h) - and the mylib-specific headers 38# can simply use "#include <mylib-int.h>" to obtain the stdint-types. 39# 40# Remember, if the system already had a valid <stdint.h>, the generated 41# file will include it directly. No need for fuzzy HAVE_STDINT_H things... 42# (oops, GCC 4.2.x has deliberatly disabled its stdint.h for non-c99 43# compilation and the c99-mode is not the default. Therefore this macro 44# will not use the compiler's stdint.h - please complain to the GCC 45# developers). 46# 47# LICENSE 48# 49# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> 50# 51# This program is free software; you can redistribute it and/or modify it 52# under the terms of the GNU General Public License as published by the 53# Free Software Foundation; either version 3 of the License, or (at your 54# option) any later version. 55# 56# This program is distributed in the hope that it will be useful, but 57# WITHOUT ANY WARRANTY; without even the implied warranty of 58# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 59# Public License for more details. 60# 61# You should have received a copy of the GNU General Public License along 62# with this program. If not, see <http://www.gnu.org/licenses/>. 63# 64# As a special exception, the respective Autoconf Macro's copyright owner 65# gives unlimited permission to copy, distribute and modify the configure 66# scripts that are the output of Autoconf when processing the Macro. You 67# need not follow the terms of the GNU General Public License when using 68# or distributing such scripts, even though portions of the text of the 69# Macro appear in them. The GNU General Public License (GPL) does govern 70# all other use of the material that constitutes the Autoconf Macro. 71# 72# This special exception to the GPL applies to versions of the Autoconf 73# Macro released by the Autoconf Archive. When you make and distribute a 74# modified version of the Autoconf Macro, you may extend this special 75# exception to the GPL to apply to your modified version as well. 76 77#serial 10 78 79AC_DEFUN([AX_CHECK_DATA_MODEL],[ 80 AC_CHECK_SIZEOF(char) 81 AC_CHECK_SIZEOF(short) 82 AC_CHECK_SIZEOF(int) 83 AC_CHECK_SIZEOF(long) 84 AC_CHECK_SIZEOF(void*) 85 ac_cv_char_data_model="" 86 ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_char" 87 ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_short" 88 ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_int" 89 ac_cv_long_data_model="" 90 ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_int" 91 ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_long" 92 ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_voidp" 93 AC_MSG_CHECKING([data model]) 94 case "$ac_cv_char_data_model/$ac_cv_long_data_model" in 95 122/242) ac_cv_data_model="IP16" ; n="standard 16bit machine" ;; 96 122/244) ac_cv_data_model="LP32" ; n="standard 32bit machine" ;; 97 122/*) ac_cv_data_model="i16" ; n="unusual int16 model" ;; 98 124/444) ac_cv_data_model="ILP32" ; n="standard 32bit unixish" ;; 99 124/488) ac_cv_data_model="LP64" ; n="standard 64bit unixish" ;; 100 124/448) ac_cv_data_model="LLP64" ; n="unusual 64bit unixish" ;; 101 124/*) ac_cv_data_model="i32" ; n="unusual int32 model" ;; 102 128/888) ac_cv_data_model="ILP64" ; n="unusual 64bit numeric" ;; 103 128/*) ac_cv_data_model="i64" ; n="unusual int64 model" ;; 104 222/*2) ac_cv_data_model="DSP16" ; n="strict 16bit dsptype" ;; 105 333/*3) ac_cv_data_model="DSP24" ; n="strict 24bit dsptype" ;; 106 444/*4) ac_cv_data_model="DSP32" ; n="strict 32bit dsptype" ;; 107 666/*6) ac_cv_data_model="DSP48" ; n="strict 48bit dsptype" ;; 108 888/*8) ac_cv_data_model="DSP64" ; n="strict 64bit dsptype" ;; 109 222/*|333/*|444/*|666/*|888/*) : 110 ac_cv_data_model="iDSP" ; n="unusual dsptype" ;; 111 *) ac_cv_data_model="none" ; n="very unusual model" ;; 112 esac 113 AC_MSG_RESULT([$ac_cv_data_model ($ac_cv_long_data_model, $n)]) 114]) 115 116dnl AX_CHECK_HEADER_STDINT_X([HEADERLIST][,ACTION-IF]) 117AC_DEFUN([AX_CHECK_HEADER_STDINT_X],[ 118AC_CACHE_CHECK([for stdint uintptr_t], [ac_cv_header_stdint_x],[ 119 ac_cv_header_stdint_x="" # the 1997 typedefs (inttypes.h) 120 AC_MSG_RESULT([(..)]) 121 for i in m4_ifval([$1],[$1],[stdint.h inttypes.h sys/inttypes.h sys/types.h]) 122 do 123 unset ac_cv_type_uintptr_t 124 unset ac_cv_type_uint64_t 125 AC_CHECK_TYPE(uintptr_t,[ac_cv_header_stdint_x=$i],continue,[#include <$i>]) 126 AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>]) 127 m4_ifvaln([$2],[$2]) break 128 done 129 AC_MSG_CHECKING([for stdint uintptr_t]) 130 ]) 131]) 132 133AC_DEFUN([AX_CHECK_HEADER_STDINT_O],[ 134AC_CACHE_CHECK([for stdint uint32_t], [ac_cv_header_stdint_o],[ 135 ac_cv_header_stdint_o="" # the 1995 typedefs (sys/inttypes.h) 136 AC_MSG_RESULT([(..)]) 137 for i in m4_ifval([$1],[$1],[inttypes.h sys/inttypes.h sys/types.h stdint.h]) 138 do 139 unset ac_cv_type_uint32_t 140 unset ac_cv_type_uint64_t 141 AC_CHECK_TYPE(uint32_t,[ac_cv_header_stdint_o=$i],continue,[#include <$i>]) 142 AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>]) 143 m4_ifvaln([$2],[$2]) break 144 break; 145 done 146 AC_MSG_CHECKING([for stdint uint32_t]) 147 ]) 148]) 149 150AC_DEFUN([AX_CHECK_HEADER_STDINT_U],[ 151AC_CACHE_CHECK([for stdint u_int32_t], [ac_cv_header_stdint_u],[ 152 ac_cv_header_stdint_u="" # the BSD typedefs (sys/types.h) 153 AC_MSG_RESULT([(..)]) 154 for i in m4_ifval([$1],[$1],[sys/types.h inttypes.h sys/inttypes.h]) ; do 155 unset ac_cv_type_u_int32_t 156 unset ac_cv_type_u_int64_t 157 AC_CHECK_TYPE(u_int32_t,[ac_cv_header_stdint_u=$i],continue,[#include <$i>]) 158 AC_CHECK_TYPE(u_int64_t,[and64="/u_int64_t"],[and64=""],[#include<$i>]) 159 m4_ifvaln([$2],[$2]) break 160 break; 161 done 162 AC_MSG_CHECKING([for stdint u_int32_t]) 163 ]) 164]) 165 166AC_DEFUN([AX_CREATE_STDINT_H], 167[# ------ AX CREATE STDINT H ------------------------------------- 168AC_MSG_CHECKING([for stdint types]) 169ac_stdint_h=`echo ifelse($1, , _stdint.h, $1)` 170# try to shortcircuit - if the default include path of the compiler 171# can find a "stdint.h" header then we assume that all compilers can. 172AC_CACHE_VAL([ac_cv_header_stdint_t],[ 173old_CXXFLAGS="$CXXFLAGS" ; CXXFLAGS="" 174old_CPPFLAGS="$CPPFLAGS" ; CPPFLAGS="" 175old_CFLAGS="$CFLAGS" ; CFLAGS="" 176AC_TRY_COMPILE([#include <stdint.h>],[int_least32_t v = 0;], 177[ac_cv_stdint_result="(assuming C99 compatible system)" 178 ac_cv_header_stdint_t="stdint.h"; ], 179[ac_cv_header_stdint_t=""]) 180if test "$GCC" = "yes" && test ".$ac_cv_header_stdint_t" = "."; then 181CFLAGS="-std=c99" 182AC_TRY_COMPILE([#include <stdint.h>],[int_least32_t v = 0;], 183[AC_MSG_WARN(your GCC compiler has a defunct stdint.h for its default-mode)]) 184fi 185CXXFLAGS="$old_CXXFLAGS" 186CPPFLAGS="$old_CPPFLAGS" 187CFLAGS="$old_CFLAGS" ]) 188 189v="... $ac_cv_header_stdint_h" 190if test "$ac_stdint_h" = "stdint.h" ; then 191 AC_MSG_RESULT([(are you sure you want them in ./stdint.h?)]) 192elif test "$ac_stdint_h" = "inttypes.h" ; then 193 AC_MSG_RESULT([(are you sure you want them in ./inttypes.h?)]) 194elif test "_$ac_cv_header_stdint_t" = "_" ; then 195 AC_MSG_RESULT([(putting them into $ac_stdint_h)$v]) 196else 197 ac_cv_header_stdint="$ac_cv_header_stdint_t" 198 AC_MSG_RESULT([$ac_cv_header_stdint (shortcircuit)]) 199fi 200 201if test "_$ac_cv_header_stdint_t" = "_" ; then # cannot shortcircuit.. 202 203dnl .....intro message done, now do a few system checks..... 204dnl btw, all old CHECK_TYPE macros do automatically "DEFINE" a type, 205dnl therefore we use the autoconf implementation detail CHECK_TYPE_NEW 206dnl instead that is triggered with 3 or more arguments (see types.m4) 207 208inttype_headers=`echo $2 | sed -e 's/,/ /g'` 209 210ac_cv_stdint_result="(no helpful system typedefs seen)" 211AX_CHECK_HEADER_STDINT_X(dnl 212 stdint.h inttypes.h sys/inttypes.h $inttype_headers, 213 ac_cv_stdint_result="(seen uintptr_t$and64 in $i)") 214 215if test "_$ac_cv_header_stdint_x" = "_" ; then 216AX_CHECK_HEADER_STDINT_O(dnl, 217 inttypes.h sys/inttypes.h stdint.h $inttype_headers, 218 ac_cv_stdint_result="(seen uint32_t$and64 in $i)") 219fi 220 221if test "_$ac_cv_header_stdint_x" = "_" ; then 222if test "_$ac_cv_header_stdint_o" = "_" ; then 223AX_CHECK_HEADER_STDINT_U(dnl, 224 sys/types.h inttypes.h sys/inttypes.h $inttype_headers, 225 ac_cv_stdint_result="(seen u_int32_t$and64 in $i)") 226fi fi 227 228dnl if there was no good C99 header file, do some typedef checks... 229if test "_$ac_cv_header_stdint_x" = "_" ; then 230 AC_MSG_CHECKING([for stdint datatype model]) 231 AC_MSG_RESULT([(..)]) 232 AX_CHECK_DATA_MODEL 233fi 234 235if test "_$ac_cv_header_stdint_x" != "_" ; then 236 ac_cv_header_stdint="$ac_cv_header_stdint_x" 237elif test "_$ac_cv_header_stdint_o" != "_" ; then 238 ac_cv_header_stdint="$ac_cv_header_stdint_o" 239elif test "_$ac_cv_header_stdint_u" != "_" ; then 240 ac_cv_header_stdint="$ac_cv_header_stdint_u" 241else 242 ac_cv_header_stdint="stddef.h" 243fi 244 245AC_MSG_CHECKING([for extra inttypes in chosen header]) 246AC_MSG_RESULT([($ac_cv_header_stdint)]) 247dnl see if int_least and int_fast types are present in _this_ header. 248unset ac_cv_type_int_least32_t 249unset ac_cv_type_int_fast32_t 250AC_CHECK_TYPE(int_least32_t,,,[#include <$ac_cv_header_stdint>]) 251AC_CHECK_TYPE(int_fast32_t,,,[#include<$ac_cv_header_stdint>]) 252AC_CHECK_TYPE(intmax_t,,,[#include <$ac_cv_header_stdint>]) 253 254fi # shortcircut to system "stdint.h" 255# ------------------ PREPARE VARIABLES ------------------------------ 256if test "$GCC" = "yes" ; then 257ac_cv_stdint_message="using gnu compiler "`$CC --version | head -1` 258else 259ac_cv_stdint_message="using $CC" 260fi 261 262AC_MSG_RESULT([make use of $ac_cv_header_stdint in $ac_stdint_h dnl 263$ac_cv_stdint_result]) 264 265dnl ----------------------------------------------------------------- 266# ----------------- DONE inttypes.h checks START header ------------- 267AC_CONFIG_COMMANDS([$ac_stdint_h],[ 268AC_MSG_NOTICE(creating $ac_stdint_h : $_ac_stdint_h) 269ac_stdint=$tmp/_stdint.h 270 271echo "#ifndef" $_ac_stdint_h >$ac_stdint 272echo "#define" $_ac_stdint_h "1" >>$ac_stdint 273echo "#ifndef" _GENERATED_STDINT_H >>$ac_stdint 274echo "#define" _GENERATED_STDINT_H '"'$PACKAGE $VERSION'"' >>$ac_stdint 275echo "/* generated $ac_cv_stdint_message */" >>$ac_stdint 276if test "_$ac_cv_header_stdint_t" != "_" ; then 277echo "#define _STDINT_HAVE_STDINT_H" "1" >>$ac_stdint 278echo "#include <stdint.h>" >>$ac_stdint 279echo "#endif" >>$ac_stdint 280echo "#endif" >>$ac_stdint 281else 282 283cat >>$ac_stdint <<STDINT_EOF 284 285/* ................... shortcircuit part ........................... */ 286 287#if defined HAVE_STDINT_H || defined _STDINT_HAVE_STDINT_H 288#include <stdint.h> 289#else 290#include <stddef.h> 291 292/* .................... configured part ............................ */ 293 294STDINT_EOF 295 296echo "/* whether we have a C99 compatible stdint header file */" >>$ac_stdint 297if test "_$ac_cv_header_stdint_x" != "_" ; then 298 ac_header="$ac_cv_header_stdint_x" 299 echo "#define _STDINT_HEADER_INTPTR" '"'"$ac_header"'"' >>$ac_stdint 300else 301 echo "/* #undef _STDINT_HEADER_INTPTR */" >>$ac_stdint 302fi 303 304echo "/* whether we have a C96 compatible inttypes header file */" >>$ac_stdint 305if test "_$ac_cv_header_stdint_o" != "_" ; then 306 ac_header="$ac_cv_header_stdint_o" 307 echo "#define _STDINT_HEADER_UINT32" '"'"$ac_header"'"' >>$ac_stdint 308else 309 echo "/* #undef _STDINT_HEADER_UINT32 */" >>$ac_stdint 310fi 311 312echo "/* whether we have a BSD compatible inet types header */" >>$ac_stdint 313if test "_$ac_cv_header_stdint_u" != "_" ; then 314 ac_header="$ac_cv_header_stdint_u" 315 echo "#define _STDINT_HEADER_U_INT32" '"'"$ac_header"'"' >>$ac_stdint 316else 317 echo "/* #undef _STDINT_HEADER_U_INT32 */" >>$ac_stdint 318fi 319 320echo "" >>$ac_stdint 321 322if test "_$ac_header" != "_" ; then if test "$ac_header" != "stddef.h" ; then 323 echo "#include <$ac_header>" >>$ac_stdint 324 echo "" >>$ac_stdint 325fi fi 326 327echo "/* which 64bit typedef has been found */" >>$ac_stdint 328if test "$ac_cv_type_uint64_t" = "yes" ; then 329echo "#define _STDINT_HAVE_UINT64_T" "1" >>$ac_stdint 330else 331echo "/* #undef _STDINT_HAVE_UINT64_T */" >>$ac_stdint 332fi 333if test "$ac_cv_type_u_int64_t" = "yes" ; then 334echo "#define _STDINT_HAVE_U_INT64_T" "1" >>$ac_stdint 335else 336echo "/* #undef _STDINT_HAVE_U_INT64_T */" >>$ac_stdint 337fi 338echo "" >>$ac_stdint 339 340echo "/* which type model has been detected */" >>$ac_stdint 341if test "_$ac_cv_char_data_model" != "_" ; then 342echo "#define _STDINT_CHAR_MODEL" "$ac_cv_char_data_model" >>$ac_stdint 343echo "#define _STDINT_LONG_MODEL" "$ac_cv_long_data_model" >>$ac_stdint 344else 345echo "/* #undef _STDINT_CHAR_MODEL // skipped */" >>$ac_stdint 346echo "/* #undef _STDINT_LONG_MODEL // skipped */" >>$ac_stdint 347fi 348echo "" >>$ac_stdint 349 350echo "/* whether int_least types were detected */" >>$ac_stdint 351if test "$ac_cv_type_int_least32_t" = "yes"; then 352echo "#define _STDINT_HAVE_INT_LEAST32_T" "1" >>$ac_stdint 353else 354echo "/* #undef _STDINT_HAVE_INT_LEAST32_T */" >>$ac_stdint 355fi 356echo "/* whether int_fast types were detected */" >>$ac_stdint 357if test "$ac_cv_type_int_fast32_t" = "yes"; then 358echo "#define _STDINT_HAVE_INT_FAST32_T" "1" >>$ac_stdint 359else 360echo "/* #undef _STDINT_HAVE_INT_FAST32_T */" >>$ac_stdint 361fi 362echo "/* whether intmax_t type was detected */" >>$ac_stdint 363if test "$ac_cv_type_intmax_t" = "yes"; then 364echo "#define _STDINT_HAVE_INTMAX_T" "1" >>$ac_stdint 365else 366echo "/* #undef _STDINT_HAVE_INTMAX_T */" >>$ac_stdint 367fi 368echo "" >>$ac_stdint 369 370 cat >>$ac_stdint <<STDINT_EOF 371/* .................... detections part ............................ */ 372 373/* whether we need to define bitspecific types from compiler base types */ 374#ifndef _STDINT_HEADER_INTPTR 375#ifndef _STDINT_HEADER_UINT32 376#ifndef _STDINT_HEADER_U_INT32 377#define _STDINT_NEED_INT_MODEL_T 378#else 379#define _STDINT_HAVE_U_INT_TYPES 380#endif 381#endif 382#endif 383 384#ifdef _STDINT_HAVE_U_INT_TYPES 385#undef _STDINT_NEED_INT_MODEL_T 386#endif 387 388#ifdef _STDINT_CHAR_MODEL 389#if _STDINT_CHAR_MODEL+0 == 122 || _STDINT_CHAR_MODEL+0 == 124 390#ifndef _STDINT_BYTE_MODEL 391#define _STDINT_BYTE_MODEL 12 392#endif 393#endif 394#endif 395 396#ifndef _STDINT_HAVE_INT_LEAST32_T 397#define _STDINT_NEED_INT_LEAST_T 398#endif 399 400#ifndef _STDINT_HAVE_INT_FAST32_T 401#define _STDINT_NEED_INT_FAST_T 402#endif 403 404#ifndef _STDINT_HEADER_INTPTR 405#define _STDINT_NEED_INTPTR_T 406#ifndef _STDINT_HAVE_INTMAX_T 407#define _STDINT_NEED_INTMAX_T 408#endif 409#endif 410 411 412/* .................... definition part ............................ */ 413 414/* some system headers have good uint64_t */ 415#ifndef _HAVE_UINT64_T 416#if defined _STDINT_HAVE_UINT64_T || defined HAVE_UINT64_T 417#define _HAVE_UINT64_T 418#elif defined _STDINT_HAVE_U_INT64_T || defined HAVE_U_INT64_T 419#define _HAVE_UINT64_T 420typedef u_int64_t uint64_t; 421#endif 422#endif 423 424#ifndef _HAVE_UINT64_T 425/* .. here are some common heuristics using compiler runtime specifics */ 426#if defined __STDC_VERSION__ && defined __STDC_VERSION__ >= 199901L 427#define _HAVE_UINT64_T 428#define _HAVE_LONGLONG_UINT64_T 429typedef long long int64_t; 430typedef unsigned long long uint64_t; 431 432#elif !defined __STRICT_ANSI__ 433#if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__ 434#define _HAVE_UINT64_T 435typedef __int64 int64_t; 436typedef unsigned __int64 uint64_t; 437 438#elif defined __GNUC__ || defined __MWERKS__ || defined __ELF__ 439/* note: all ELF-systems seem to have loff-support which needs 64-bit */ 440#if !defined _NO_LONGLONG 441#define _HAVE_UINT64_T 442#define _HAVE_LONGLONG_UINT64_T 443typedef long long int64_t; 444typedef unsigned long long uint64_t; 445#endif 446 447#elif defined __alpha || (defined __mips && defined _ABIN32) 448#if !defined _NO_LONGLONG 449typedef long int64_t; 450typedef unsigned long uint64_t; 451#endif 452 /* compiler/cpu type to define int64_t */ 453#endif 454#endif 455#endif 456 457#if defined _STDINT_HAVE_U_INT_TYPES 458/* int8_t int16_t int32_t defined by inet code, redeclare the u_intXX types */ 459typedef u_int8_t uint8_t; 460typedef u_int16_t uint16_t; 461typedef u_int32_t uint32_t; 462 463/* glibc compatibility */ 464#ifndef __int8_t_defined 465#define __int8_t_defined 466#endif 467#endif 468 469#ifdef _STDINT_NEED_INT_MODEL_T 470/* we must guess all the basic types. Apart from byte-adressable system, */ 471/* there a few 32-bit-only dsp-systems that we guard with BYTE_MODEL 8-} */ 472/* (btw, those nibble-addressable systems are way off, or so we assume) */ 473 474dnl /* have a look at "64bit and data size neutrality" at */ 475dnl /* http://unix.org/version2/whatsnew/login_64bit.html */ 476dnl /* (the shorthand "ILP" types always have a "P" part) */ 477 478#if defined _STDINT_BYTE_MODEL 479#if _STDINT_LONG_MODEL+0 == 242 480/* 2:4:2 = IP16 = a normal 16-bit system */ 481typedef unsigned char uint8_t; 482typedef unsigned short uint16_t; 483typedef unsigned long uint32_t; 484#ifndef __int8_t_defined 485#define __int8_t_defined 486typedef char int8_t; 487typedef short int16_t; 488typedef long int32_t; 489#endif 490#elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL == 444 491/* 2:4:4 = LP32 = a 32-bit system derived from a 16-bit */ 492/* 4:4:4 = ILP32 = a normal 32-bit system */ 493typedef unsigned char uint8_t; 494typedef unsigned short uint16_t; 495typedef unsigned int uint32_t; 496#ifndef __int8_t_defined 497#define __int8_t_defined 498typedef char int8_t; 499typedef short int16_t; 500typedef int int32_t; 501#endif 502#elif _STDINT_LONG_MODEL+0 == 484 || _STDINT_LONG_MODEL+0 == 488 503/* 4:8:4 = IP32 = a 32-bit system prepared for 64-bit */ 504/* 4:8:8 = LP64 = a normal 64-bit system */ 505typedef unsigned char uint8_t; 506typedef unsigned short uint16_t; 507typedef unsigned int uint32_t; 508#ifndef __int8_t_defined 509#define __int8_t_defined 510typedef char int8_t; 511typedef short int16_t; 512typedef int int32_t; 513#endif 514/* this system has a "long" of 64bit */ 515#ifndef _HAVE_UINT64_T 516#define _HAVE_UINT64_T 517typedef unsigned long uint64_t; 518typedef long int64_t; 519#endif 520#elif _STDINT_LONG_MODEL+0 == 448 521/* LLP64 a 64-bit system derived from a 32-bit system */ 522typedef unsigned char uint8_t; 523typedef unsigned short uint16_t; 524typedef unsigned int uint32_t; 525#ifndef __int8_t_defined 526#define __int8_t_defined 527typedef char int8_t; 528typedef short int16_t; 529typedef int int32_t; 530#endif 531/* assuming the system has a "long long" */ 532#ifndef _HAVE_UINT64_T 533#define _HAVE_UINT64_T 534#define _HAVE_LONGLONG_UINT64_T 535typedef unsigned long long uint64_t; 536typedef long long int64_t; 537#endif 538#else 539#define _STDINT_NO_INT32_T 540#endif 541#else 542#define _STDINT_NO_INT8_T 543#define _STDINT_NO_INT32_T 544#endif 545#endif 546 547/* 548 * quote from SunOS-5.8 sys/inttypes.h: 549 * Use at your own risk. As of February 1996, the committee is squarely 550 * behind the fixed sized types; the "least" and "fast" types are still being 551 * discussed. The probability that the "fast" types may be removed before 552 * the standard is finalized is high enough that they are not currently 553 * implemented. 554 */ 555 556#if defined _STDINT_NEED_INT_LEAST_T 557typedef int8_t int_least8_t; 558typedef int16_t int_least16_t; 559typedef int32_t int_least32_t; 560#ifdef _HAVE_UINT64_T 561typedef int64_t int_least64_t; 562#endif 563 564typedef uint8_t uint_least8_t; 565typedef uint16_t uint_least16_t; 566typedef uint32_t uint_least32_t; 567#ifdef _HAVE_UINT64_T 568typedef uint64_t uint_least64_t; 569#endif 570 /* least types */ 571#endif 572 573#if defined _STDINT_NEED_INT_FAST_T 574typedef int8_t int_fast8_t; 575typedef int int_fast16_t; 576typedef int32_t int_fast32_t; 577#ifdef _HAVE_UINT64_T 578typedef int64_t int_fast64_t; 579#endif 580 581typedef uint8_t uint_fast8_t; 582typedef unsigned uint_fast16_t; 583typedef uint32_t uint_fast32_t; 584#ifdef _HAVE_UINT64_T 585typedef uint64_t uint_fast64_t; 586#endif 587 /* fast types */ 588#endif 589 590#ifdef _STDINT_NEED_INTMAX_T 591#ifdef _HAVE_UINT64_T 592typedef int64_t intmax_t; 593typedef uint64_t uintmax_t; 594#else 595typedef long intmax_t; 596typedef unsigned long uintmax_t; 597#endif 598#endif 599 600#ifdef _STDINT_NEED_INTPTR_T 601#ifndef __intptr_t_defined 602#define __intptr_t_defined 603/* we encourage using "long" to store pointer values, never use "int" ! */ 604#if _STDINT_LONG_MODEL+0 == 242 || _STDINT_LONG_MODEL+0 == 484 605typedef unsigned int uintptr_t; 606typedef int intptr_t; 607#elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL+0 == 444 608typedef unsigned long uintptr_t; 609typedef long intptr_t; 610#elif _STDINT_LONG_MODEL+0 == 448 && defined _HAVE_UINT64_T 611typedef uint64_t uintptr_t; 612typedef int64_t intptr_t; 613#else /* matches typical system types ILP32 and LP64 - but not IP16 or LLP64 */ 614typedef unsigned long uintptr_t; 615typedef long intptr_t; 616#endif 617#endif 618#endif 619 620/* The ISO C99 standard specifies that in C++ implementations these 621 should only be defined if explicitly requested. */ 622#if !defined __cplusplus || defined __STDC_CONSTANT_MACROS 623#ifndef UINT32_C 624 625/* Signed. */ 626# define INT8_C(c) c 627# define INT16_C(c) c 628# define INT32_C(c) c 629# ifdef _HAVE_LONGLONG_UINT64_T 630# define INT64_C(c) c ## L 631# else 632# define INT64_C(c) c ## LL 633# endif 634 635/* Unsigned. */ 636# define UINT8_C(c) c ## U 637# define UINT16_C(c) c ## U 638# define UINT32_C(c) c ## U 639# ifdef _HAVE_LONGLONG_UINT64_T 640# define UINT64_C(c) c ## UL 641# else 642# define UINT64_C(c) c ## ULL 643# endif 644 645/* Maximal type. */ 646# ifdef _HAVE_LONGLONG_UINT64_T 647# define INTMAX_C(c) c ## L 648# define UINTMAX_C(c) c ## UL 649# else 650# define INTMAX_C(c) c ## LL 651# define UINTMAX_C(c) c ## ULL 652# endif 653 654 /* literalnumbers */ 655#endif 656#endif 657 658/* These limits are merily those of a two complement byte-oriented system */ 659 660/* Minimum of signed integral types. */ 661# define INT8_MIN (-128) 662# define INT16_MIN (-32767-1) 663# define INT32_MIN (-2147483647-1) 664# define INT64_MIN (-__INT64_C(9223372036854775807)-1) 665/* Maximum of signed integral types. */ 666# define INT8_MAX (127) 667# define INT16_MAX (32767) 668# define INT32_MAX (2147483647) 669# define INT64_MAX (__INT64_C(9223372036854775807)) 670 671/* Maximum of unsigned integral types. */ 672# define UINT8_MAX (255) 673# define UINT16_MAX (65535) 674# define UINT32_MAX (4294967295U) 675# define UINT64_MAX (__UINT64_C(18446744073709551615)) 676 677/* Minimum of signed integral types having a minimum size. */ 678# define INT_LEAST8_MIN INT8_MIN 679# define INT_LEAST16_MIN INT16_MIN 680# define INT_LEAST32_MIN INT32_MIN 681# define INT_LEAST64_MIN INT64_MIN 682/* Maximum of signed integral types having a minimum size. */ 683# define INT_LEAST8_MAX INT8_MAX 684# define INT_LEAST16_MAX INT16_MAX 685# define INT_LEAST32_MAX INT32_MAX 686# define INT_LEAST64_MAX INT64_MAX 687 688/* Maximum of unsigned integral types having a minimum size. */ 689# define UINT_LEAST8_MAX UINT8_MAX 690# define UINT_LEAST16_MAX UINT16_MAX 691# define UINT_LEAST32_MAX UINT32_MAX 692# define UINT_LEAST64_MAX UINT64_MAX 693 694 /* shortcircuit*/ 695#endif 696 /* once */ 697#endif 698#endif 699STDINT_EOF 700fi 701 if cmp -s $ac_stdint_h $ac_stdint 2>/dev/null; then 702 AC_MSG_NOTICE([$ac_stdint_h is unchanged]) 703 else 704 ac_dir=`AS_DIRNAME(["$ac_stdint_h"])` 705 AS_MKDIR_P(["$ac_dir"]) 706 rm -f $ac_stdint_h 707 mv $ac_stdint $ac_stdint_h 708 fi 709],[# variables for create stdint.h replacement 710PACKAGE="$PACKAGE" 711VERSION="$VERSION" 712ac_stdint_h="$ac_stdint_h" 713_ac_stdint_h=AS_TR_CPP(_$PACKAGE-$ac_stdint_h) 714ac_cv_stdint_message="$ac_cv_stdint_message" 715ac_cv_header_stdint_t="$ac_cv_header_stdint_t" 716ac_cv_header_stdint_x="$ac_cv_header_stdint_x" 717ac_cv_header_stdint_o="$ac_cv_header_stdint_o" 718ac_cv_header_stdint_u="$ac_cv_header_stdint_u" 719ac_cv_type_uint64_t="$ac_cv_type_uint64_t" 720ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t" 721ac_cv_char_data_model="$ac_cv_char_data_model" 722ac_cv_long_data_model="$ac_cv_long_data_model" 723ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t" 724ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t" 725ac_cv_type_intmax_t="$ac_cv_type_intmax_t" 726]) 727]) 728