Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

728 lines
25KB

  1. # ===========================================================================
  2. # https://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 environments we can use the inet-types in
  16. # <sys/types.h> which would define the typedefs int8_t and u_int8_t
  17. # respectively.
  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 deliberately 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 <https://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. #serial 19
  77. AC_DEFUN([AX_CHECK_DATA_MODEL],[
  78. AC_CHECK_SIZEOF(char)
  79. AC_CHECK_SIZEOF(short)
  80. AC_CHECK_SIZEOF(int)
  81. AC_CHECK_SIZEOF(long)
  82. AC_CHECK_SIZEOF(void*)
  83. ac_cv_char_data_model=""
  84. ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_char"
  85. ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_short"
  86. ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_int"
  87. ac_cv_long_data_model=""
  88. ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_int"
  89. ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_long"
  90. ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_voidp"
  91. AC_MSG_CHECKING([data model])
  92. case "$ac_cv_char_data_model/$ac_cv_long_data_model" in
  93. 122/242) ac_cv_data_model="IP16" ; n="standard 16bit machine" ;;
  94. 122/244) ac_cv_data_model="LP32" ; n="standard 32bit machine" ;;
  95. 122/*) ac_cv_data_model="i16" ; n="unusual int16 model" ;;
  96. 124/444) ac_cv_data_model="ILP32" ; n="standard 32bit unixish" ;;
  97. 124/488) ac_cv_data_model="LP64" ; n="standard 64bit unixish" ;;
  98. 124/448) ac_cv_data_model="LLP64" ; n="unusual 64bit unixish" ;;
  99. 124/*) ac_cv_data_model="i32" ; n="unusual int32 model" ;;
  100. 128/888) ac_cv_data_model="ILP64" ; n="unusual 64bit numeric" ;;
  101. 128/*) ac_cv_data_model="i64" ; n="unusual int64 model" ;;
  102. 222/*2) ac_cv_data_model="DSP16" ; n="strict 16bit dsptype" ;;
  103. 333/*3) ac_cv_data_model="DSP24" ; n="strict 24bit dsptype" ;;
  104. 444/*4) ac_cv_data_model="DSP32" ; n="strict 32bit dsptype" ;;
  105. 666/*6) ac_cv_data_model="DSP48" ; n="strict 48bit dsptype" ;;
  106. 888/*8) ac_cv_data_model="DSP64" ; n="strict 64bit dsptype" ;;
  107. 222/*|333/*|444/*|666/*|888/*) :
  108. ac_cv_data_model="iDSP" ; n="unusual dsptype" ;;
  109. *) ac_cv_data_model="none" ; n="very unusual model" ;;
  110. esac
  111. AC_MSG_RESULT([$ac_cv_data_model ($ac_cv_long_data_model, $n)])
  112. ])
  113. dnl AX_CHECK_HEADER_STDINT_X([HEADERLIST][,ACTION-IF])
  114. AC_DEFUN([AX_CHECK_HEADER_STDINT_X],[
  115. AC_CACHE_CHECK([for stdint uintptr_t], [ac_cv_header_stdint_x],[
  116. ac_cv_header_stdint_x="" # the 1997 typedefs (inttypes.h)
  117. AC_MSG_RESULT([(..)])
  118. for i in m4_ifval([$1],[$1],[stdint.h inttypes.h sys/inttypes.h sys/types.h])
  119. do
  120. unset ac_cv_type_uintptr_t
  121. unset ac_cv_type_uint64_t
  122. AC_CHECK_TYPE(uintptr_t,[ac_cv_header_stdint_x=$i],continue,[#include <$i>])
  123. AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>])
  124. m4_ifvaln([$2],[$2]) break
  125. done
  126. AC_MSG_CHECKING([for stdint uintptr_t])
  127. ])
  128. ])
  129. AC_DEFUN([AX_CHECK_HEADER_STDINT_O],[
  130. AC_CACHE_CHECK([for stdint uint32_t], [ac_cv_header_stdint_o],[
  131. ac_cv_header_stdint_o="" # the 1995 typedefs (sys/inttypes.h)
  132. AC_MSG_RESULT([(..)])
  133. for i in m4_ifval([$1],[$1],[inttypes.h sys/inttypes.h sys/types.h stdint.h])
  134. do
  135. unset ac_cv_type_uint32_t
  136. unset ac_cv_type_uint64_t
  137. AC_CHECK_TYPE(uint32_t,[ac_cv_header_stdint_o=$i],continue,[#include <$i>])
  138. AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>])
  139. m4_ifvaln([$2],[$2]) break
  140. break;
  141. done
  142. AC_MSG_CHECKING([for stdint uint32_t])
  143. ])
  144. ])
  145. AC_DEFUN([AX_CHECK_HEADER_STDINT_U],[
  146. AC_CACHE_CHECK([for stdint u_int32_t], [ac_cv_header_stdint_u],[
  147. ac_cv_header_stdint_u="" # the BSD typedefs (sys/types.h)
  148. AC_MSG_RESULT([(..)])
  149. for i in m4_ifval([$1],[$1],[sys/types.h inttypes.h sys/inttypes.h]) ; do
  150. unset ac_cv_type_u_int32_t
  151. unset ac_cv_type_u_int64_t
  152. AC_CHECK_TYPE(u_int32_t,[ac_cv_header_stdint_u=$i],continue,[#include <$i>])
  153. AC_CHECK_TYPE(u_int64_t,[and64="/u_int64_t"],[and64=""],[#include<$i>])
  154. m4_ifvaln([$2],[$2]) break
  155. break;
  156. done
  157. AC_MSG_CHECKING([for stdint u_int32_t])
  158. ])
  159. ])
  160. AC_DEFUN([AX_CREATE_STDINT_H],
  161. [# ------ AX CREATE STDINT H -------------------------------------
  162. AC_MSG_CHECKING([for stdint types])
  163. ac_stdint_h=`echo ifelse($1, , _stdint.h, $1)`
  164. # try to shortcircuit - if the default include path of the compiler
  165. # can find a "stdint.h" header then we assume that all compilers can.
  166. AC_CACHE_VAL([ac_cv_header_stdint_t],[
  167. old_CXXFLAGS="$CXXFLAGS" ; CXXFLAGS=""
  168. old_CPPFLAGS="$CPPFLAGS" ; CPPFLAGS=""
  169. old_CFLAGS="$CFLAGS" ; CFLAGS=""
  170. AC_TRY_COMPILE([#include <stdint.h>],[int_least32_t v = 0;],
  171. [ac_cv_stdint_result="(assuming C99 compatible system)"
  172. ac_cv_header_stdint_t="stdint.h"; ],
  173. [ac_cv_header_stdint_t=""])
  174. if test "$GCC" = "yes" && test ".$ac_cv_header_stdint_t" = "."; then
  175. CFLAGS="-std=c99"
  176. AC_TRY_COMPILE([#include <stdint.h>],[int_least32_t v = 0;],
  177. [AC_MSG_WARN(your GCC compiler has a defunct stdint.h for its default-mode)])
  178. fi
  179. CXXFLAGS="$old_CXXFLAGS"
  180. CPPFLAGS="$old_CPPFLAGS"
  181. CFLAGS="$old_CFLAGS" ])
  182. v="... $ac_cv_header_stdint_h"
  183. if test "$ac_stdint_h" = "stdint.h" ; then
  184. AC_MSG_RESULT([(are you sure you want them in ./stdint.h?)])
  185. elif test "$ac_stdint_h" = "inttypes.h" ; then
  186. AC_MSG_RESULT([(are you sure you want them in ./inttypes.h?)])
  187. elif test "_$ac_cv_header_stdint_t" = "_" ; then
  188. AC_MSG_RESULT([(putting them into $ac_stdint_h)$v])
  189. else
  190. ac_cv_header_stdint="$ac_cv_header_stdint_t"
  191. AC_MSG_RESULT([$ac_cv_header_stdint (shortcircuit)])
  192. fi
  193. if test "_$ac_cv_header_stdint_t" = "_" ; then # cannot shortcircuit..
  194. dnl .....intro message done, now do a few system checks.....
  195. dnl btw, all old CHECK_TYPE macros do automatically "DEFINE" a type,
  196. dnl therefore we use the autoconf implementation detail CHECK_TYPE_NEW
  197. dnl instead that is triggered with 3 or more arguments (see types.m4)
  198. inttype_headers=`echo $2 | sed -e 's/,/ /g'`
  199. ac_cv_stdint_result="(no helpful system typedefs seen)"
  200. AX_CHECK_HEADER_STDINT_X(dnl
  201. stdint.h inttypes.h sys/inttypes.h $inttype_headers,
  202. ac_cv_stdint_result="(seen uintptr_t$and64 in $i)")
  203. if test "_$ac_cv_header_stdint_x" = "_" ; then
  204. AX_CHECK_HEADER_STDINT_O(dnl,
  205. inttypes.h sys/inttypes.h stdint.h $inttype_headers,
  206. ac_cv_stdint_result="(seen uint32_t$and64 in $i)")
  207. fi
  208. if test "_$ac_cv_header_stdint_x" = "_" ; then
  209. if test "_$ac_cv_header_stdint_o" = "_" ; then
  210. AX_CHECK_HEADER_STDINT_U(dnl,
  211. sys/types.h inttypes.h sys/inttypes.h $inttype_headers,
  212. ac_cv_stdint_result="(seen u_int32_t$and64 in $i)")
  213. fi fi
  214. dnl if there was no good C99 header file, do some typedef checks...
  215. if test "_$ac_cv_header_stdint_x" = "_" ; then
  216. AC_MSG_CHECKING([for stdint datatype model])
  217. AC_MSG_RESULT([(..)])
  218. AX_CHECK_DATA_MODEL
  219. fi
  220. if test "_$ac_cv_header_stdint_x" != "_" ; then
  221. ac_cv_header_stdint="$ac_cv_header_stdint_x"
  222. elif test "_$ac_cv_header_stdint_o" != "_" ; then
  223. ac_cv_header_stdint="$ac_cv_header_stdint_o"
  224. elif test "_$ac_cv_header_stdint_u" != "_" ; then
  225. ac_cv_header_stdint="$ac_cv_header_stdint_u"
  226. else
  227. ac_cv_header_stdint="stddef.h"
  228. fi
  229. AC_MSG_CHECKING([for extra inttypes in chosen header])
  230. AC_MSG_RESULT([($ac_cv_header_stdint)])
  231. dnl see if int_least and int_fast types are present in _this_ header.
  232. unset ac_cv_type_int_least32_t
  233. unset ac_cv_type_int_fast32_t
  234. AC_CHECK_TYPE(int_least32_t,,,[#include <$ac_cv_header_stdint>])
  235. AC_CHECK_TYPE(int_fast32_t,,,[#include<$ac_cv_header_stdint>])
  236. AC_CHECK_TYPE(intmax_t,,,[#include <$ac_cv_header_stdint>])
  237. fi # shortcircuit to system "stdint.h"
  238. # ------------------ PREPARE VARIABLES ------------------------------
  239. if test "$GCC" = "yes" ; then
  240. ac_cv_stdint_message="using gnu compiler "`$CC --version | head -1`
  241. else
  242. ac_cv_stdint_message="using $CC"
  243. fi
  244. AC_MSG_RESULT([make use of $ac_cv_header_stdint in $ac_stdint_h dnl
  245. $ac_cv_stdint_result])
  246. dnl -----------------------------------------------------------------
  247. # ----------------- DONE inttypes.h checks START header -------------
  248. AC_CONFIG_COMMANDS([$ac_stdint_h],[
  249. AC_MSG_NOTICE(creating $ac_stdint_h : $_ac_stdint_h)
  250. ac_stdint=$tmp/_stdint.h
  251. echo "#ifndef" $_ac_stdint_h >$ac_stdint
  252. echo "#define" $_ac_stdint_h "1" >>$ac_stdint
  253. echo "#ifndef" _GENERATED_STDINT_H >>$ac_stdint
  254. echo "#define" _GENERATED_STDINT_H '"'$PACKAGE $VERSION'"' >>$ac_stdint
  255. echo "/* generated $ac_cv_stdint_message */" >>$ac_stdint
  256. if test "_$ac_cv_header_stdint_t" != "_" ; then
  257. echo "#define _STDINT_HAVE_STDINT_H" "1" >>$ac_stdint
  258. echo "#include <stdint.h>" >>$ac_stdint
  259. echo "#endif" >>$ac_stdint
  260. echo "#endif" >>$ac_stdint
  261. else
  262. cat >>$ac_stdint <<STDINT_EOF
  263. /* ................... shortcircuit part ........................... */
  264. #if defined HAVE_STDINT_H || defined _STDINT_HAVE_STDINT_H
  265. #include <stdint.h>
  266. #else
  267. #include <stddef.h>
  268. /* .................... configured part ............................ */
  269. STDINT_EOF
  270. echo "/* whether we have a C99 compatible stdint header file */" >>$ac_stdint
  271. if test "_$ac_cv_header_stdint_x" != "_" ; then
  272. ac_header="$ac_cv_header_stdint_x"
  273. echo "#define _STDINT_HEADER_INTPTR" '"'"$ac_header"'"' >>$ac_stdint
  274. else
  275. echo "/* #undef _STDINT_HEADER_INTPTR */" >>$ac_stdint
  276. fi
  277. echo "/* whether we have a C96 compatible inttypes header file */" >>$ac_stdint
  278. if test "_$ac_cv_header_stdint_o" != "_" ; then
  279. ac_header="$ac_cv_header_stdint_o"
  280. echo "#define _STDINT_HEADER_UINT32" '"'"$ac_header"'"' >>$ac_stdint
  281. else
  282. echo "/* #undef _STDINT_HEADER_UINT32 */" >>$ac_stdint
  283. fi
  284. echo "/* whether we have a BSD compatible inet types header */" >>$ac_stdint
  285. if test "_$ac_cv_header_stdint_u" != "_" ; then
  286. ac_header="$ac_cv_header_stdint_u"
  287. echo "#define _STDINT_HEADER_U_INT32" '"'"$ac_header"'"' >>$ac_stdint
  288. else
  289. echo "/* #undef _STDINT_HEADER_U_INT32 */" >>$ac_stdint
  290. fi
  291. echo "" >>$ac_stdint
  292. if test "_$ac_header" != "_" ; then if test "$ac_header" != "stddef.h" ; then
  293. echo "#include <$ac_header>" >>$ac_stdint
  294. echo "" >>$ac_stdint
  295. fi fi
  296. echo "/* which 64bit typedef has been found */" >>$ac_stdint
  297. if test "$ac_cv_type_uint64_t" = "yes" ; then
  298. echo "#define _STDINT_HAVE_UINT64_T" "1" >>$ac_stdint
  299. else
  300. echo "/* #undef _STDINT_HAVE_UINT64_T */" >>$ac_stdint
  301. fi
  302. if test "$ac_cv_type_u_int64_t" = "yes" ; then
  303. echo "#define _STDINT_HAVE_U_INT64_T" "1" >>$ac_stdint
  304. else
  305. echo "/* #undef _STDINT_HAVE_U_INT64_T */" >>$ac_stdint
  306. fi
  307. echo "" >>$ac_stdint
  308. echo "/* which type model has been detected */" >>$ac_stdint
  309. if test "_$ac_cv_char_data_model" != "_" ; then
  310. echo "#define _STDINT_CHAR_MODEL" "$ac_cv_char_data_model" >>$ac_stdint
  311. echo "#define _STDINT_LONG_MODEL" "$ac_cv_long_data_model" >>$ac_stdint
  312. else
  313. echo "/* #undef _STDINT_CHAR_MODEL // skipped */" >>$ac_stdint
  314. echo "/* #undef _STDINT_LONG_MODEL // skipped */" >>$ac_stdint
  315. fi
  316. echo "" >>$ac_stdint
  317. echo "/* whether int_least types were detected */" >>$ac_stdint
  318. if test "$ac_cv_type_int_least32_t" = "yes"; then
  319. echo "#define _STDINT_HAVE_INT_LEAST32_T" "1" >>$ac_stdint
  320. else
  321. echo "/* #undef _STDINT_HAVE_INT_LEAST32_T */" >>$ac_stdint
  322. fi
  323. echo "/* whether int_fast types were detected */" >>$ac_stdint
  324. if test "$ac_cv_type_int_fast32_t" = "yes"; then
  325. echo "#define _STDINT_HAVE_INT_FAST32_T" "1" >>$ac_stdint
  326. else
  327. echo "/* #undef _STDINT_HAVE_INT_FAST32_T */" >>$ac_stdint
  328. fi
  329. echo "/* whether intmax_t type was detected */" >>$ac_stdint
  330. if test "$ac_cv_type_intmax_t" = "yes"; then
  331. echo "#define _STDINT_HAVE_INTMAX_T" "1" >>$ac_stdint
  332. else
  333. echo "/* #undef _STDINT_HAVE_INTMAX_T */" >>$ac_stdint
  334. fi
  335. echo "" >>$ac_stdint
  336. cat >>$ac_stdint <<STDINT_EOF
  337. /* .................... detections part ............................ */
  338. /* whether we need to define bit specific types from compiler base types */
  339. #ifndef _STDINT_HEADER_INTPTR
  340. #ifndef _STDINT_HEADER_UINT32
  341. #ifndef _STDINT_HEADER_U_INT32
  342. #define _STDINT_NEED_INT_MODEL_T
  343. #else
  344. #define _STDINT_HAVE_U_INT_TYPES
  345. #endif
  346. #endif
  347. #endif
  348. #ifdef _STDINT_HAVE_U_INT_TYPES
  349. #undef _STDINT_NEED_INT_MODEL_T
  350. #endif
  351. #ifdef _STDINT_CHAR_MODEL
  352. #if _STDINT_CHAR_MODEL+0 == 122 || _STDINT_CHAR_MODEL+0 == 124
  353. #ifndef _STDINT_BYTE_MODEL
  354. #define _STDINT_BYTE_MODEL 12
  355. #endif
  356. #endif
  357. #endif
  358. #ifndef _STDINT_HAVE_INT_LEAST32_T
  359. #define _STDINT_NEED_INT_LEAST_T
  360. #endif
  361. #ifndef _STDINT_HAVE_INT_FAST32_T
  362. #define _STDINT_NEED_INT_FAST_T
  363. #endif
  364. #ifndef _STDINT_HEADER_INTPTR
  365. #define _STDINT_NEED_INTPTR_T
  366. #ifndef _STDINT_HAVE_INTMAX_T
  367. #define _STDINT_NEED_INTMAX_T
  368. #endif
  369. #endif
  370. /* .................... definition part ............................ */
  371. /* some system headers have good uint64_t */
  372. #ifndef _HAVE_UINT64_T
  373. #if defined _STDINT_HAVE_UINT64_T || defined HAVE_UINT64_T
  374. #define _HAVE_UINT64_T
  375. #elif defined _STDINT_HAVE_U_INT64_T || defined HAVE_U_INT64_T
  376. #define _HAVE_UINT64_T
  377. typedef u_int64_t uint64_t;
  378. #endif
  379. #endif
  380. #ifndef _HAVE_UINT64_T
  381. /* .. here are some common heuristics using compiler runtime specifics */
  382. #if defined __STDC_VERSION__ && defined __STDC_VERSION__ >= 199901L
  383. #define _HAVE_UINT64_T
  384. #define _HAVE_LONGLONG_UINT64_T
  385. typedef long long int64_t;
  386. typedef unsigned long long uint64_t;
  387. #elif !defined __STRICT_ANSI__
  388. #if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__
  389. #define _HAVE_UINT64_T
  390. typedef __int64 int64_t;
  391. typedef unsigned __int64 uint64_t;
  392. #elif defined __GNUC__ || defined __MWERKS__ || defined __ELF__
  393. /* note: all ELF-systems seem to have loff-support which needs 64-bit */
  394. #if !defined _NO_LONGLONG
  395. #define _HAVE_UINT64_T
  396. #define _HAVE_LONGLONG_UINT64_T
  397. typedef long long int64_t;
  398. typedef unsigned long long uint64_t;
  399. #endif
  400. #elif defined __alpha || (defined __mips && defined _ABIN32)
  401. #if !defined _NO_LONGLONG
  402. typedef long int64_t;
  403. typedef unsigned long uint64_t;
  404. #endif
  405. /* compiler/cpu type to define int64_t */
  406. #endif
  407. #endif
  408. #endif
  409. #if defined _STDINT_HAVE_U_INT_TYPES
  410. /* int8_t int16_t int32_t defined by inet code, redeclare the u_intXX types */
  411. typedef u_int8_t uint8_t;
  412. typedef u_int16_t uint16_t;
  413. typedef u_int32_t uint32_t;
  414. /* glibc compatibility */
  415. #ifndef __int8_t_defined
  416. #define __int8_t_defined
  417. #endif
  418. #endif
  419. #ifdef _STDINT_NEED_INT_MODEL_T
  420. /* we must guess all the basic types. Apart from byte-addressable system, */
  421. /* there a few 32-bit-only dsp-systems that we guard with BYTE_MODEL 8-} */
  422. /* (btw, those nibble-addressable systems are way off, or so we assume) */
  423. dnl /* have a look at "64bit and data size neutrality" at */
  424. dnl /* http://unix.org/version2/whatsnew/login_64bit.html */
  425. dnl /* (the shorthand "ILP" types always have a "P" part) */
  426. #if defined _STDINT_BYTE_MODEL
  427. #if _STDINT_LONG_MODEL+0 == 242
  428. /* 2:4:2 = IP16 = a normal 16-bit system */
  429. typedef unsigned char uint8_t;
  430. typedef unsigned short uint16_t;
  431. typedef unsigned long uint32_t;
  432. #ifndef __int8_t_defined
  433. #define __int8_t_defined
  434. typedef char int8_t;
  435. typedef short int16_t;
  436. typedef long int32_t;
  437. #endif
  438. #elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL == 444
  439. /* 2:4:4 = LP32 = a 32-bit system derived from a 16-bit */
  440. /* 4:4:4 = ILP32 = a normal 32-bit system */
  441. typedef unsigned char uint8_t;
  442. typedef unsigned short uint16_t;
  443. typedef unsigned int uint32_t;
  444. #ifndef __int8_t_defined
  445. #define __int8_t_defined
  446. typedef char int8_t;
  447. typedef short int16_t;
  448. typedef int int32_t;
  449. #endif
  450. #elif _STDINT_LONG_MODEL+0 == 484 || _STDINT_LONG_MODEL+0 == 488
  451. /* 4:8:4 = IP32 = a 32-bit system prepared for 64-bit */
  452. /* 4:8:8 = LP64 = a normal 64-bit system */
  453. typedef unsigned char uint8_t;
  454. typedef unsigned short uint16_t;
  455. typedef unsigned int uint32_t;
  456. #ifndef __int8_t_defined
  457. #define __int8_t_defined
  458. typedef char int8_t;
  459. typedef short int16_t;
  460. typedef int int32_t;
  461. #endif
  462. /* this system has a "long" of 64bit */
  463. #ifndef _HAVE_UINT64_T
  464. #define _HAVE_UINT64_T
  465. typedef unsigned long uint64_t;
  466. typedef long int64_t;
  467. #endif
  468. #elif _STDINT_LONG_MODEL+0 == 448
  469. /* LLP64 a 64-bit system derived from a 32-bit system */
  470. typedef unsigned char uint8_t;
  471. typedef unsigned short uint16_t;
  472. typedef unsigned int uint32_t;
  473. #ifndef __int8_t_defined
  474. #define __int8_t_defined
  475. typedef char int8_t;
  476. typedef short int16_t;
  477. typedef int int32_t;
  478. #endif
  479. /* assuming the system has a "long long" */
  480. #ifndef _HAVE_UINT64_T
  481. #define _HAVE_UINT64_T
  482. #define _HAVE_LONGLONG_UINT64_T
  483. typedef unsigned long long uint64_t;
  484. typedef long long int64_t;
  485. #endif
  486. #else
  487. #define _STDINT_NO_INT32_T
  488. #endif
  489. #else
  490. #define _STDINT_NO_INT8_T
  491. #define _STDINT_NO_INT32_T
  492. #endif
  493. #endif
  494. /*
  495. * quote from SunOS-5.8 sys/inttypes.h:
  496. * Use at your own risk. As of February 1996, the committee is squarely
  497. * behind the fixed sized types; the "least" and "fast" types are still being
  498. * discussed. The probability that the "fast" types may be removed before
  499. * the standard is finalized is high enough that they are not currently
  500. * implemented.
  501. */
  502. #if defined _STDINT_NEED_INT_LEAST_T
  503. typedef int8_t int_least8_t;
  504. typedef int16_t int_least16_t;
  505. typedef int32_t int_least32_t;
  506. #ifdef _HAVE_UINT64_T
  507. typedef int64_t int_least64_t;
  508. #endif
  509. typedef uint8_t uint_least8_t;
  510. typedef uint16_t uint_least16_t;
  511. typedef uint32_t uint_least32_t;
  512. #ifdef _HAVE_UINT64_T
  513. typedef uint64_t uint_least64_t;
  514. #endif
  515. /* least types */
  516. #endif
  517. #if defined _STDINT_NEED_INT_FAST_T
  518. typedef int8_t int_fast8_t;
  519. typedef int int_fast16_t;
  520. typedef int32_t int_fast32_t;
  521. #ifdef _HAVE_UINT64_T
  522. typedef int64_t int_fast64_t;
  523. #endif
  524. typedef uint8_t uint_fast8_t;
  525. typedef unsigned uint_fast16_t;
  526. typedef uint32_t uint_fast32_t;
  527. #ifdef _HAVE_UINT64_T
  528. typedef uint64_t uint_fast64_t;
  529. #endif
  530. /* fast types */
  531. #endif
  532. #ifdef _STDINT_NEED_INTMAX_T
  533. #ifdef _HAVE_UINT64_T
  534. typedef int64_t intmax_t;
  535. typedef uint64_t uintmax_t;
  536. #else
  537. typedef long intmax_t;
  538. typedef unsigned long uintmax_t;
  539. #endif
  540. #endif
  541. #ifdef _STDINT_NEED_INTPTR_T
  542. #ifndef __intptr_t_defined
  543. #define __intptr_t_defined
  544. /* we encourage using "long" to store pointer values, never use "int" ! */
  545. #if _STDINT_LONG_MODEL+0 == 242 || _STDINT_LONG_MODEL+0 == 484
  546. typedef unsigned int uintptr_t;
  547. typedef int intptr_t;
  548. #elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL+0 == 444
  549. typedef unsigned long uintptr_t;
  550. typedef long intptr_t;
  551. #elif _STDINT_LONG_MODEL+0 == 448 && defined _HAVE_UINT64_T
  552. typedef uint64_t uintptr_t;
  553. typedef int64_t intptr_t;
  554. #else /* matches typical system types ILP32 and LP64 - but not IP16 or LLP64 */
  555. typedef unsigned long uintptr_t;
  556. typedef long intptr_t;
  557. #endif
  558. #endif
  559. #endif
  560. /* The ISO C99 standard specifies that in C++ implementations these
  561. should only be defined if explicitly requested. */
  562. #if !defined __cplusplus || defined __STDC_CONSTANT_MACROS
  563. #ifndef UINT32_C
  564. /* Signed. */
  565. # define INT8_C(c) c
  566. # define INT16_C(c) c
  567. # define INT32_C(c) c
  568. # ifdef _HAVE_LONGLONG_UINT64_T
  569. # define INT64_C(c) c ## L
  570. # else
  571. # define INT64_C(c) c ## LL
  572. # endif
  573. /* Unsigned. */
  574. # define UINT8_C(c) c ## U
  575. # define UINT16_C(c) c ## U
  576. # define UINT32_C(c) c ## U
  577. # ifdef _HAVE_LONGLONG_UINT64_T
  578. # define UINT64_C(c) c ## UL
  579. # else
  580. # define UINT64_C(c) c ## ULL
  581. # endif
  582. /* Maximal type. */
  583. # ifdef _HAVE_LONGLONG_UINT64_T
  584. # define INTMAX_C(c) c ## L
  585. # define UINTMAX_C(c) c ## UL
  586. # else
  587. # define INTMAX_C(c) c ## LL
  588. # define UINTMAX_C(c) c ## ULL
  589. # endif
  590. /* literalnumbers */
  591. #endif
  592. #endif
  593. /* These limits are merrily those of a two complement byte-oriented system */
  594. /* Minimum of signed integral types. */
  595. # define INT8_MIN (-128)
  596. # define INT16_MIN (-32767-1)
  597. # define INT32_MIN (-2147483647-1)
  598. # define INT64_MIN (-__INT64_C(9223372036854775807)-1)
  599. /* Maximum of signed integral types. */
  600. # define INT8_MAX (127)
  601. # define INT16_MAX (32767)
  602. # define INT32_MAX (2147483647)
  603. # define INT64_MAX (__INT64_C(9223372036854775807))
  604. /* Maximum of unsigned integral types. */
  605. # define UINT8_MAX (255)
  606. # define UINT16_MAX (65535)
  607. # define UINT32_MAX (4294967295U)
  608. # define UINT64_MAX (__UINT64_C(18446744073709551615))
  609. /* Minimum of signed integral types having a minimum size. */
  610. # define INT_LEAST8_MIN INT8_MIN
  611. # define INT_LEAST16_MIN INT16_MIN
  612. # define INT_LEAST32_MIN INT32_MIN
  613. # define INT_LEAST64_MIN INT64_MIN
  614. /* Maximum of signed integral types having a minimum size. */
  615. # define INT_LEAST8_MAX INT8_MAX
  616. # define INT_LEAST16_MAX INT16_MAX
  617. # define INT_LEAST32_MAX INT32_MAX
  618. # define INT_LEAST64_MAX INT64_MAX
  619. /* Maximum of unsigned integral types having a minimum size. */
  620. # define UINT_LEAST8_MAX UINT8_MAX
  621. # define UINT_LEAST16_MAX UINT16_MAX
  622. # define UINT_LEAST32_MAX UINT32_MAX
  623. # define UINT_LEAST64_MAX UINT64_MAX
  624. /* shortcircuit*/
  625. #endif
  626. /* once */
  627. #endif
  628. #endif
  629. STDINT_EOF
  630. fi
  631. if cmp -s $ac_stdint_h $ac_stdint 2>/dev/null; then
  632. AC_MSG_NOTICE([$ac_stdint_h is unchanged])
  633. else
  634. ac_dir=`AS_DIRNAME(["$ac_stdint_h"])`
  635. AS_MKDIR_P(["$ac_dir"])
  636. rm -f $ac_stdint_h
  637. mv $ac_stdint $ac_stdint_h
  638. fi
  639. ],[# variables for create stdint.h replacement
  640. PACKAGE="$PACKAGE"
  641. VERSION="$VERSION"
  642. ac_stdint_h="$ac_stdint_h"
  643. _ac_stdint_h=AS_TR_CPP(_$PACKAGE-$ac_stdint_h)
  644. ac_cv_stdint_message="$ac_cv_stdint_message"
  645. ac_cv_header_stdint_t="$ac_cv_header_stdint_t"
  646. ac_cv_header_stdint_x="$ac_cv_header_stdint_x"
  647. ac_cv_header_stdint_o="$ac_cv_header_stdint_o"
  648. ac_cv_header_stdint_u="$ac_cv_header_stdint_u"
  649. ac_cv_type_uint64_t="$ac_cv_type_uint64_t"
  650. ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t"
  651. ac_cv_char_data_model="$ac_cv_char_data_model"
  652. ac_cv_long_data_model="$ac_cv_long_data_model"
  653. ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t"
  654. ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t"
  655. ac_cv_type_intmax_t="$ac_cv_type_intmax_t"
  656. ])
  657. ])