Don't rely on `HAVE_' macros in public header "tags.h".
* configure.ac: Check for `intptr_t' and `uintptr_t'. Substitute `SCM_I_GSC_T_INTPTR' and `SCM_I_GSC_T_UINPTR'. * libguile/__scm.h (SCM_T_UINTPTR_MAX, SCM_T_INTPTR_MIN, SCM_T_INTPTR_MAX): New macros. * libguile/_scm.h (SIZEOF_SCM_T_BITS): New macro. * libguile/gen-scmconfig.c (main): Produce typedefs for `scm_t_intptr' and `scm_t_uintptr'. * libguile/gen-scmconfig.h.in (SCM_I_GSC_T_INTPTR, SCM_I_GSC_T_UINPTR): New macros. * libguile/tags.h: Don't check for `HAVE_INTTYPES_H' and `HAVE_STDINT_H'; don't include <inttypes.h> nor <stdint.h>. (scm_t_signed_bits, scm_t_bits): Define unconditionally as aliases for `scm_t_intptr' and `scm_t_uintptr', respectively. (SCM_T_SIGNED_BITS_MAX, SCM_T_SIGNED_BITS_MIN, SCM_T_BITS_MAX): Likewise. (SIZEOF_SCM_T_BITS): Remove.
This commit is contained in:
parent
45f1c66749
commit
114bc68ac9
6 changed files with 60 additions and 33 deletions
44
configure.ac
44
configure.ac
|
|
@ -355,6 +355,8 @@ if test "$ac_cv_header_stdint_h" = yes; then
|
|||
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
|
||||
|
|
@ -383,6 +385,8 @@ if test "$ac_cv_header_inttypes_h" = yes; then
|
|||
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.
|
||||
|
|
@ -575,6 +579,46 @@ else
|
|||
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])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue