Hi,

Steven Wu <[EMAIL PROTECTED]> writes:

> It seems like the on MacOS X 10.4, the configure decided guile need
> locale.h, but certain definitions are missing. I got the following
> errors:
>
> i18n.c: In function 'scm_nl_langinfo':
> i18n.c:1449: error: 'GROUPING' undeclared (first use in this function)
> i18n.c:1449: error: (Each undeclared identifier is reported only once
> i18n.c:1449: error: for each function it appears in.)
> i18n.c:1450: error: 'MON_GROUPING' undeclared (first use in this
> function)

These constants are all GNU extensions to `nl_langinfo ()' [0,1].  Thus,
they ought to be conditionalized.  The attached patch (also committed to
CVS HEAD) should solve this problem.

Thanks,
Ludovic.

[0] http://www.opengroup.org/onlinepubs/009695399/basedefs/langinfo.h.html
[1] 
http://www.gnu.org/software/libc/manual/html_node/The-Elegant-and-Fast-Way.html#The-Elegant-and-Fast-Way

--- orig/libguile/i18n.c
+++ mod/libguile/i18n.c
@@ -1442,35 +1442,40 @@
     result = SCM_BOOL_F;
   else
     {
-      char *p;
-
       switch (c_item)
 	{
+#if (defined GROUPING) && (defined MON_GROUPING)
 	case GROUPING:
 	case MON_GROUPING:
-	  /* In this cases, the result is to be interpreted as a list of
-	     numbers.  If the last item is `CHARS_MAX', it has the special
-	     meaning "no more grouping".  */
-	  result = SCM_EOL;
-	  for (p = c_result; (*p != '\0') && (*p != CHAR_MAX); p++)
-	    result = scm_cons (SCM_I_MAKINUM ((int) *p), result);
-
 	  {
-	    SCM last_pair = result;
+	    char *p;
 
-	    result = scm_reverse_x (result, SCM_EOL);
+	    /* In this cases, the result is to be interpreted as a list of
+	       numbers.  If the last item is `CHARS_MAX', it has the special
+	       meaning "no more grouping".  */
+	    result = SCM_EOL;
+	    for (p = c_result; (*p != '\0') && (*p != CHAR_MAX); p++)
+	      result = scm_cons (SCM_I_MAKINUM ((int) *p), result);
 
-	    if (*p != CHAR_MAX)
-	      {
-		/* Cyclic grouping information.  */
-		if (last_pair != SCM_EOL)
-		  SCM_SETCDR (last_pair, result);
-	      }
-	  }
+	    {
+	      SCM last_pair = result;
 
-	  free (c_result);
-	  break;
+	      result = scm_reverse_x (result, SCM_EOL);
+
+	      if (*p != CHAR_MAX)
+		{
+		  /* Cyclic grouping information.  */
+		  if (last_pair != SCM_EOL)
+		    SCM_SETCDR (last_pair, result);
+		}
+	    }
 
+	    free (c_result);
+	    break;
+	  }
+#endif
+
+#if (defined FRAC_DIGITS) && (defined INT_FRAC_DIGITS)
 	case FRAC_DIGITS:
 	case INT_FRAC_DIGITS:
 	  /* This is to be interpreted as a single integer.  */
@@ -1482,19 +1487,25 @@
 
 	  free (c_result);
 	  break;
+#endif
 
+#if (defined P_CS_PRECEDES) && (defined INT_N_CS_PRECEDES)
 	case P_CS_PRECEDES:
 	case N_CS_PRECEDES:
 	case INT_P_CS_PRECEDES:
 	case INT_N_CS_PRECEDES:
+#if (defined P_SEP_BY_SPACE) && (defined N_SEP_BY_SPACE)
 	case P_SEP_BY_SPACE:
 	case N_SEP_BY_SPACE:
+#endif
 	  /* This is to be interpreted as a boolean.  */
 	  result = scm_from_bool (*c_result);
 
 	  free (c_result);
 	  break;
+#endif
 
+#if (defined P_SIGN_POSN) && (defined INT_N_SIGN_POSN)
 	case P_SIGN_POSN:
 	case N_SIGN_POSN:
 	case INT_P_SIGN_POSN:
@@ -1527,6 +1538,7 @@
 	      result = scm_from_locale_symbol ("unspecified");
 	    }
 	  break;
+#endif
 
 	default:
 	  /* FIXME: `locale_string ()' is not appropriate here because of

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel

Reply via email to