+2026-05-10 Bruno Haible <bruno@clisp.org>
+
+ sys_wait-h: Fix compilation error on Solaris 10 in C++ mode.
+ * lib/sys_wait.in.h (_GL_INCLUDING_SYS_WAIT_H): New macro, to avoid
+ recursive include problems.
+ * modules/sys_wait-h (Makefile.am): Substitute
+ INCLUDE_NEXT_AS_FIRST_DIRECTIVE, NEXT_AS_FIRST_DIRECTIVE_SYS_WAIT_H.
+
2026-05-10 Bruno Haible <bruno@clisp.org>
strnul: Fix compilation in C++ mode on Solaris 10 with Oracle Studio 12.
#endif
@PRAGMA_COLUMNS@
+#if defined _GL_INCLUDING_SYS_WAIT_H
+/* Special invocation convention:
+ - On Solaris 10 we have a sequence of nested includes
+ <sys/wait.h> -> <stdlib.h> -> <sys/wait.h>
+ In this situation, the functions are not yet declared, therefore we cannot
+ provide the C++ aliases. */
+
+#@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_SYS_WAIT_H@
+
+#else
+/* Normal invocation convention. */
+
/* The include_next requires a split double-inclusion guard. */
#if !(defined _WIN32 && ! defined __CYGWIN__)
+# define _GL_INCLUDING_SYS_WAIT_H
# @INCLUDE_NEXT@ @NEXT_SYS_WAIT_H@
+# undef _GL_INCLUDING_SYS_WAIT_H
#endif
#ifndef _@GUARD_PREFIX@_SYS_WAIT_H
#endif /* _@GUARD_PREFIX@_SYS_WAIT_H */
+#endif /* _GL_INCLUDING_SYS_WAIT_H */
#endif /* _@GUARD_PREFIX@_SYS_WAIT_H */
$(AM_V_GEN)$(MKDIR_P) '%reldir%/sys'
$(AM_V_at)$(SED_HEADER_STDOUT) \
-e 's|@''GUARD_PREFIX''@|${gl_include_guard_prefix}|g' \
+ -e 's|@''INCLUDE_NEXT_AS_FIRST_DIRECTIVE''@|$(INCLUDE_NEXT_AS_FIRST_DIRECTIVE)|g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+ -e 's|@''NEXT_AS_FIRST_DIRECTIVE_SYS_WAIT_H''@|$(NEXT_AS_FIRST_DIRECTIVE_SYS_WAIT_H)|g' \
-e 's|@''NEXT_SYS_WAIT_H''@|$(NEXT_SYS_WAIT_H)|g' \
-e 's/@''GNULIB_WAITPID''@/$(GNULIB_WAITPID)/g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \