devel/gettext and
devel/gettext-tools include a horrible macro which is GNU-specific, and then even more fragile tests to try to determine if you're using a compiler which doesn't like this (which seems, frankly, to be most of them - including Apple's GCC!)
I've tried to get this fixed, but the MIPSpro fix applied in-tree doesn't actually solve the problem (although possibly due to miscommunication on my part...)
The necessary patch to be applied after invoking "bmake patch" in the devel/gettext and devel/gettext-tools directories are:
Code:
--- work/gettext-0.14.6/gettext-tools/src/po-lex.c.dist 2006-08-31 15:33:19.927792640 +0100
+++ work/gettext-0.14.6/gettext-tools/src/po-lex.c 2006-08-26 21:12:36.337875040 +0100
@@ -66,14 +66,9 @@
lex_pos_ty gram_pos;
int gram_pos_column;
-
/* Error handling during the parsing of a PO file.
These functions can access gram_pos and gram_pos_column. */
-#if !defined __sgi && !(__STDC__ && \
- ((defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L && !defined __DECC) \
- || (defined __GNUC__ && __GNUC__ >= 2 && !defined __APPLE_CC__)))
-
/* CAUTION: If you change this function, you must also make identical
changes to the macro of the same name in src/po-lex.h */
@@ -132,9 +127,6 @@
po_error (EXIT_FAILURE, 0, _("too many errors, aborting"));
}
-#endif
-
-
/* The lowest level of PO file parsing converts bytes to multibyte characters.
This is needed
1. for C compatibility: ISO C 99 section 5.1.1.2 says that the first
Code:
--- work/gettext-0.14.6/gettext-tools/src/po-lex.h.dist 2006-08-31 15:33:19.968316720 +0100
+++ work/gettext-0.14.6/gettext-tools/src/po-lex.h 2006-08-26 21:12:36.340589840 +0100
@@ -70,85 +70,8 @@
Switch this on or off. */
extern void po_lex_pass_obsolete_entries (bool flag);
-
-/* ISO C 99 is smart enough to allow optimizations like this.
- Note: OpenVMS 7.3 cc pretends to support ISO C 99 but chokes on '...'. */
-#if __STDC__ && (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L && !defined __DECC)
-
-/* CAUTION: If you change this macro, you must also make identical
- changes to the function of the same name in src/po-lex.c */
-
-# define po_gram_error(fmt, ...) \
- do { \
- char *totalfmt = xasprintf ("%s%s", "%s:%lu:%d: ", fmt); \
- error_with_progname = false; \
- po_error (0, 0, totalfmt, gram_pos.file_name, \
- (unsigned long) gram_pos.line_number, gram_pos_column + 1, \
- __VA_ARGS__ + 0); \
- error_with_progname = true; \
- free (totalfmt); \
- if (*fmt == '.') \
- --error_message_count; \
- else if (error_message_count >= gram_max_allowed_errors) \
- po_error (1, 0, _("too many errors, aborting")); \
- } while (0)
-
-/* CAUTION: If you change this macro, you must also make identical
- changes to the function of the same name in src/po-lex.c */
-
-# define po_gram_error_at_line(pos, fmt, ...) \
- do { \
- error_with_progname = false; \
- po_error_at_line (0, 0, (pos)->file_name, (pos)->line_number, \
- fmt, __VA_ARGS__ + 0); \
- error_with_progname = true; \
- if (*fmt == '.') \
- --error_message_count; \
- else if (error_message_count >= gram_max_allowed_errors) \
- po_error (1, 0, _("too many errors, aborting")); \
- } while (0)
-
-/* GCC is also smart enough to allow optimizations like this. */
-#elif __STDC__ && defined __GNUC__ && __GNUC__ >= 2 && !defined __APPLE_CC__ \
- && !defined __sgi
-
-/* CAUTION: If you change this macro, you must also make identical
- changes to the function of the same name in src/po-lex.c */
-
-# define po_gram_error(fmt, args...) \
- do { \
- char *totalfmt = xasprintf ("%s%s", "%s:%d:%d: ", fmt); \
- error_with_progname = false; \
- po_error (0, 0, totalfmt, gram_pos.file_name, gram_pos.line_number, \
- gram_pos_column + 1 , ## args); \
- error_with_progname = true; \
- free (totalfmt); \
- if (*fmt == '.') \
- --error_message_count; \
- else if (error_message_count >= gram_max_allowed_errors) \
- po_error (1, 0, _("too many errors, aborting")); \
- } while (0)
-
-/* CAUTION: If you change this macro, you must also make identical
- changes to the function of the same name in src/po-lex.c */
-
-# define po_gram_error_at_line(pos, fmt, args...) \
- do { \
- error_with_progname = false; \
- po_error_at_line (0, 0, (pos)->file_name, (pos)->line_number, \
- fmt , ## args); \
- error_with_progname = true; \
- if (*fmt == '.') \
- --error_message_count; \
- else if (error_message_count >= gram_max_allowed_errors) \
- po_error (1, 0, _("too many errors, aborting")); \
- } while (0)
-
-#else
extern void po_gram_error (const char *fmt, ...);
extern void po_gram_error_at_line (const lex_pos_ty *pos, const char *fmt, ...);
-#endif
-
/* Contains information about the definition of one translation. */
struct msgstr_def
devel/gettext-asprintf also fails to build: The configure script strips "-LANG:exceptions=OFF:libc_in_namespace_std=OFF" from the supplied CXXFLAGS, the lack of which in turn prevents C++ code from seeing stdarg.h's va_list definition.
The cheating way to fix this is:
Code:
--- work/gettext-0.14.6/gettext-runtime/libasprintf/vasprintf.h.dist 2006-08-31 16:03:12.846440200 +0100
+++ work/gettext-0.14.6/gettext-runtime/libasprintf/vasprintf.h 2006-08-31 16:03:28.959791000 +0100
@@ -21,6 +21,7 @@
/* Get va_list. */
#include <stdarg.h>
+typedef char *va_list;
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */