A testdir of module 'argp' fails to compile on Haiku:

../../gllib/argp-eexst.c:30:32: error: 'EX_USAGE' undeclared here (not in a 
function)
 error_t argp_err_exit_status = EX_USAGE;
                                ^
Makefile:1633: recipe for target 'argp-eexst.o' failed
make[4]: *** [argp-eexst.o] Error 1

This patch fixes it.


2021-03-07  Bruno Haible  <br...@clisp.org>

        sysexits: Fix for Haiku.
        * lib/sysexits.in.h: Don't assume that <sysexits.h>, when it exists,
        defines anything.
        * doc/glibc-headers/sysexits.texi: Mention the Haiku bug.

diff --git a/doc/glibc-headers/sysexits.texi b/doc/glibc-headers/sysexits.texi
index df1c5da..cce7e41 100644
--- a/doc/glibc-headers/sysexits.texi
+++ b/doc/glibc-headers/sysexits.texi
@@ -11,6 +11,10 @@ Portability problems fixed by Gnulib:
 This header file is missing on some platforms:
 mingw, MSVC 14.
 @item
+This header file defines no @code{EX_*} macros if @code{_BSD_SOURCE} is not
+defined on some platforms:
+Haiku.
+@item
 The macro @code{EX_CONFIG} is missing on some platforms:
 HP-UX 11.
 @end itemize
diff --git a/lib/sysexits.in.h b/lib/sysexits.in.h
index 7069a0d..8a3bc9a 100644
--- a/lib/sysexits.in.h
+++ b/lib/sysexits.in.h
@@ -46,7 +46,7 @@
 #ifndef _@GUARD_PREFIX@_SYSEXITS_H
 #define _@GUARD_PREFIX@_SYSEXITS_H
 
-#if !@HAVE_SYSEXITS_H@
+#if !(@HAVE_SYSEXITS_H@ && defined EX_USAGE)
 
 # define EX_OK 0 /* same value as EXIT_SUCCESS */
 


Reply via email to