From 615c8bccb001feafc1253a332a0a069c9037aab0 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 7 Dec 2019 15:13:57 +0100 Subject: [PATCH] Fix compilation errors in C++ mode on Solaris 10. * m4/stdbool.m4 (AM_STDBOOL_H): Require AC_CANONICAL_HOST. Set STDBOOL_H to non-empty on Solaris with a non-GCC compiler. * doc/posix-headers/stdbool.texi: Mention the Solaris issue. --- ChangeLog | 7 +++++++ doc/posix-headers/stdbool.texi | 3 +++ m4/stdbool.m4 | 22 ++++++++++++++++++---- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index df9aecc44e..a9882c23fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2019-12-07 Bruno Haible + + Fix compilation errors in C++ mode on Solaris 10. + * m4/stdbool.m4 (AM_STDBOOL_H): Require AC_CANONICAL_HOST. Set STDBOOL_H + to non-empty on Solaris with a non-GCC compiler. + * doc/posix-headers/stdbool.texi: Mention the Solaris issue. + 2019-12-07 Bruno Haible Reword NEWS entry. diff --git a/doc/posix-headers/stdbool.texi b/doc/posix-headers/stdbool.texi index 5a2ff6a9dc..5b7ed0753f 100644 --- a/doc/posix-headers/stdbool.texi +++ b/doc/posix-headers/stdbool.texi @@ -11,6 +11,9 @@ Portability problems fixed by Gnulib: This header file is missing on some platforms: AIX 5.1, HP-UX 11, IRIX 6.5. @item +This header file is not usable in C++ mode with the vendor compiler +on Solaris 10. +@item Some compilers have bugs relating to @samp{bool}. @item This header file defines @code{true} incorrectly on some platforms: diff --git a/m4/stdbool.m4 b/m4/stdbool.m4 index acb852244f..b470b05c54 100644 --- a/m4/stdbool.m4 +++ b/m4/stdbool.m4 @@ -5,18 +5,32 @@ dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -#serial 7 +#serial 8 # Prepare for substituting if it is not supported. AC_DEFUN([AM_STDBOOL_H], [ AC_REQUIRE([AC_CHECK_HEADER_STDBOOL]) + AC_REQUIRE([AC_CANONICAL_HOST]) - # Define two additional variables used in the Makefile substitution. - + dnl On some platforms, does not exist or does not conform to C99. + dnl On Solaris 10 with CC=cc CXX=CC, exists but is not usable + dnl in C++ mode (and no exists). In this case, we use our + dnl replacement, also in C mode (for binary compatibility between C and C++). if test "$ac_cv_header_stdbool_h" = yes; then - STDBOOL_H='' + case "$host_os" in + solaris*) + if test -z "$GCC"; then + STDBOOL_H='stdbool.h' + else + STDBOOL_H='' + fi + ;; + *) + STDBOOL_H='' + ;; + esac else STDBOOL_H='stdbool.h' fi -- 2.39.5