Index: gen-scmconfig.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/gen-scmconfig.c,v
retrieving revision 1.7
diff -u -r1.7 gen-scmconfig.c
--- gen-scmconfig.c	8 Jul 2004 15:31:39 -0000	1.7
+++ gen-scmconfig.c	10 Jul 2004 12:20:31 -0000
@@ -316,15 +316,51 @@
   pf ("typedef %s scm_t_intmax;\n", SCM_I_GSC_T_INTMAX);
   pf ("typedef %s scm_t_uintmax;\n", SCM_I_GSC_T_UINTMAX);
 
+  pf ("#ifdef %s_MIN\n", SCM_I_GSC_T_INT8_LIMITS);
   pf ("#define SCM_T_INT8_MIN   %s_MIN\n", SCM_I_GSC_T_INT8_LIMITS);
+  pf ("#else\n");
+  pf ("#define SCM_T_INT8_MIN   ((scm_t_int8)(-128))\n");
+  pf ("#endif\n");
+  pf ("#ifdef %s_MAX\n", SCM_I_GSC_T_INT8_LIMITS);
   pf ("#define SCM_T_INT8_MAX   %s_MAX\n", SCM_I_GSC_T_INT8_LIMITS);
+  pf ("#else\n");
+  pf ("#define SCM_T_INT8_MAX   ((scm_t_int8)(127))\n");
+  pf ("#endif\n");
+  pf ("#ifdef %s_MAX\n", SCM_I_GSC_T_UINT8_LIMITS);
   pf ("#define SCM_T_UINT8_MAX  %s_MAX\n", SCM_I_GSC_T_UINT8_LIMITS);
+  pf ("#else\n");
+  pf ("#define SCM_T_UINT8_MAX  ((scm_t_uint8)(255U))\n");
+  pf ("#endif\n");
+  pf ("#ifdef %s_MIN\n", SCM_I_GSC_T_INT16_LIMITS);
   pf ("#define SCM_T_INT16_MIN  %s_MIN\n", SCM_I_GSC_T_INT16_LIMITS);
+  pf ("#else\n");
+  pf ("#define SCM_T_INT16_MIN  ((scm_t_int16)(-32767-1))\n");
+  pf ("#endif\n");
+  pf ("#ifdef %s_MAX\n", SCM_I_GSC_T_INT16_LIMITS);
   pf ("#define SCM_T_INT16_MAX  %s_MAX\n", SCM_I_GSC_T_INT16_LIMITS);
+  pf ("#else\n");
+  pf ("#define SCM_T_INT16_MAX  ((scm_t_int16)(32767))\n");
+  pf ("#endif\n");
+  pf ("#ifdef %s_MAX\n", SCM_I_GSC_T_UINT16_LIMITS);
   pf ("#define SCM_T_UINT16_MAX %s_MAX\n", SCM_I_GSC_T_UINT16_LIMITS);
+  pf ("#else\n");
+  pf ("#define SCM_T_UINT16_MAX ((scm_t_uint16)(65535U))\n");
+  pf ("#endif\n");
+  pf ("#ifdef %s_MIN\n", SCM_I_GSC_T_INT32_LIMITS);
   pf ("#define SCM_T_INT32_MIN  %s_MIN\n", SCM_I_GSC_T_INT32_LIMITS);
+  pf ("#else\n");
+  pf ("#define SCM_T_INT32_MIN  ((scm_t_int32)(-2147483647-1))\n");
+  pf ("#endif\n");
+  pf ("#ifdef %s_MAX\n", SCM_I_GSC_T_INT32_LIMITS);
   pf ("#define SCM_T_INT32_MAX  %s_MAX\n", SCM_I_GSC_T_INT32_LIMITS);
+  pf ("#else\n");
+  pf ("#define SCM_T_INT32_MAX  ((scm_t_int32)(2147483647))\n");
+  pf ("#endif\n");
+  pf ("#ifdef %s_MAX\n", SCM_I_GSC_T_UINT32_LIMITS);
   pf ("#define SCM_T_UINT32_MAX %s_MAX\n", SCM_I_GSC_T_UINT32_LIMITS);
+  pf ("#else\n");
+  pf ("#define SCM_T_UINT32_MAX ((scm_t_uint32)(4294967295U))\n");
+  pf ("#endif\n");
 
   pf ("\n");
   pf ("/* 64-bit integer -- if available SCM_HAVE_T_INT64 will be 1 and\n"
@@ -334,8 +370,24 @@
   {
     pf ("#define SCM_HAVE_T_INT64 1 /* 0 or 1 */\n");
     pf ("typedef %s scm_t_int64;\n", SCM_I_GSC_T_INT64);
+    pf ("#ifdef %s_MIN\n", SCM_I_GSC_T_INT64_LIMITS);
     pf ("#define SCM_T_INT64_MIN   %s_MIN\n", SCM_I_GSC_T_INT64_LIMITS);
+    pf ("#else\n");
+    pf ("#ifdef INT64_C\n");
+    pf ("#define SCM_T_INT64_MIN   ((scm_t_int64)(INT64_C(-9223372036854775807)-1))\n");
+    pf ("#else\n");
+    pf ("#define SCM_T_INT64_MIN   ((scm_t_int64)(-9223372036854775807LL-1))\n");
+    pf ("#endif\n");
+    pf ("#endif\n");
+    pf ("#ifdef %s_MAX\n", SCM_I_GSC_T_INT64_LIMITS);
     pf ("#define SCM_T_INT64_MAX   %s_MAX\n", SCM_I_GSC_T_INT64_LIMITS);
+    pf ("#else\n");
+    pf ("#ifdef INT64_C\n");
+    pf ("#define SCM_T_INT64_MAX   ((scm_t_int64)(INT64_C(9223372036854775807)))\n");
+    pf ("#else\n");
+    pf ("#define SCM_T_INT64_MAX   ((scm_t_int64)(9223372036854775807LL))\n");
+    pf ("#endif\n");
+    pf ("#endif\n");
   }
   else
     pf ("#define SCM_HAVE_T_INT64 0 /* 0 or 1 */\n");
@@ -348,7 +400,15 @@
   {
     pf ("#define SCM_HAVE_T_UINT64 1 /* 0 or 1 */\n");
     pf ("typedef %s scm_t_uint64;\n", SCM_I_GSC_T_UINT64);
+    pf ("#ifdef %s_MAX\n", SCM_I_GSC_T_UINT64_LIMITS);
     pf ("#define SCM_T_UINT64_MAX %s_MAX\n", SCM_I_GSC_T_UINT64_LIMITS);
+    pf ("#else\n");
+    pf ("#ifdef UINT64_C\n");
+    pf ("#define SCM_T_UINT64_MAX ((scm_t_uint64)(UINT64_C(18446744073709551615)))\n");
+    pf ("#else\n");
+    pf ("#define SCM_T_UINT64_MAX ((scm_t_uint64)(18446744073709551615ULL))\n");
+    pf ("#endif\n");
+    pf ("#endif\n");
   }
   else
     pf ("#define SCM_HAVE_T_UINT64 0 /* 0 or 1 */\n");
