1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-24 12:20:20 +02:00

Start to use C99 stdint in gen-scmconfig

* configure.ac: Remove checks for stdint.h; we require C99 so it must be
  there; and in any case for our purposes we use gnulib, so it will be
  there.  No need to check for inttypes.h.  No need to check for what
  type maps to e.g. uint32_t either.
* libguile/deprecated.h (SCM_HAVE_T_INT64, SCM_HAVE_T_UINT64): Deprecate
  these, as they are always 1.
  (SCM_HAVE_ARRAYS): Likewise deprecate; it's always 1.
* libguile/gen-scmconfig.c: Always include stdint.h and stddef.h, and
  make it so that scmconfig.h also includes these.  Use C99 types.
* libguile/gen-scmconfig.h.in: Remove configure-substed vars that are no
  longer defined.
This commit is contained in:
Andy Wingo 2018-06-21 07:58:54 +02:00
parent 1234bb1850
commit 5e5afde06f
4 changed files with 37 additions and 385 deletions

View file

@ -321,313 +321,8 @@ else
fi
AC_SUBST([SCM_I_GSC_T_PTRDIFF])
AC_CHECK_HEADERS([stdint.h])
AC_CHECK_HEADERS([inttypes.h])
AC_CHECK_HEADERS([stdatomic.h])
AC_CHECK_SIZEOF(intmax_t)
SCM_I_GSC_NEEDS_STDINT_H=0
SCM_I_GSC_NEEDS_INTTYPES_H=0
### intptr and uintptr (try not to use inttypes if we don't have to)
if test "$ac_cv_header_inttypes_h" = yes; then
if test "$ac_cv_sizeof_intptr_t" -eq 0; then
AC_CHECK_SIZEOF([intptr_t],,[#include <inttypes.h>
#include <stdio.h>])
if test "$ac_cv_sizeof_intptr_t" -ne 0; then
SCM_I_GSC_NEEDS_INTTYPES_H=1
fi
fi
if test "$ac_cv_sizeof_uintptr_t" -eq 0; then
AC_CHECK_SIZEOF([uintptr_t],,[#include <inttypes.h>
#include <stdio.h>])
if test "$ac_cv_sizeof_uintptr_t" -ne 0; then
SCM_I_GSC_NEEDS_INTTYPES_H=1
fi
fi
fi
### See what's provided by stdint.h
if test "$ac_cv_header_stdint_h" = yes; then
AC_CHECK_TYPE([int8_t],[scm_stdint_has_int8=1],,[#include <stdint.h>])
AC_CHECK_TYPE([uint8_t],[scm_stdint_has_uint8=1],,[#include <stdint.h>])
AC_CHECK_TYPE([int16_t],[scm_stdint_has_int16=1],,[#include <stdint.h>])
AC_CHECK_TYPE([uint16_t],[scm_stdint_has_uint16=1],,[#include <stdint.h>])
AC_CHECK_TYPE([int32_t],[scm_stdint_has_int32=1],,[#include <stdint.h>])
AC_CHECK_TYPE([uint32_t],[scm_stdint_has_uint32=1],,[#include <stdint.h>])
AC_CHECK_TYPE([int64_t],[scm_stdint_has_int64=1],,[#include <stdint.h>])
AC_CHECK_TYPE([uint64_t],[scm_stdint_has_uint64=1],,[#include <stdint.h>])
AC_CHECK_TYPE([intmax_t],[scm_stdint_has_intmax=1],,[#include <stdint.h>])
AC_CHECK_TYPE([uintmax_t],[scm_stdint_has_uintmax=1],,[#include <stdint.h>])
AC_CHECK_TYPE([intptr_t],[scm_stdint_has_intptr=1],,[#include <stdint.h>])
AC_CHECK_TYPE([uintptr_t],[scm_stdint_has_uintptr=1],,[#include <stdint.h>])
fi
# so we don't get confused by the cache (wish there was a better way
# to check particular headers for the same type...)
unset ac_cv_type_int8_t
unset ac_cv_type_uint8_t
unset ac_cv_type_int16_t
unset ac_cv_type_uint16_t
unset ac_cv_type_int32_t
unset ac_cv_type_uint32_t
unset ac_cv_type_int64_t
unset ac_cv_type_uint64_t
unset ac_cv_type_intmax_t
unset ac_cv_type_uintmax_t
### See what's provided by inttypes.h
if test "$ac_cv_header_inttypes_h" = yes; then
AC_CHECK_TYPE([int8_t],[scm_inttypes_has_int8=1],,[#include <inttypes.h>])
AC_CHECK_TYPE([uint8_t],[scm_inttypes_has_uint8=1],,[#include <inttypes.h>])
AC_CHECK_TYPE([int16_t],[scm_inttypes_has_int16=1],,[#include <inttypes.h>])
AC_CHECK_TYPE([uint16_t],[scm_inttypes_has_uint16=1],,[#include <inttypes.h>])
AC_CHECK_TYPE([int32_t],[scm_inttypes_has_int32=1],,[#include <inttypes.h>])
AC_CHECK_TYPE([uint32_t],[scm_inttypes_has_uint32=1],,[#include <inttypes.h>])
AC_CHECK_TYPE([int64_t],[scm_inttypes_has_int64=1],,[#include <inttypes.h>])
AC_CHECK_TYPE([uint64_t],[scm_inttypes_has_uint64=1],,[#include <inttypes.h>])
AC_CHECK_TYPE([intmax_t],[scm_inttypes_has_intmax=1],,[#include <inttypes.h>])
AC_CHECK_TYPE([uintmax_t],[scm_inttypes_has_uintmax=1],,[#include <inttypes.h>])
AC_CHECK_TYPE([intptr_t],[scm_inttypes_has_intptr=1],,[#include <inttypes.h>])
AC_CHECK_TYPE([uintptr_t],[scm_inttypes_has_uintptr=1],,[#include <inttypes.h>])
fi
# Try hard to find definitions for some required scm_t_*int* types.
### Required type scm_t_int8
if test "$scm_stdint_has_int8"; then
SCM_I_GSC_T_INT8='"int8_t"'
SCM_I_GSC_NEEDS_STDINT_H=1
elif test "$scm_inttypes_has_int8"; then
SCM_I_GSC_T_INT8='"int8_t"'
SCM_I_GSC_NEEDS_INTTYPES_H=1
elif test "$ac_cv_sizeof_char" -eq 1; then
SCM_I_GSC_T_INT8='"signed char"'
else
AC_MSG_ERROR([Can't find appropriate type for scm_t_int8.])
fi
AC_SUBST([SCM_I_GSC_T_INT8])
### Required type scm_t_uint8
if test "$scm_stdint_has_uint8"; then
SCM_I_GSC_T_UINT8='"uint8_t"'
SCM_I_GSC_NEEDS_STDINT_H=1
elif test "$scm_inttypes_has_uint8"; then
SCM_I_GSC_T_UINT8='"uint8_t"'
SCM_I_GSC_NEEDS_INTTYPES_H=1
elif test "$ac_cv_sizeof_unsigned_char" -eq 1; then
SCM_I_GSC_T_UINT8='"unsigned char"'
else
AC_MSG_ERROR([Can't find appropriate type for scm_t_uint8.])
fi
AC_SUBST([SCM_I_GSC_T_UINT8])
### Required type scm_t_int16 (ANSI C says int or short might work)
if test "$scm_stdint_has_int16"; then
SCM_I_GSC_T_INT16='"int16_t"'
SCM_I_GSC_NEEDS_STDINT_H=1
elif test "$scm_inttypes_has_int16"; then
SCM_I_GSC_T_INT16='"int16_t"'
SCM_I_GSC_NEEDS_INTTYPES_H=1
elif test "$ac_cv_sizeof_int" -eq 2; then
SCM_I_GSC_T_INT16='"int"'
elif test "$ac_cv_sizeof_short" -eq 2; then
SCM_I_GSC_T_INT16='"short"'
else
AC_MSG_ERROR([Can't find appropriate type for scm_t_int16.])
fi
AC_SUBST([SCM_I_GSC_T_INT16])
### Required type scm_t_uint16 (ANSI C says int or short might work)
if test "$scm_stdint_has_uint16"; then
SCM_I_GSC_T_UINT16='"uint16_t"'
SCM_I_GSC_NEEDS_STDINT_H=1
elif test "$scm_inttypes_has_uint16"; then
SCM_I_GSC_T_UINT16='"uint16_t"'
SCM_I_GSC_NEEDS_INTTYPES_H=1
elif test "$ac_cv_sizeof_unsigned_int" -eq 2; then
SCM_I_GSC_T_UINT16='"unsigned int"'
elif test "$ac_cv_sizeof_unsigned_short" -eq 2; then
SCM_I_GSC_T_UINT16='"unsigned short"'
else
AC_MSG_ERROR([Can't find appropriate type for scm_t_uint16.])
fi
AC_SUBST([SCM_I_GSC_T_UINT16])
### Required type scm_t_int32 (ANSI C says int, short, or long might work)
if test "$scm_stdint_has_int32"; then
SCM_I_GSC_T_INT32='"int32_t"'
SCM_I_GSC_NEEDS_STDINT_H=1
elif test "$scm_inttypes_has_int32"; then
SCM_I_GSC_T_INT32='"int32_t"'
SCM_I_GSC_NEEDS_INTTYPES_H=1
elif test "$ac_cv_sizeof_int" -eq 4; then
SCM_I_GSC_T_INT32='"int"'
elif test "$ac_cv_sizeof_long" -eq 4; then
SCM_I_GSC_T_INT32='"long"'
elif test "$ac_cv_sizeof_short" -eq 4; then
SCM_I_GSC_T_INT32='"short"'
else
AC_MSG_ERROR([Can't find appropriate type for scm_t_int32.])
fi
AC_SUBST([SCM_I_GSC_T_INT32])
### Required type scm_t_uint32 (ANSI C says int, short, or long might work)
if test "$scm_stdint_has_uint32"; then
SCM_I_GSC_T_UINT32='"uint32_t"'
SCM_I_GSC_NEEDS_STDINT_H=1
elif test "$scm_inttypes_has_uint32"; then
SCM_I_GSC_T_UINT32='"uint32_t"'
SCM_I_GSC_NEEDS_INTTYPES_H=1
elif test "$ac_cv_sizeof_unsigned_int" -eq 4; then
SCM_I_GSC_T_UINT32='"unsigned int"'
elif test "$ac_cv_sizeof_unsigned_long" -eq 4; then
SCM_I_GSC_T_UINT32='"unsigned long"'
elif test "$ac_cv_sizeof_unsigned_short" -eq 4; then
SCM_I_GSC_T_UINT32='"unsigned short"'
else
AC_MSG_ERROR([Can't find appropriate type for scm_t_uint32.])
fi
AC_SUBST([SCM_I_GSC_T_UINT32])
### Optional type scm_t_int64 (ANSI C says int, short, or long might work)
### Also try 'long long' and '__int64' if we have it.
SCM_I_GSC_T_INT64=0
if test "$scm_stdint_has_int64"; then
SCM_I_GSC_T_INT64='"int64_t"'
SCM_I_GSC_NEEDS_STDINT_H=1
elif test "$scm_inttypes_has_int64"; then
SCM_I_GSC_T_INT64='"int64_t"'
SCM_I_GSC_NEEDS_INTTYPES_H=1
elif test "$ac_cv_sizeof_int" -eq 8; then
SCM_I_GSC_T_INT64='"int"'
elif test "$ac_cv_sizeof_long" -eq 8; then
SCM_I_GSC_T_INT64='"long"'
elif test "$ac_cv_sizeof_short" -eq 8; then
SCM_I_GSC_T_INT64='"short"'
elif test "$ac_cv_sizeof_long_long" -eq 8; then
SCM_I_GSC_T_INT64='"long long"'
elif test "$ac_cv_sizeof___int64" -eq 8; then
SCM_I_GSC_T_INT64='"__int64"'
else
AC_MSG_ERROR([Can't find appropriate type for scm_t_int64.])
fi
AC_SUBST([SCM_I_GSC_T_INT64])
### Optional type scm_t_uint64 (ANSI C says int, short, or long might work)
### Also try 'long long' and '__int64' if we have it.
SCM_I_GSC_T_UINT64=0
if test "$scm_stdint_has_uint64"; then
SCM_I_GSC_T_UINT64='"uint64_t"'
SCM_I_GSC_NEEDS_STDINT_H=1
elif test "$scm_inttypes_has_uint64"; then
SCM_I_GSC_T_UINT64='"uint64_t"'
SCM_I_GSC_NEEDS_INTTYPES_H=1
elif test "$ac_cv_sizeof_unsigned_int" -eq 8; then
SCM_I_GSC_T_UINT64='"unsigned int"'
elif test "$ac_cv_sizeof_unsigned_long" -eq 8; then
SCM_I_GSC_T_UINT64='"unsigned long"'
elif test "$ac_cv_sizeof_unsigned_short" -eq 8; then
SCM_I_GSC_T_UINT64='"unsigned short"'
elif test "$ac_cv_sizeof_unsigned_long_long" -eq 8; then
SCM_I_GSC_T_UINT64='"unsigned long long"'
elif test "$ac_cv_sizeof_unsigned___int64" -eq 8; then
SCM_I_GSC_T_UINT64='"unsigned __int64"'
else
AC_MSG_ERROR([Can't find appropriate type for scm_t_uint64.])
fi
AC_SUBST([SCM_I_GSC_T_UINT64])
### Required type scm_t_intmax
###
### We try 'intmax_t', '__int64', 'long long' in this order. When
### none of them is available, we use 'long'.
###
SCM_I_GSC_T_INTMAX=0
if test "$scm_stdint_has_intmax"; then
SCM_I_GSC_T_INTMAX='"intmax_t"'
SCM_I_GSC_NEEDS_STDINT_H=1
elif test "$scm_inttypes_has_intmax"; then
SCM_I_GSC_T_INTMAX='"intmax_t"'
SCM_I_GSC_NEEDS_INTTYPES_H=1
elif test "$ac_cv_sizeof___int64" -ne 0; then
SCM_I_GSC_T_INTMAX='"__int64"'
elif test "$ac_cv_sizeof_long_long" -ne 0; then
SCM_I_GSC_T_INTMAX='"long long"'
else
SCM_I_GSC_T_INTMAX='"long"'
fi
AC_SUBST([SCM_I_GSC_T_INTMAX])
### Required type scm_t_uintmax
###
### We try 'uintmax_t', 'unsigned __int64', 'unsigned long long' in
### this order. When none of them is available, we use 'unsigned long'.
###
SCM_I_GSC_T_UINTMAX=0
if test "$scm_stdint_has_uintmax"; then
SCM_I_GSC_T_UINTMAX='"uintmax_t"'
SCM_I_GSC_NEEDS_STDINT_H=1
elif test "$scm_inttypes_has_uintmax"; then
SCM_I_GSC_T_UINTMAX='"uintmax_t"'
SCM_I_GSC_NEEDS_INTTYPES_H=1
elif test "$ac_cv_sizeof_unsigned___int64" -ne 0; then
SCM_I_GSC_T_UINTMAX='"unsigned __int64"'
elif test "$ac_cv_sizeof_unsigned_long_long" -ne 0; then
SCM_I_GSC_T_UINTMAX='"unsigned long long"'
else
SCM_I_GSC_T_UINTMAX='"unsigned long"'
fi
AC_SUBST([SCM_I_GSC_T_UINTMAX])
### Required type scm_t_intptr
###
SCM_I_GSC_T_INTPTR=0
if test "$scm_stdint_has_intptr"; then
SCM_I_GSC_T_INTPTR='"intptr_t"'
SCM_I_GSC_NEEDS_STDINT_H=1
elif test "$scm_inttypes_has_intptr"; then
SCM_I_GSC_T_INTPTR='"intptr_t"'
SCM_I_GSC_NEEDS_INTTYPES_H=1
elif test "$ac_cv_sizeof_int" = "$ac_cv_sizeof_void_p"; then
SCM_I_GSC_T_INTPTR='"int"'
elif test "$ac_cv_sizeof_long" = "$ac_cv_sizeof_void_p"; then
SCM_I_GSC_T_INTPTR='"long"'
elif test "$ac_cv_sizeof_long_long" = "$ac_cv_sizeof_void_p"; then
SCM_I_GSC_T_INTPTR='"long long"'
else
AC_MSG_ERROR([Can't find appropriate type for `scm_t_intptr'.])
fi
AC_SUBST([SCM_I_GSC_T_INTPTR])
### Required type scm_t_uintptr
###
SCM_I_GSC_T_UINTPTR=0
if test "$scm_stdint_has_uintptr"; then
SCM_I_GSC_T_UINTPTR='"uintptr_t"'
SCM_I_GSC_NEEDS_STDINT_H=1
elif test "$scm_inttypes_has_uintptr"; then
SCM_I_GSC_T_UINTPTR='"uintptr_t"'
SCM_I_GSC_NEEDS_INTTYPES_H=1
elif test "$ac_cv_sizeof_int" = "$ac_cv_sizeof_void_p"; then
SCM_I_GSC_T_UINTPTR='"unsigned int"'
elif test "$ac_cv_sizeof_long" = "$ac_cv_sizeof_void_p"; then
SCM_I_GSC_T_UINTPTR='"unsigned long"'
elif test "$ac_cv_sizeof_long_long" = "$ac_cv_sizeof_void_p"; then
SCM_I_GSC_T_UINTPTR='"unsigned long long"'
else
AC_MSG_ERROR([Can't find appropriate type for `scm_t_uintptr'.])
fi
AC_SUBST([SCM_I_GSC_T_UINTPTR])
AC_SUBST([SCM_I_GSC_NEEDS_STDINT_H])
AC_SUBST([SCM_I_GSC_NEEDS_INTTYPES_H])
AC_MSG_CHECKING([for which prebuilt binary set to use during bootstrap])
SCM_PREBUILT_BINARIES=
case "$ac_cv_c_bigendian-$ac_cv_sizeof_void_p" in