]> Savannah Git Hosting - gnulib.git/commitdiff
Fix compilation errors in C++ mode on Solaris 10.
authorBruno Haible <bruno@clisp.org>
Sat, 7 Dec 2019 14:13:57 +0000 (15:13 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 7 Dec 2019 14:13:57 +0000 (15:13 +0100)
* 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
doc/posix-headers/stdbool.texi
m4/stdbool.m4

index df9aecc44e718559d084901d0d4490b87576e69a..a9882c23faeb6c4d5603537928eafca348079922 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2019-12-07  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        Reword NEWS entry.
index 5a2ff6a9dca914993462f8d9043e30e079dd7239..5b7ed0753fef2c63f2cf05d7c478c1273e0c244d 100644 (file)
@@ -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:
index acb852244f786cbb98fcd4001ceb1a07c75c5851..b470b05c54493baf6896d06ad0e0ed497e8d420d 100644 (file)
@@ -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 <stdbool.h> 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, <stdbool.h> does not exist or does not conform to C99.
+  dnl On Solaris 10 with CC=cc CXX=CC, <stdbool.h> exists but is not usable
+  dnl in C++ mode (and no <cstdbool> 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