+2007-03-25 Bruno Haible <bruno@clisp.org>
+
+ * lib/sysexit_,h: If HAVE_SYSEXITS_H is defined, include the original
+ <sysexits.h> file, and only add EX_CONFIG.
+ * m4/sysexits.m4 (gl_SYSEXITS): If <sysexits.h> exists, check its
+ absolute file name and whether it is sufficient. Substitute also
+ HAVE_SYSEXITS_H and ABSOLUTE_SYSEXITS_H.
+ * modules/sysexits (Makefile.am): Substitute HAVE_SYSEXITS_H and
+ ABSOLUTE_SYSEXITS_H into sysexits.h.
+
2007-03-25 Bruno Haible <bruno@clisp.org>
* lib/getaddrinfo.c (getaddrinfo): Don't access hints->ai_flags when
/* exit() exit codes for some BSD system programs.
- Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#ifndef _SYSEXITS_H
#define _SYSEXITS_H
-#define EX_OK 0 /* same value as EXIT_SUCCESS */
-
-#define EX_USAGE 64
-#define EX_DATAERR 65
-#define EX_NOINPUT 66
-#define EX_NOUSER 67
-#define EX_NOHOST 68
-#define EX_UNAVAILABLE 69
-#define EX_SOFTWARE 70
-#define EX_OSERR 71
-#define EX_OSFILE 72
-#define EX_CANTCREAT 73
-#define EX_IOERR 74
-#define EX_TEMPFAIL 75
-#define EX_PROTOCOL 76
-#define EX_NOPERM 77
-#define EX_CONFIG 78
+#if @HAVE_SYSEXITS_H@
+
+# include @ABSOLUTE_SYSEXITS_H@
+
+/* HP-UX 11 <sysexits.h> ends at EX_NOPERM. */
+# ifndef EX_CONFIG
+# define EX_CONFIG 78
+# endif
+
+#else
+
+# define EX_OK 0 /* same value as EXIT_SUCCESS */
+
+# define EX_USAGE 64
+# define EX_DATAERR 65
+# define EX_NOINPUT 66
+# define EX_NOUSER 67
+# define EX_NOHOST 68
+# define EX_UNAVAILABLE 69
+# define EX_SOFTWARE 70
+# define EX_OSERR 71
+# define EX_OSFILE 72
+# define EX_CANTCREAT 73
+# define EX_IOERR 74
+# define EX_TEMPFAIL 75
+# define EX_PROTOCOL 76
+# define EX_NOPERM 77
+# define EX_CONFIG 78
+
+#endif
#endif /* _SYSEXITS_H */
-# sysexits.m4 serial 2
-dnl Copyright (C) 2003,2005 Free Software Foundation, Inc.
+# sysexits.m4 serial 3
+dnl Copyright (C) 2003, 2005, 2007 Free Software Foundation, Inc.
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.
AC_DEFUN([gl_SYSEXITS],
[
- AC_CHECK_HEADERS(sysexits.h,
- [SYSEXITS_H=],
- [SYSEXITS_H=sysexits.h])
+ AC_CHECK_HEADERS_ONCE([sysexits.h])
+ if test $ac_cv_header_sysexits_h = yes; then
+ HAVE_SYSEXITS_H=1
+ gl_ABSOLUTE_HEADER([sysexits.h])
+ ABSOLUTE_SYSEXITS_H=\"$gl_cv_absolute_sysexits_h\"
+ AC_TRY_COMPILE([#include <sysexits.h>],
+ [switch (0)
+ {
+ case EX_OK:
+ case EX_USAGE:
+ case EX_DATAERR:
+ case EX_NOINPUT:
+ case EX_NOUSER:
+ case EX_NOHOST:
+ case EX_UNAVAILABLE:
+ case EX_SOFTWARE:
+ case EX_OSERR:
+ case EX_OSFILE:
+ case EX_CANTCREAT:
+ case EX_IOERR:
+ case EX_TEMPFAIL:
+ case EX_PROTOCOL:
+ case EX_NOPERM:
+ case EX_CONFIG:
+ break;
+ }
+ ],
+ [SYSEXITS_H=],
+ [SYSEXITS_H=sysexits.h])
+ else
+ HAVE_SYSEXITS_H=0
+ SYSEXITS_H=sysexits.h
+ fi
+ AC_SUBST([HAVE_SYSEXITS_H])
+ AC_SUBST([ABSOLUTE_SYSEXITS_H])
AC_SUBST([SYSEXITS_H])
])
# doesn't have one that works with the given compiler.
sysexits.h: sysexit_.h
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- cat $(srcdir)/sysexit_.h; \
+ sed -e 's|@''HAVE_SYSEXITS_H''@|$(HAVE_SYSEXITS_H)|g' \
+ -e 's|@''ABSOLUTE_SYSEXITS_H''@|$(ABSOLUTE_SYSEXITS_H)|g' \
+ < $(srcdir)/sysexit_.h; \
} > $@-t
mv -f $@-t $@
MOSTLYCLEANFILES += sysexits.h sysexits.h-t