+# Try hard to find definitions for some required scm_t_*int* types.
+
+### Required type scm_t_int8
+if test "$ac_cv_sizeof_char" -eq 1; then
+ SCM_I_GSC_T_INT8='"char"'
+elif 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
+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 "$ac_cv_sizeof_unsigned_char" -eq 1; then
+ SCM_I_GSC_T_UINT8='"unsigned char"'
+elif 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
+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 "$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"'
+elif 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
+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 "$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"'
+elif 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
+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 "$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"'
+elif 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
+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 "$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"'
+elif 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
+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 "$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"'
+elif 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
+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 "$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"'
+elif 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
+else
+ AC_MSG_ERROR([Can't find appropriate type for scm_t_uint64.])
+fi
+AC_SUBST([SCM_I_GSC_T_UINT64])
+
+
+AC_SUBST([SCM_I_GSC_NEEDS_STDINT_H])
+AC_SUBST([SCM_I_GSC_NEEDS_INTTYPES_H])
+