+2023-02-11 Bruno Haible <bruno@clisp.org>
+
+ error-h: Make less fragile.
+ * lib/error.in.h: Use #include_next if the system has an <error.h>. Use
+ a split double-inclusion guard.
+ * m4/error_h.m4 (gl_ERROR_H): Invoke gl_CHECK_NEXT_HEADERS. Set
+ HAVE_ERROR_H.
+ * modules/error-h (Makefile.am): Substitute GUARD_PREFIX, HAVE_ERROR_H,
+ INCLUDE_NEXT, PRAGMA_SYSTEM_HEADER, NEXT_ERROR_H.
+
2023-02-11 Bruno Haible <bruno@clisp.org>
unilbrk: Don't compile unused functions outside of libunistring.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
-#ifndef _ERROR_H
-#define _ERROR_H 1
+#ifndef _@GUARD_PREFIX@_ERROR_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+
+/* The include_next requires a split double-inclusion guard. */
+#if @HAVE_ERROR_H@
+# @INCLUDE_NEXT@ @NEXT_ERROR_H@
+#endif
+
+#ifndef _@GUARD_PREFIX@_ERROR_H
+#define _@GUARD_PREFIX@_ERROR_H
/* Get _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM. */
#include <stdio.h>
}
#endif
-#endif /* error.h */
+#endif /* _@GUARD_PREFIX@_ERROR_H */
+#endif /* _@GUARD_PREFIX@_ERROR_H */
-# error_h.m4 serial 2
+# error_h.m4 serial 3
dnl Copyright (C) 1996-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
[
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+ gl_CHECK_NEXT_HEADERS([error.h])
+ if test $ac_cv_header_error_h = yes; then
+ HAVE_ERROR_H=1
+ else
+ HAVE_ERROR_H=0
+ fi
+ AC_SUBST([HAVE_ERROR_H])
+
REPLACE_ERROR=0
gl_CHECK_FUNCS_ANDROID([error], [[#include <error.h>]])
error.h: error.in.h $(top_builddir)/config.status $(CXXDEFS_H)
@NMD@ $(AM_V_GEN)$(MKDIR_P) '%reldir%'
$(gl_V_at)$(SED_HEADER_STDOUT) \
+ -e 's|@''GUARD_PREFIX''@|${gl_include_guard_prefix}|g' \
+ -e 's|@''HAVE_ERROR_H''@|$(HAVE_ERROR_H)|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''NEXT_ERROR_H''@|$(NEXT_ERROR_H)|g' \
-e 's|@''HAVE_ERROR''@|$(HAVE_ERROR)|g' \
-e 's|@''HAVE_ERROR_AT_LINE''@|$(HAVE_ERROR_AT_LINE)|g' \
-e 's|@''REPLACE_ERROR''@|$(REPLACE_ERROR)|g' \