Blame common/m4/ax_create_stdint_h.m4

Packit 971217
##### http://autoconf-archive.cryp.to/ax_create_stdint_h.html
Packit 971217
#
Packit 971217
# SYNOPSIS
Packit 971217
#
Packit 971217
#   AX_CREATE_STDINT_H [( HEADER-TO-GENERATE [, HEDERS-TO-CHECK])]
Packit 971217
#
Packit 971217
# DESCRIPTION
Packit 971217
#
Packit 971217
#   the "ISO C9X: 7.18 Integer types <stdint.h>" section requires the
Packit 971217
#   existence of an include file <stdint.h> that defines a set of
Packit 971217
#   typedefs, especially uint8_t,int32_t,uintptr_t. Many older
Packit 971217
#   installations will not provide this file, but some will have the
Packit 971217
#   very same definitions in <inttypes.h>. In other enviroments we can
Packit 971217
#   use the inet-types in <sys/types.h> which would define the typedefs
Packit 971217
#   int8_t and u_int8_t respectivly.
Packit 971217
#
Packit 971217
#   This macros will create a local "_stdint.h" or the headerfile given
Packit 971217
#   as an argument. In many cases that file will just "#include
Packit 971217
#   <stdint.h>" or "#include <inttypes.h>", while in other environments
Packit 971217
#   it will provide the set of basic 'stdint's definitions/typedefs:
Packit 971217
#
Packit 971217
#     int8_t,uint8_t,int16_t,uint16_t,int32_t,uint32_t,intptr_t,uintptr_t
Packit 971217
#     int_least32_t.. int_fast32_t.. intmax_t
Packit 971217
#
Packit 971217
#   which may or may not rely on the definitions of other files, or
Packit 971217
#   using the AC_CHECK_SIZEOF macro to determine the actual sizeof each
Packit 971217
#   type.
Packit 971217
#
Packit 971217
#   if your header files require the stdint-types you will want to
Packit 971217
#   create an installable file mylib-int.h that all your other
Packit 971217
#   installable header may include. So if you have a library package
Packit 971217
#   named "mylib", just use
Packit 971217
#
Packit 971217
#        AX_CREATE_STDINT_H(mylib-int.h)
Packit 971217
#
Packit 971217
#   in configure.ac and go to install that very header file in
Packit 971217
#   Makefile.am along with the other headers (mylib.h) - and the
Packit 971217
#   mylib-specific headers can simply use "#include <mylib-int.h>" to
Packit 971217
#   obtain the stdint-types.
Packit 971217
#
Packit 971217
#   Remember, if the system already had a valid <stdint.h>, the
Packit 971217
#   generated file will include it directly. No need for fuzzy
Packit 971217
#   HAVE_STDINT_H things... (oops, GCC 4.2.x has deliberatly disabled
Packit 971217
#   its stdint.h for non-c99 compilation and the c99-mode is not the
Packit 971217
#   default. Therefore this macro will not use the compiler's stdint.h
Packit 971217
#   - please complain to the GCC developers).
Packit 971217
#
Packit 971217
# LAST MODIFICATION
Packit 971217
#
Packit 971217
#   2007-06-27
Packit 971217
#
Packit 971217
# COPYLEFT
Packit 971217
#
Packit 971217
#   Copyright (c) 2007 Guido U. Draheim <guidod@gmx.de>
Packit 971217
#
Packit 971217
#   This program is free software; you can redistribute it and/or
Packit 971217
#   modify it under the terms of the GNU General Public License as
Packit 971217
#   published by the Free Software Foundation; either version 2 of the
Packit 971217
#   License, or (at your option) any later version.
Packit 971217
#
Packit 971217
#   This program is distributed in the hope that it will be useful, but
Packit 971217
#   WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 971217
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Packit 971217
#   General Public License for more details.
Packit 971217
#
Packit 971217
#   You should have received a copy of the GNU General Public License
Packit 971217
#   along with this program; if not, write to the Free Software
Packit 971217
#   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
Packit 971217
#   02111-1307, USA.
Packit 971217
#
Packit 971217
#   As a special exception, the respective Autoconf Macro's copyright
Packit 971217
#   owner gives unlimited permission to copy, distribute and modify the
Packit 971217
#   configure scripts that are the output of Autoconf when processing
Packit 971217
#   the Macro. You need not follow the terms of the GNU General Public
Packit 971217
#   License when using or distributing such scripts, even though
Packit 971217
#   portions of the text of the Macro appear in them. The GNU General
Packit 971217
#   Public License (GPL) does govern all other use of the material that
Packit 971217
#   constitutes the Autoconf Macro.
Packit 971217
#
Packit 971217
#   This special exception to the GPL applies to versions of the
Packit 971217
#   Autoconf Macro released by the Autoconf Macro Archive. When you
Packit 971217
#   make and distribute a modified version of the Autoconf Macro, you
Packit 971217
#   may extend this special exception to the GPL to apply to your
Packit 971217
#   modified version as well.
Packit 971217
Packit 971217
AC_DEFUN([AX_CHECK_DATA_MODEL],[
Packit 971217
   AC_CHECK_SIZEOF(char)
Packit 971217
   AC_CHECK_SIZEOF(short)
Packit 971217
   AC_CHECK_SIZEOF(int)
Packit 971217
   AC_CHECK_SIZEOF(long)
Packit 971217
   AC_CHECK_SIZEOF(void*)
Packit 971217
   ac_cv_char_data_model=""
Packit 971217
   ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_char"
Packit 971217
   ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_short"
Packit 971217
   ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_int"
Packit 971217
   ac_cv_long_data_model=""
Packit 971217
   ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_int"
Packit 971217
   ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_long"
Packit 971217
   ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_voidp"
Packit 971217
   AC_MSG_CHECKING([data model])
Packit 971217
   case "$ac_cv_char_data_model/$ac_cv_long_data_model" in
Packit 971217
    122/242)     ac_cv_data_model="IP16"  ; n="standard 16bit machine" ;;
Packit 971217
    122/244)     ac_cv_data_model="LP32"  ; n="standard 32bit machine" ;;
Packit 971217
    122/*)       ac_cv_data_model="i16"   ; n="unusual int16 model" ;;
Packit 971217
    124/444)     ac_cv_data_model="ILP32" ; n="standard 32bit unixish" ;;
Packit 971217
    124/488)     ac_cv_data_model="LP64"  ; n="standard 64bit unixish" ;;
Packit 971217
    124/448)     ac_cv_data_model="LLP64" ; n="unusual 64bit unixish" ;;
Packit 971217
    124/*)       ac_cv_data_model="i32"   ; n="unusual int32 model" ;;
Packit 971217
    128/888)     ac_cv_data_model="ILP64" ; n="unusual 64bit numeric" ;;
Packit 971217
    128/*)       ac_cv_data_model="i64"   ; n="unusual int64 model" ;;
Packit 971217
    222/*2)      ac_cv_data_model="DSP16" ; n="strict 16bit dsptype" ;;
Packit 971217
    333/*3)      ac_cv_data_model="DSP24" ; n="strict 24bit dsptype" ;;
Packit 971217
    444/*4)      ac_cv_data_model="DSP32" ; n="strict 32bit dsptype" ;;
Packit 971217
    666/*6)      ac_cv_data_model="DSP48" ; n="strict 48bit dsptype" ;;
Packit 971217
    888/*8)      ac_cv_data_model="DSP64" ; n="strict 64bit dsptype" ;;
Packit 971217
    222/*|333/*|444/*|666/*|888/*) :
Packit 971217
                 ac_cv_data_model="iDSP"  ; n="unusual dsptype" ;;
Packit 971217
     *)          ac_cv_data_model="none"  ; n="very unusual model" ;;
Packit 971217
   esac
Packit 971217
   AC_MSG_RESULT([$ac_cv_data_model ($ac_cv_long_data_model, $n)])
Packit 971217
])
Packit 971217
Packit 971217
dnl AX_CHECK_HEADER_STDINT_X([HEADERLIST][,ACTION-IF])
Packit 971217
AC_DEFUN([AX_CHECK_HEADER_STDINT_X],[
Packit 971217
AC_CACHE_CHECK([for stdint uintptr_t], [ac_cv_header_stdint_x],[
Packit 971217
 ac_cv_header_stdint_x="" # the 1997 typedefs (inttypes.h)
Packit 971217
  AC_MSG_RESULT([(..)])
Packit 971217
  for i in m4_ifval([$1],[$1],[stdint.h inttypes.h sys/inttypes.h sys/types.h])
Packit 971217
  do
Packit 971217
   unset ac_cv_type_uintptr_t
Packit 971217
   unset ac_cv_type_uint64_t
Packit 971217
   AC_CHECK_TYPE(uintptr_t,[ac_cv_header_stdint_x=$i],continue,[#include <$i>])
Packit 971217
   AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>])
Packit 971217
   m4_ifvaln([$2],[$2]) break
Packit 971217
  done
Packit 971217
  AC_MSG_CHECKING([for stdint uintptr_t])
Packit 971217
 ])
Packit 971217
])
Packit 971217
Packit 971217
AC_DEFUN([AX_CHECK_HEADER_STDINT_O],[
Packit 971217
AC_CACHE_CHECK([for stdint uint32_t], [ac_cv_header_stdint_o],[
Packit 971217
 ac_cv_header_stdint_o="" # the 1995 typedefs (sys/inttypes.h)
Packit 971217
  AC_MSG_RESULT([(..)])
Packit 971217
  for i in m4_ifval([$1],[$1],[inttypes.h sys/inttypes.h sys/types.h stdint.h])
Packit 971217
  do
Packit 971217
   unset ac_cv_type_uint32_t
Packit 971217
   unset ac_cv_type_uint64_t
Packit 971217
   AC_CHECK_TYPE(uint32_t,[ac_cv_header_stdint_o=$i],continue,[#include <$i>])
Packit 971217
   AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>])
Packit 971217
   m4_ifvaln([$2],[$2]) break
Packit 971217
   break;
Packit 971217
  done
Packit 971217
  AC_MSG_CHECKING([for stdint uint32_t])
Packit 971217
 ])
Packit 971217
])
Packit 971217
Packit 971217
AC_DEFUN([AX_CHECK_HEADER_STDINT_U],[
Packit 971217
AC_CACHE_CHECK([for stdint u_int32_t], [ac_cv_header_stdint_u],[
Packit 971217
 ac_cv_header_stdint_u="" # the BSD typedefs (sys/types.h)
Packit 971217
  AC_MSG_RESULT([(..)])
Packit 971217
  for i in m4_ifval([$1],[$1],[sys/types.h inttypes.h sys/inttypes.h]) ; do
Packit 971217
   unset ac_cv_type_u_int32_t
Packit 971217
   unset ac_cv_type_u_int64_t
Packit 971217
   AC_CHECK_TYPE(u_int32_t,[ac_cv_header_stdint_u=$i],continue,[#include <$i>])
Packit 971217
   AC_CHECK_TYPE(u_int64_t,[and64="/u_int64_t"],[and64=""],[#include<$i>])
Packit 971217
   m4_ifvaln([$2],[$2]) break
Packit 971217
   break;
Packit 971217
  done
Packit 971217
  AC_MSG_CHECKING([for stdint u_int32_t])
Packit 971217
 ])
Packit 971217
])
Packit 971217
Packit 971217
AC_DEFUN([AX_CREATE_STDINT_H],
Packit 971217
[# ------ AX CREATE STDINT H -------------------------------------
Packit 971217
AC_MSG_CHECKING([for stdint types])
Packit 971217
ac_stdint_h=`echo ifelse($1, , _stdint.h, $1)`
Packit 971217
# try to shortcircuit - if the default include path of the compiler
Packit 971217
# can find a "stdint.h" header then we assume that all compilers can.
Packit 971217
AC_CACHE_VAL([ac_cv_header_stdint_t],[
Packit 971217
old_CXXFLAGS="$CXXFLAGS" ; CXXFLAGS=""
Packit 971217
old_CPPFLAGS="$CPPFLAGS" ; CPPFLAGS=""
Packit 971217
old_CFLAGS="$CFLAGS"     ; CFLAGS=""
Packit 971217
AC_TRY_COMPILE([#include <stdint.h>],[int_least32_t v = 0;],
Packit 971217
[ac_cv_stdint_result="(assuming C99 compatible system)"
Packit 971217
 ac_cv_header_stdint_t="stdint.h"; ],
Packit 971217
[ac_cv_header_stdint_t=""])
Packit 971217
if test "$GCC" = "yes" && test ".$ac_cv_header_stdint_t" = "."; then
Packit 971217
CFLAGS="-std=c99"
Packit 971217
AC_TRY_COMPILE([#include <stdint.h>],[int_least32_t v = 0;],
Packit 971217
[AC_MSG_WARN(your GCC compiler has a defunct stdint.h for its default-mode)])
Packit 971217
fi
Packit 971217
CXXFLAGS="$old_CXXFLAGS"
Packit 971217
CPPFLAGS="$old_CPPFLAGS"
Packit 971217
CFLAGS="$old_CFLAGS" ])
Packit 971217
Packit 971217
v="... $ac_cv_header_stdint_h"
Packit 971217
if test "$ac_stdint_h" = "stdint.h" ; then
Packit 971217
 AC_MSG_RESULT([(are you sure you want them in ./stdint.h?)])
Packit 971217
elif test "$ac_stdint_h" = "inttypes.h" ; then
Packit 971217
 AC_MSG_RESULT([(are you sure you want them in ./inttypes.h?)])
Packit 971217
elif test "_$ac_cv_header_stdint_t" = "_" ; then
Packit 971217
 AC_MSG_RESULT([(putting them into $ac_stdint_h)$v])
Packit 971217
else
Packit 971217
 ac_cv_header_stdint="$ac_cv_header_stdint_t"
Packit 971217
 AC_MSG_RESULT([$ac_cv_header_stdint (shortcircuit)])
Packit 971217
fi
Packit 971217
Packit 971217
if test "_$ac_cv_header_stdint_t" = "_" ; then # can not shortcircuit..
Packit 971217
Packit 971217
dnl .....intro message done, now do a few system checks.....
Packit 971217
dnl btw, all old CHECK_TYPE macros do automatically "DEFINE" a type,
Packit 971217
dnl therefore we use the autoconf implementation detail CHECK_TYPE_NEW
Packit 971217
dnl instead that is triggered with 3 or more arguments (see types.m4)
Packit 971217
Packit 971217
inttype_headers=`echo $2 | sed -e 's/,/ /g'`
Packit 971217
Packit 971217
ac_cv_stdint_result="(no helpful system typedefs seen)"
Packit 971217
AX_CHECK_HEADER_STDINT_X(dnl
Packit 971217
   stdint.h inttypes.h sys/inttypes.h $inttype_headers,
Packit 971217
   ac_cv_stdint_result="(seen uintptr_t$and64 in $i)")
Packit 971217
Packit 971217
if test "_$ac_cv_header_stdint_x" = "_" ; then
Packit 971217
AX_CHECK_HEADER_STDINT_O(dnl,
Packit 971217
   inttypes.h sys/inttypes.h stdint.h $inttype_headers,
Packit 971217
   ac_cv_stdint_result="(seen uint32_t$and64 in $i)")
Packit 971217
fi
Packit 971217
Packit 971217
if test "_$ac_cv_header_stdint_x" = "_" ; then
Packit 971217
if test "_$ac_cv_header_stdint_o" = "_" ; then
Packit 971217
AX_CHECK_HEADER_STDINT_U(dnl,
Packit 971217
   sys/types.h inttypes.h sys/inttypes.h $inttype_headers,
Packit 971217
   ac_cv_stdint_result="(seen u_int32_t$and64 in $i)")
Packit 971217
fi fi
Packit 971217
Packit 971217
dnl if there was no good C99 header file, do some typedef checks...
Packit 971217
if test "_$ac_cv_header_stdint_x" = "_" ; then
Packit 971217
   AC_MSG_CHECKING([for stdint datatype model])
Packit 971217
   AC_MSG_RESULT([(..)])
Packit 971217
   AX_CHECK_DATA_MODEL
Packit 971217
fi
Packit 971217
Packit 971217
if test "_$ac_cv_header_stdint_x" != "_" ; then
Packit 971217
   ac_cv_header_stdint="$ac_cv_header_stdint_x"
Packit 971217
elif  test "_$ac_cv_header_stdint_o" != "_" ; then
Packit 971217
   ac_cv_header_stdint="$ac_cv_header_stdint_o"
Packit 971217
elif  test "_$ac_cv_header_stdint_u" != "_" ; then
Packit 971217
   ac_cv_header_stdint="$ac_cv_header_stdint_u"
Packit 971217
else
Packit 971217
   ac_cv_header_stdint="stddef.h"
Packit 971217
fi
Packit 971217
Packit 971217
AC_MSG_CHECKING([for extra inttypes in chosen header])
Packit 971217
AC_MSG_RESULT([($ac_cv_header_stdint)])
Packit 971217
dnl see if int_least and int_fast types are present in _this_ header.
Packit 971217
unset ac_cv_type_int_least32_t
Packit 971217
unset ac_cv_type_int_fast32_t
Packit 971217
AC_CHECK_TYPE(int_least32_t,,,[#include <$ac_cv_header_stdint>])
Packit 971217
AC_CHECK_TYPE(int_fast32_t,,,[#include<$ac_cv_header_stdint>])
Packit 971217
AC_CHECK_TYPE(intmax_t,,,[#include <$ac_cv_header_stdint>])
Packit 971217
Packit 971217
fi # shortcircut to system "stdint.h"
Packit 971217
# ------------------ PREPARE VARIABLES ------------------------------
Packit 971217
if test "$GCC" = "yes" ; then
Packit 971217
ac_cv_stdint_message="using gnu compiler "`$CC --version | head -1`
Packit 971217
else
Packit 971217
ac_cv_stdint_message="using $CC"
Packit 971217
fi
Packit 971217
Packit 971217
AC_MSG_RESULT([make use of $ac_cv_header_stdint in $ac_stdint_h dnl
Packit 971217
$ac_cv_stdint_result])
Packit 971217
Packit 971217
dnl -----------------------------------------------------------------
Packit 971217
# ----------------- DONE inttypes.h checks START header -------------
Packit 971217
AC_CONFIG_COMMANDS([$ac_stdint_h],[
Packit 971217
AC_MSG_NOTICE(creating $ac_stdint_h : $_ac_stdint_h)
Packit 971217
ac_stdint=$tmp/_stdint.h
Packit 971217
Packit 971217
echo "#ifndef" $_ac_stdint_h >$ac_stdint
Packit 971217
echo "#define" $_ac_stdint_h "1" >>$ac_stdint
Packit 971217
echo "#ifndef" _GENERATED_STDINT_H >>$ac_stdint
Packit 971217
echo "#define" _GENERATED_STDINT_H '"'$PACKAGE $VERSION'"' >>$ac_stdint
Packit 971217
echo "/* generated $ac_cv_stdint_message */" >>$ac_stdint
Packit 971217
if test "_$ac_cv_header_stdint_t" != "_" ; then
Packit 971217
echo "#define _STDINT_HAVE_STDINT_H" "1" >>$ac_stdint
Packit 971217
echo "#include <stdint.h>" >>$ac_stdint
Packit 971217
echo "#endif" >>$ac_stdint
Packit 971217
echo "#endif" >>$ac_stdint
Packit 971217
else
Packit 971217
Packit 971217
cat >>$ac_stdint <
Packit 971217
Packit 971217
/* ................... shortcircuit part ........................... */
Packit 971217
Packit 971217
#if defined HAVE_STDINT_H || defined _STDINT_HAVE_STDINT_H
Packit 971217
#include <stdint.h>
Packit 971217
#else
Packit 971217
#include <stddef.h>
Packit 971217
Packit 971217
/* .................... configured part ............................ */
Packit 971217
Packit 971217
STDINT_EOF
Packit 971217
Packit 971217
echo "/* whether we have a C99 compatible stdint header file */" >>$ac_stdint
Packit 971217
if test "_$ac_cv_header_stdint_x" != "_" ; then
Packit 971217
  ac_header="$ac_cv_header_stdint_x"
Packit 971217
  echo "#define _STDINT_HEADER_INTPTR" '"'"$ac_header"'"' >>$ac_stdint
Packit 971217
else
Packit 971217
  echo "/* #undef _STDINT_HEADER_INTPTR */" >>$ac_stdint
Packit 971217
fi
Packit 971217
Packit 971217
echo "/* whether we have a C96 compatible inttypes header file */" >>$ac_stdint
Packit 971217
if  test "_$ac_cv_header_stdint_o" != "_" ; then
Packit 971217
  ac_header="$ac_cv_header_stdint_o"
Packit 971217
  echo "#define _STDINT_HEADER_UINT32" '"'"$ac_header"'"' >>$ac_stdint
Packit 971217
else
Packit 971217
  echo "/* #undef _STDINT_HEADER_UINT32 */" >>$ac_stdint
Packit 971217
fi
Packit 971217
Packit 971217
echo "/* whether we have a BSD compatible inet types header */" >>$ac_stdint
Packit 971217
if  test "_$ac_cv_header_stdint_u" != "_" ; then
Packit 971217
  ac_header="$ac_cv_header_stdint_u"
Packit 971217
  echo "#define _STDINT_HEADER_U_INT32" '"'"$ac_header"'"' >>$ac_stdint
Packit 971217
else
Packit 971217
  echo "/* #undef _STDINT_HEADER_U_INT32 */" >>$ac_stdint
Packit 971217
fi
Packit 971217
Packit 971217
echo "" >>$ac_stdint
Packit 971217
Packit 971217
if test "_$ac_header" != "_" ; then if test "$ac_header" != "stddef.h" ; then
Packit 971217
  echo "#include <$ac_header>" >>$ac_stdint
Packit 971217
  echo "" >>$ac_stdint
Packit 971217
fi fi
Packit 971217
Packit 971217
echo "/* which 64bit typedef has been found */" >>$ac_stdint
Packit 971217
if test "$ac_cv_type_uint64_t" = "yes" ; then
Packit 971217
echo "#define   _STDINT_HAVE_UINT64_T" "1"  >>$ac_stdint
Packit 971217
else
Packit 971217
echo "/* #undef _STDINT_HAVE_UINT64_T */" >>$ac_stdint
Packit 971217
fi
Packit 971217
if test "$ac_cv_type_u_int64_t" = "yes" ; then
Packit 971217
echo "#define   _STDINT_HAVE_U_INT64_T" "1"  >>$ac_stdint
Packit 971217
else
Packit 971217
echo "/* #undef _STDINT_HAVE_U_INT64_T */" >>$ac_stdint
Packit 971217
fi
Packit 971217
echo "" >>$ac_stdint
Packit 971217
Packit 971217
echo "/* which type model has been detected */" >>$ac_stdint
Packit 971217
if test "_$ac_cv_char_data_model" != "_" ; then
Packit 971217
echo "#define   _STDINT_CHAR_MODEL" "$ac_cv_char_data_model" >>$ac_stdint
Packit 971217
echo "#define   _STDINT_LONG_MODEL" "$ac_cv_long_data_model" >>$ac_stdint
Packit 971217
else
Packit 971217
echo "/* #undef _STDINT_CHAR_MODEL // skipped */" >>$ac_stdint
Packit 971217
echo "/* #undef _STDINT_LONG_MODEL // skipped */" >>$ac_stdint
Packit 971217
fi
Packit 971217
echo "" >>$ac_stdint
Packit 971217
Packit 971217
echo "/* whether int_least types were detected */" >>$ac_stdint
Packit 971217
if test "$ac_cv_type_int_least32_t" = "yes"; then
Packit 971217
echo "#define   _STDINT_HAVE_INT_LEAST32_T" "1"  >>$ac_stdint
Packit 971217
else
Packit 971217
echo "/* #undef _STDINT_HAVE_INT_LEAST32_T */" >>$ac_stdint
Packit 971217
fi
Packit 971217
echo "/* whether int_fast types were detected */" >>$ac_stdint
Packit 971217
if test "$ac_cv_type_int_fast32_t" = "yes"; then
Packit 971217
echo "#define   _STDINT_HAVE_INT_FAST32_T" "1" >>$ac_stdint
Packit 971217
else
Packit 971217
echo "/* #undef _STDINT_HAVE_INT_FAST32_T */" >>$ac_stdint
Packit 971217
fi
Packit 971217
echo "/* whether intmax_t type was detected */" >>$ac_stdint
Packit 971217
if test "$ac_cv_type_intmax_t" = "yes"; then
Packit 971217
echo "#define   _STDINT_HAVE_INTMAX_T" "1" >>$ac_stdint
Packit 971217
else
Packit 971217
echo "/* #undef _STDINT_HAVE_INTMAX_T */" >>$ac_stdint
Packit 971217
fi
Packit 971217
echo "" >>$ac_stdint
Packit 971217
Packit 971217
  cat >>$ac_stdint <
Packit 971217
/* .................... detections part ............................ */
Packit 971217
Packit 971217
/* whether we need to define bitspecific types from compiler base types */
Packit 971217
#ifndef _STDINT_HEADER_INTPTR
Packit 971217
#ifndef _STDINT_HEADER_UINT32
Packit 971217
#ifndef _STDINT_HEADER_U_INT32
Packit 971217
#define _STDINT_NEED_INT_MODEL_T
Packit 971217
#else
Packit 971217
#define _STDINT_HAVE_U_INT_TYPES
Packit 971217
#endif
Packit 971217
#endif
Packit 971217
#endif
Packit 971217
Packit 971217
#ifdef _STDINT_HAVE_U_INT_TYPES
Packit 971217
#undef _STDINT_NEED_INT_MODEL_T
Packit 971217
#endif
Packit 971217
Packit 971217
#ifdef  _STDINT_CHAR_MODEL
Packit 971217
#if     _STDINT_CHAR_MODEL+0 == 122 || _STDINT_CHAR_MODEL+0 == 124
Packit 971217
#ifndef _STDINT_BYTE_MODEL
Packit 971217
#define _STDINT_BYTE_MODEL 12
Packit 971217
#endif
Packit 971217
#endif
Packit 971217
#endif
Packit 971217
Packit 971217
#ifndef _STDINT_HAVE_INT_LEAST32_T
Packit 971217
#define _STDINT_NEED_INT_LEAST_T
Packit 971217
#endif
Packit 971217
Packit 971217
#ifndef _STDINT_HAVE_INT_FAST32_T
Packit 971217
#define _STDINT_NEED_INT_FAST_T
Packit 971217
#endif
Packit 971217
Packit 971217
#ifndef _STDINT_HEADER_INTPTR
Packit 971217
#define _STDINT_NEED_INTPTR_T
Packit 971217
#ifndef _STDINT_HAVE_INTMAX_T
Packit 971217
#define _STDINT_NEED_INTMAX_T
Packit 971217
#endif
Packit 971217
#endif
Packit 971217
Packit 971217
Packit 971217
/* .................... definition part ............................ */
Packit 971217
Packit 971217
/* some system headers have good uint64_t */
Packit 971217
#ifndef _HAVE_UINT64_T
Packit 971217
#if     defined _STDINT_HAVE_UINT64_T  || defined HAVE_UINT64_T
Packit 971217
#define _HAVE_UINT64_T
Packit 971217
#elif   defined _STDINT_HAVE_U_INT64_T || defined HAVE_U_INT64_T
Packit 971217
#define _HAVE_UINT64_T
Packit 971217
typedef u_int64_t uint64_t;
Packit 971217
#endif
Packit 971217
#endif
Packit 971217
Packit 971217
#ifndef _HAVE_UINT64_T
Packit 971217
/* .. here are some common heuristics using compiler runtime specifics */
Packit 971217
#if defined __STDC_VERSION__ && defined __STDC_VERSION__ >= 199901L
Packit 971217
#define _HAVE_UINT64_T
Packit 971217
#define _HAVE_LONGLONG_UINT64_T
Packit 971217
typedef long long int64_t;
Packit 971217
typedef unsigned long long uint64_t;
Packit 971217
Packit 971217
#elif !defined __STRICT_ANSI__
Packit 971217
#if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__
Packit 971217
#define _HAVE_UINT64_T
Packit 971217
typedef __int64 int64_t;
Packit 971217
typedef unsigned __int64 uint64_t;
Packit 971217
Packit 971217
#elif defined __GNUC__ || defined __MWERKS__ || defined __ELF__
Packit 971217
/* note: all ELF-systems seem to have loff-support which needs 64-bit */
Packit 971217
#if !defined _NO_LONGLONG
Packit 971217
#define _HAVE_UINT64_T
Packit 971217
#define _HAVE_LONGLONG_UINT64_T
Packit 971217
typedef long long int64_t;
Packit 971217
typedef unsigned long long uint64_t;
Packit 971217
#endif
Packit 971217
Packit 971217
#elif defined __alpha || (defined __mips && defined _ABIN32)
Packit 971217
#if !defined _NO_LONGLONG
Packit 971217
typedef long int64_t;
Packit 971217
typedef unsigned long uint64_t;
Packit 971217
#endif
Packit 971217
  /* compiler/cpu type to define int64_t */
Packit 971217
#endif
Packit 971217
#endif
Packit 971217
#endif
Packit 971217
Packit 971217
#if defined _STDINT_HAVE_U_INT_TYPES
Packit 971217
/* int8_t int16_t int32_t defined by inet code, redeclare the u_intXX types */
Packit 971217
typedef u_int8_t uint8_t;
Packit 971217
typedef u_int16_t uint16_t;
Packit 971217
typedef u_int32_t uint32_t;
Packit 971217
Packit 971217
/* glibc compatibility */
Packit 971217
#ifndef __int8_t_defined
Packit 971217
#define __int8_t_defined
Packit 971217
#endif
Packit 971217
#endif
Packit 971217
Packit 971217
#ifdef _STDINT_NEED_INT_MODEL_T
Packit 971217
/* we must guess all the basic types. Apart from byte-adressable system, */
Packit 971217
/* there a few 32-bit-only dsp-systems that we guard with BYTE_MODEL 8-} */
Packit 971217
/* (btw, those nibble-addressable systems are way off, or so we assume) */
Packit 971217
Packit 971217
dnl   /* have a look at "64bit and data size neutrality" at */
Packit 971217
dnl   /* http://unix.org/version2/whatsnew/login_64bit.html */
Packit 971217
dnl   /* (the shorthand "ILP" types always have a "P" part) */
Packit 971217
Packit 971217
#if defined _STDINT_BYTE_MODEL
Packit 971217
#if _STDINT_LONG_MODEL+0 == 242
Packit 971217
/* 2:4:2 =  IP16 = a normal 16-bit system                */
Packit 971217
typedef unsigned char   uint8_t;
Packit 971217
typedef unsigned short  uint16_t;
Packit 971217
typedef unsigned long   uint32_t;
Packit 971217
#ifndef __int8_t_defined
Packit 971217
#define __int8_t_defined
Packit 971217
typedef          char    int8_t;
Packit 971217
typedef          short   int16_t;
Packit 971217
typedef          long    int32_t;
Packit 971217
#endif
Packit 971217
#elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL == 444
Packit 971217
/* 2:4:4 =  LP32 = a 32-bit system derived from a 16-bit */
Packit 971217
/* 4:4:4 = ILP32 = a normal 32-bit system                */
Packit 971217
typedef unsigned char   uint8_t;
Packit 971217
typedef unsigned short  uint16_t;
Packit 971217
typedef unsigned int    uint32_t;
Packit 971217
#ifndef __int8_t_defined
Packit 971217
#define __int8_t_defined
Packit 971217
typedef          char    int8_t;
Packit 971217
typedef          short   int16_t;
Packit 971217
typedef          int     int32_t;
Packit 971217
#endif
Packit 971217
#elif _STDINT_LONG_MODEL+0 == 484 || _STDINT_LONG_MODEL+0 == 488
Packit 971217
/* 4:8:4 =  IP32 = a 32-bit system prepared for 64-bit    */
Packit 971217
/* 4:8:8 =  LP64 = a normal 64-bit system                 */
Packit 971217
typedef unsigned char   uint8_t;
Packit 971217
typedef unsigned short  uint16_t;
Packit 971217
typedef unsigned int    uint32_t;
Packit 971217
#ifndef __int8_t_defined
Packit 971217
#define __int8_t_defined
Packit 971217
typedef          char    int8_t;
Packit 971217
typedef          short   int16_t;
Packit 971217
typedef          int     int32_t;
Packit 971217
#endif
Packit 971217
/* this system has a "long" of 64bit */
Packit 971217
#ifndef _HAVE_UINT64_T
Packit 971217
#define _HAVE_UINT64_T
Packit 971217
typedef unsigned long   uint64_t;
Packit 971217
typedef          long    int64_t;
Packit 971217
#endif
Packit 971217
#elif _STDINT_LONG_MODEL+0 == 448
Packit 971217
/*      LLP64   a 64-bit system derived from a 32-bit system */
Packit 971217
typedef unsigned char   uint8_t;
Packit 971217
typedef unsigned short  uint16_t;
Packit 971217
typedef unsigned int    uint32_t;
Packit 971217
#ifndef __int8_t_defined
Packit 971217
#define __int8_t_defined
Packit 971217
typedef          char    int8_t;
Packit 971217
typedef          short   int16_t;
Packit 971217
typedef          int     int32_t;
Packit 971217
#endif
Packit 971217
/* assuming the system has a "long long" */
Packit 971217
#ifndef _HAVE_UINT64_T
Packit 971217
#define _HAVE_UINT64_T
Packit 971217
#define _HAVE_LONGLONG_UINT64_T
Packit 971217
typedef unsigned long long uint64_t;
Packit 971217
typedef          long long  int64_t;
Packit 971217
#endif
Packit 971217
#else
Packit 971217
#define _STDINT_NO_INT32_T
Packit 971217
#endif
Packit 971217
#else
Packit 971217
#define _STDINT_NO_INT8_T
Packit 971217
#define _STDINT_NO_INT32_T
Packit 971217
#endif
Packit 971217
#endif
Packit 971217
Packit 971217
/*
Packit 971217
 * quote from SunOS-5.8 sys/inttypes.h:
Packit 971217
 * Use at your own risk.  As of February 1996, the committee is squarely
Packit 971217
 * behind the fixed sized types; the "least" and "fast" types are still being
Packit 971217
 * discussed.  The probability that the "fast" types may be removed before
Packit 971217
 * the standard is finalized is high enough that they are not currently
Packit 971217
 * implemented.
Packit 971217
 */
Packit 971217
Packit 971217
#if defined _STDINT_NEED_INT_LEAST_T
Packit 971217
typedef  int8_t    int_least8_t;
Packit 971217
typedef  int16_t   int_least16_t;
Packit 971217
typedef  int32_t   int_least32_t;
Packit 971217
#ifdef _HAVE_UINT64_T
Packit 971217
typedef  int64_t   int_least64_t;
Packit 971217
#endif
Packit 971217
Packit 971217
typedef uint8_t   uint_least8_t;
Packit 971217
typedef uint16_t  uint_least16_t;
Packit 971217
typedef uint32_t  uint_least32_t;
Packit 971217
#ifdef _HAVE_UINT64_T
Packit 971217
typedef uint64_t  uint_least64_t;
Packit 971217
#endif
Packit 971217
  /* least types */
Packit 971217
#endif
Packit 971217
Packit 971217
#if defined _STDINT_NEED_INT_FAST_T
Packit 971217
typedef  int8_t    int_fast8_t;
Packit 971217
typedef  int       int_fast16_t;
Packit 971217
typedef  int32_t   int_fast32_t;
Packit 971217
#ifdef _HAVE_UINT64_T
Packit 971217
typedef  int64_t   int_fast64_t;
Packit 971217
#endif
Packit 971217
Packit 971217
typedef uint8_t   uint_fast8_t;
Packit 971217
typedef unsigned  uint_fast16_t;
Packit 971217
typedef uint32_t  uint_fast32_t;
Packit 971217
#ifdef _HAVE_UINT64_T
Packit 971217
typedef uint64_t  uint_fast64_t;
Packit 971217
#endif
Packit 971217
  /* fast types */
Packit 971217
#endif
Packit 971217
Packit 971217
#ifdef _STDINT_NEED_INTMAX_T
Packit 971217
#ifdef _HAVE_UINT64_T
Packit 971217
typedef  int64_t       intmax_t;
Packit 971217
typedef uint64_t      uintmax_t;
Packit 971217
#else
Packit 971217
typedef          long  intmax_t;
Packit 971217
typedef unsigned long uintmax_t;
Packit 971217
#endif
Packit 971217
#endif
Packit 971217
Packit 971217
#ifdef _STDINT_NEED_INTPTR_T
Packit 971217
#ifndef __intptr_t_defined
Packit 971217
#define __intptr_t_defined
Packit 971217
/* we encourage using "long" to store pointer values, never use "int" ! */
Packit 971217
#if   _STDINT_LONG_MODEL+0 == 242 || _STDINT_LONG_MODEL+0 == 484
Packit 971217
typedef  unsigned int   uintptr_t;
Packit 971217
typedef           int    intptr_t;
Packit 971217
#elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL+0 == 444
Packit 971217
typedef  unsigned long  uintptr_t;
Packit 971217
typedef           long   intptr_t;
Packit 971217
#elif _STDINT_LONG_MODEL+0 == 448 && defined _HAVE_UINT64_T
Packit 971217
typedef        uint64_t uintptr_t;
Packit 971217
typedef         int64_t  intptr_t;
Packit 971217
#else /* matches typical system types ILP32 and LP64 - but not IP16 or LLP64 */
Packit 971217
typedef  unsigned long  uintptr_t;
Packit 971217
typedef           long   intptr_t;
Packit 971217
#endif
Packit 971217
#endif
Packit 971217
#endif
Packit 971217
Packit 971217
/* The ISO C99 standard specifies that in C++ implementations these
Packit 971217
   should only be defined if explicitly requested.  */
Packit 971217
#if !defined __cplusplus || defined __STDC_CONSTANT_MACROS
Packit 971217
#ifndef UINT32_C
Packit 971217
Packit 971217
/* Signed.  */
Packit 971217
# define INT8_C(c)      c
Packit 971217
# define INT16_C(c)     c
Packit 971217
# define INT32_C(c)     c
Packit 971217
# ifdef _HAVE_LONGLONG_UINT64_T
Packit 971217
#  define INT64_C(c)    c ## L
Packit 971217
# else
Packit 971217
#  define INT64_C(c)    c ## LL
Packit 971217
# endif
Packit 971217
Packit 971217
/* Unsigned.  */
Packit 971217
# define UINT8_C(c)     c ## U
Packit 971217
# define UINT16_C(c)    c ## U
Packit 971217
# define UINT32_C(c)    c ## U
Packit 971217
# ifdef _HAVE_LONGLONG_UINT64_T
Packit 971217
#  define UINT64_C(c)   c ## UL
Packit 971217
# else
Packit 971217
#  define UINT64_C(c)   c ## ULL
Packit 971217
# endif
Packit 971217
Packit 971217
/* Maximal type.  */
Packit 971217
# ifdef _HAVE_LONGLONG_UINT64_T
Packit 971217
#  define INTMAX_C(c)   c ## L
Packit 971217
#  define UINTMAX_C(c)  c ## UL
Packit 971217
# else
Packit 971217
#  define INTMAX_C(c)   c ## LL
Packit 971217
#  define UINTMAX_C(c)  c ## ULL
Packit 971217
# endif
Packit 971217
Packit 971217
  /* literalnumbers */
Packit 971217
#endif
Packit 971217
#endif
Packit 971217
Packit 971217
/* These limits are merily those of a two complement byte-oriented system */
Packit 971217
Packit 971217
/* Minimum of signed integral types.  */
Packit 971217
# define INT8_MIN               (-128)
Packit 971217
# define INT16_MIN              (-32767-1)
Packit 971217
# define INT32_MIN              (-2147483647-1)
Packit 971217
# define INT64_MIN              (-__INT64_C(9223372036854775807)-1)
Packit 971217
/* Maximum of signed integral types.  */
Packit 971217
# define INT8_MAX               (127)
Packit 971217
# define INT16_MAX              (32767)
Packit 971217
# define INT32_MAX              (2147483647)
Packit 971217
# define INT64_MAX              (__INT64_C(9223372036854775807))
Packit 971217
Packit 971217
/* Maximum of unsigned integral types.  */
Packit 971217
# define UINT8_MAX              (255)
Packit 971217
# define UINT16_MAX             (65535)
Packit 971217
# define UINT32_MAX             (4294967295U)
Packit 971217
# define UINT64_MAX             (__UINT64_C(18446744073709551615))
Packit 971217
Packit 971217
/* Minimum of signed integral types having a minimum size.  */
Packit 971217
# define INT_LEAST8_MIN         INT8_MIN
Packit 971217
# define INT_LEAST16_MIN        INT16_MIN
Packit 971217
# define INT_LEAST32_MIN        INT32_MIN
Packit 971217
# define INT_LEAST64_MIN        INT64_MIN
Packit 971217
/* Maximum of signed integral types having a minimum size.  */
Packit 971217
# define INT_LEAST8_MAX         INT8_MAX
Packit 971217
# define INT_LEAST16_MAX        INT16_MAX
Packit 971217
# define INT_LEAST32_MAX        INT32_MAX
Packit 971217
# define INT_LEAST64_MAX        INT64_MAX
Packit 971217
Packit 971217
/* Maximum of unsigned integral types having a minimum size.  */
Packit 971217
# define UINT_LEAST8_MAX        UINT8_MAX
Packit 971217
# define UINT_LEAST16_MAX       UINT16_MAX
Packit 971217
# define UINT_LEAST32_MAX       UINT32_MAX
Packit 971217
# define UINT_LEAST64_MAX       UINT64_MAX
Packit 971217
Packit 971217
  /* shortcircuit*/
Packit 971217
#endif
Packit 971217
  /* once */
Packit 971217
#endif
Packit 971217
#endif
Packit 971217
STDINT_EOF
Packit 971217
fi
Packit 971217
    if cmp -s $ac_stdint_h $ac_stdint 2>/dev/null; then
Packit 971217
      AC_MSG_NOTICE([$ac_stdint_h is unchanged])
Packit 971217
    else
Packit 971217
      ac_dir=`AS_DIRNAME(["$ac_stdint_h"])`
Packit 971217
      AS_MKDIR_P(["$ac_dir"])
Packit 971217
      rm -f $ac_stdint_h
Packit 971217
      mv $ac_stdint $ac_stdint_h
Packit 971217
    fi
Packit 971217
],[# variables for create stdint.h replacement
Packit 971217
PACKAGE="$PACKAGE"
Packit 971217
VERSION="$VERSION"
Packit 971217
ac_stdint_h="$ac_stdint_h"
Packit 971217
_ac_stdint_h=AS_TR_CPP(_$PACKAGE-$ac_stdint_h)
Packit 971217
ac_cv_stdint_message="$ac_cv_stdint_message"
Packit 971217
ac_cv_header_stdint_t="$ac_cv_header_stdint_t"
Packit 971217
ac_cv_header_stdint_x="$ac_cv_header_stdint_x"
Packit 971217
ac_cv_header_stdint_o="$ac_cv_header_stdint_o"
Packit 971217
ac_cv_header_stdint_u="$ac_cv_header_stdint_u"
Packit 971217
ac_cv_type_uint64_t="$ac_cv_type_uint64_t"
Packit 971217
ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t"
Packit 971217
ac_cv_char_data_model="$ac_cv_char_data_model"
Packit 971217
ac_cv_long_data_model="$ac_cv_long_data_model"
Packit 971217
ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t"
Packit 971217
ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t"
Packit 971217
ac_cv_type_intmax_t="$ac_cv_type_intmax_t"
Packit 971217
])
Packit 971217
])