Blame common/m4/ax_create_stdint_h.m4

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