A few patches were needed to compile gettext-0.19.8.1 on Solaris 10
using both Oracle Studio 12.4 and Oracle Studio 12.5 compilers. The
problems seemed to be exclusively to some issue around the use of _Bool
and then "bool" in other place and a mismatch between header files and
the C source files that reference them.
These adjustments solve all these issues :
*** ./gettext-tools/src/xgettext.h_backup Sun Mar 20 07:37:53 2016
--- ./gettext-tools/src/xgettext.h Sun Jun 18 16:47:46 2017
***************
*** 363,369 ****
enum
literalstring_escape_type type);
/* Tests whether an arglist_parser has is not waiting for more
arguments after
argument ARGNUM. */
! extern bool arglist_parser_decidedp (struct arglist_parser *ap, int
argnum);
/* Terminates the processing of an arglist_parser after argument
ARGNUM and
deletes it. */
extern void arglist_parser_done (struct arglist_parser *ap, int argnum);
--- 363,369 ----
enum
literalstring_escape_type type);
/* Tests whether an arglist_parser has is not waiting for more
arguments after
argument ARGNUM. */
! extern signed char arglist_parser_decidedp (struct arglist_parser *ap,
int argnum);
/* Terminates the processing of an arglist_parser after argument
ARGNUM and
deletes it. */
extern void arglist_parser_done (struct arglist_parser *ap, int argnum);
*** ./gettext-tools/src/read-catalog-abstract.h_backup Sun Mar 20
07:37:53 2016
--- ./gettext-tools/src/read-catalog-abstract.h Sun Jun 18 16:01:05 2017
***************
*** 182,188 ****
/* Parse a special comment and put the result in *fuzzyp, formatp,
*rangep,
*wrapp. */
! extern void po_parse_comment_special (const char *s, bool *fuzzyp,
enum is_format formatp[NFORMATS],
struct argument_range *rangep,
enum is_wrap *wrapp,
--- 182,188 ----
/* Parse a special comment and put the result in *fuzzyp, formatp,
*rangep,
*wrapp. */
! extern void po_parse_comment_special (const char *s, signed char *fuzzyp,
enum is_format formatp[NFORMATS],
struct argument_range *rangep,
enum is_wrap *wrapp,
*** ./gettext-tools/src/read-catalog-abstract.c_backup Sun Mar 20
07:37:53 2016
--- ./gettext-tools/src/read-catalog-abstract.c Sun Jun 18 17:53:51 2017
***************
*** 262,268 ****
*wrapp. */
void
po_parse_comment_special (const char *s,
! bool *fuzzyp, enum is_format formatp[NFORMATS],
struct argument_range *rangep, enum is_wrap
*wrapp,
enum is_syntax_check scp[NSYNTAXCHECKS])
{
--- 262,268 ----
*wrapp. */
void
po_parse_comment_special (const char *s,
! signed char *fuzzyp, enum is_format
formatp[NFORMATS],
struct argument_range *rangep, enum is_wrap
*wrapp,
enum is_syntax_check scp[NSYNTAXCHECKS])
{
*** ./gettext-tools/src/write-java.h_backup Sun Mar 20 07:37:53 2016
--- ./gettext-tools/src/write-java.h Sun Jun 18 15:55:14 2017
***************
*** 33,39 ****
const char *resource_name,
const char *locale_name,
const char *directory,
! bool assume_java2,
! bool output_source);
#endif /* _WRITE_JAVA_H */
--- 33,39 ----
const char *resource_name,
const char *locale_name,
const char *directory,
! signed char assume_java2,
! signed char output_source);
#endif /* _WRITE_JAVA_H */
*** ./gettext-tools/src/po-lex.h_backup Sun Mar 20 07:37:53 2016
--- ./gettext-tools/src/po-lex.h Sun Jun 18 15:41:51 2017
***************
*** 61,67 ****
extern DLL_VARIABLE unsigned int gram_max_allowed_errors;
/* True if obsolete entries shall be considered as valid. */
! extern DLL_VARIABLE bool pass_obsolete_entries;
/* Prepare lexical analysis. */
--- 61,67 ----
extern DLL_VARIABLE unsigned int gram_max_allowed_errors;
/* True if obsolete entries shall be considered as valid. */
! extern DLL_VARIABLE signed char pass_obsolete_entries;
/* Prepare lexical analysis. */
***************
*** 76,86 ****
extern int po_gram_lex (void);
/* po_gram_lex() can return comments as COMMENT. Switch this on or
off. */
! extern void po_lex_pass_comments (bool flag);
/* po_gram_lex() can return obsolete entries as if they were normal
entries.
Switch this on or off. */
! extern void po_lex_pass_obsolete_entries (bool flag);
extern void po_gram_error (const char *fmt, ...)
__attribute__ ((__format__ (__printf__, 1, 2)));
--- 76,86 ----
extern int po_gram_lex (void);
/* po_gram_lex() can return comments as COMMENT. Switch this on or
off. */
! extern void po_lex_pass_comments ( signed char flag);
/* po_gram_lex() can return obsolete entries as if they were normal
entries.
Switch this on or off. */
! extern void po_lex_pass_obsolete_entries ( signed char flag);
extern void po_gram_error (const char *fmt, ...)
__attribute__ ((__format__ (__printf__, 1, 2)));
*** ./gettext-tools/libgettextpo/markup.h_backup Sun Mar 20
07:37:53 2016
--- ./gettext-tools/libgettextpo/markup.h Sun Jun 18 16:08:51 2017
***************
*** 150,159 ****
markup_parse_flags_ty flags,
void *user_data);
extern void markup_parse_context_free (markup_parse_context_ty *context);
! extern bool markup_parse_context_parse (markup_parse_context_ty *context,
const char *text,
ssize_t text_len);
! extern bool markup_parse_context_end_parse (markup_parse_context_ty
*context);
extern const char *
markup_parse_context_get_error (markup_parse_context_ty *context);
--- 150,159 ----
markup_parse_flags_ty flags,
void *user_data);
extern void markup_parse_context_free (markup_parse_context_ty *context);
! extern signed char markup_parse_context_parse (markup_parse_context_ty
*context,
const char *text,
ssize_t text_len);
! extern signed char markup_parse_context_end_parse
(markup_parse_context_ty *context);
extern const char *
markup_parse_context_get_error (markup_parse_context_ty *context);
The use of a thing called "bool" seemed the be the issue here and
ultimately a "_Bool" really is just the smallest rant data element that
can contain a zero or a one value and I think an unsigned char should be
able to do the job neatly. For reasons unknown I needed to use signed
char and that solved all the compile issues.
The most up to date rev of the standard headers in Solaris 10 would be :
PKGINST: SUNWhea
NAME: SunOS Header Files
CATEGORY: system
ARCH: sparc
VERSION: 11.10.0,REV=2005.01.21.15.53
BASEDIR: /
VENDOR: Oracle Corporation
DESC: SunOS C/C++ header files for general development of software
PSTAMP: on10-patch20170424132434
INSTDATE: May 19 2017 03:01
HOTLINE: Please contact your local service provider
STATUS: completely installed
FILES: 1626 installed pathnames
42 shared pathnames
128 directories
22856 blocks used (approx)
That PSTAMP seems to suggest we have updates April this year but
stdbool.h has not changed since 2005 and it only exists if we actually
use a strict C99 compliant compiler :
$ cat /usr/include/stdbool.h
/*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _STDBOOL_H
#define _STDBOOL_H
#pragma ident "@(#)stdbool.h 1.1 03/12/04 SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Included for alignment with the ISO/IEC 9899:1999 standard. The
* contents of this header are only visible when using a c99
* compiler, otherwise inclusion of this header will result in a
* forced compilation failure.
*
* Note that the ability to undefine and redefine the macros bool,
* true, and false is an obsolescent feature which may be withdrawn
* in a future version of the standards specifications.
*/
#include <sys/feature_tests.h>
#if defined(_STDC_C99)
#undef bool
#undef true
#undef false
#define bool _Bool
#define true 1
#define false 0
#define __bool_true_false_are_defined 1
#else /* _STDC_C99 */
#error "Use of <stdbool.h> is valid only in a c99 compilation environment."
#endif /* _STDC_C99 */
#ifdef __cplusplus
}
#endif
#endif /* _STDBOOL_H */
So right there we see a define for "bool" as just _Bool and there even
exists a flag __bool_true_false_are_defined but since it has leading
underscores we should ignore that. Maybe :
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdbool.h.html
So I could go digging madly to figure out what *really* goes wrong but I
can tell you that C99 compiler issues a number of errors that all look
the same :
.
.
.
Making all in src
gmake[4]: Entering directory
`/usr/local/build/gettext-0.19.8.1_SunOS_5.10.002/gettext-tools/src'
/usr/local/bin/gmake all-am
gmake[5]: Entering directory
`/usr/local/build/gettext-0.19.8.1_SunOS_5.10.002/gettext-tools/src'
/usr/local/bin/bash ../libtool --tag=CC --mode=compile
/opt/developerstudio12.5/bin/c99 -DLOCALEDIR=\"/usr/local/share/locale\"
-DBISON_LOCALEDIR=\"\" -DLOCALE_ALIAS_PATH=\"/usr/local/share/locale\"
-DUSEJAVA=1 -DUSEJEXE=0 -DGETTEXTJEXEDIR=\"/usr/local/lib/gettext\"
-DGETTEXTJAR=\"/usr/local/share/gettext/gettext.jar\"
-DLIBDIR=\"/usr/local/lib\"
-DGETTEXTDATADIR=\"/usr/local/share/gettext\"
-DPROJECTSDIR=\"/usr/local/share/gettext/projects\" -DHAVE_CONFIG_H -I.
-I.. -I. -I. -I.. -I.. -I../libgrep -I../gnulib-lib -I../gnulib-lib
-I../intl -I../../gettext-runtime/intl -I///usr/local/include/libxml2
-I/usr/local/include -D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE
-D_TS_ERRNO -D_REENTRANT -errfmt=error -erroff=%none -errshort=full
-xstrconst -xildoff -m64 -xmemalign=8s -xnolibmil -Xc -xcode=pic32
-xregs=no%appl -xlibmieee -mc -ftrap=%none -Qy -xbuiltin=%none
-xdebugformat=dwarf -xunroll=1 -xarch=sparc -D_TS_ERRNO
-D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE -c -o
libgettextsrc_la-po-lex.lo `test -f 'po-lex.c' || echo './'`po-lex.c
libtool: compile: /opt/developerstudio12.5/bin/c99
-DLOCALEDIR=\"/usr/local/share/locale\" -DBISON_LOCALEDIR=\"\"
-DLOCALE_ALIAS_PATH=\"/usr/local/share/locale\" -DUSEJAVA=1 -DUSEJEXE=0
-DGETTEXTJEXEDIR=\"/usr/local/lib/gettext\"
-DGETTEXTJAR=\"/usr/local/share/gettext/gettext.jar\"
-DLIBDIR=\"/usr/local/lib\"
-DGETTEXTDATADIR=\"/usr/local/share/gettext\"
-DPROJECTSDIR=\"/usr/local/share/gettext/projects\" -DHAVE_CONFIG_H -I.
-I.. -I. -I. -I.. -I.. -I../libgrep -I../gnulib-lib -I../gnulib-lib
-I../intl -I../../gettext-runtime/intl -I///usr/local/include/libxml2
-I/usr/local/include -D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE
-D_TS_ERRNO -D_REENTRANT -errfmt=error -erroff=%none -errshort=full
-xstrconst -xildoff -m64 -xmemalign=8s -xnolibmil -Xc -xcode=pic32
-xregs=no%appl -xlibmieee -mc -ftrap=%none -Qy -xbuiltin=%none
-xdebugformat=dwarf -xunroll=1 -xarch=sparc -D_TS_ERRNO
-D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE -c po-lex.c -KPIC
-DPIC -o .libs/libgettextsrc_la-po-lex.o
"po-lex.c", line 604: error: identifier redeclared: pass_obsolete_entries
current : signed char
previous: _Bool : "po-lex.h", line 64
"po-lex.c", line 1139: error: identifier redeclared: po_lex_pass_comments
current : function(signed char) returning void
previous: function(_Bool) returning void : "po-lex.h", line 79
"po-lex.c", line 1148: error: identifier redeclared:
po_lex_pass_obsolete_entries
current : function(signed char) returning void
previous: function(_Bool) returning void : "po-lex.h", line 83
c99: acomp failed for po-lex.c
gmake[5]: *** [libgettextsrc_la-po-lex.lo] Error 1
gmake[5]: Leaving directory
`/usr/local/build/gettext-0.19.8.1_SunOS_5.10.002/gettext-tools/src'
gmake[4]: *** [all] Error 2
gmake[4]: Leaving directory
`/usr/local/build/gettext-0.19.8.1_SunOS_5.10.002/gettext-tools/src'
gmake[3]: *** [all-recursive] Error 1
gmake[3]: Leaving directory
`/usr/local/build/gettext-0.19.8.1_SunOS_5.10.002/gettext-tools'
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory
`/usr/local/build/gettext-0.19.8.1_SunOS_5.10.002/gettext-tools'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory
`/usr/local/build/gettext-0.19.8.1_SunOS_5.10.002'
gmake: *** [all] Error 2
So there we see some confusion over the use of "_Bool" in some places
and "bool" in other and yet the "signed char" essentially solves the
issue if we read the C99 spec correctly. Personally I think a true or
false value can fit neatly in an unsigned char and that solves the whole
mess.
Dennis Clarke