If <sysexits.h> exists but is missing values, fill in the missing values.
[gnulib.git] / m4 / sysexits.m4
1 # sysexits.m4 serial 3
2 dnl Copyright (C) 2003, 2005, 2007 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
6
7 AC_DEFUN([gl_SYSEXITS],
8 [
9   AC_CHECK_HEADERS_ONCE([sysexits.h])
10   if test $ac_cv_header_sysexits_h = yes; then
11     HAVE_SYSEXITS_H=1
12     gl_ABSOLUTE_HEADER([sysexits.h])
13     ABSOLUTE_SYSEXITS_H=\"$gl_cv_absolute_sysexits_h\"
14     AC_TRY_COMPILE([#include <sysexits.h>],
15       [switch (0)
16        {
17        case EX_OK:
18        case EX_USAGE:
19        case EX_DATAERR:
20        case EX_NOINPUT:
21        case EX_NOUSER:
22        case EX_NOHOST:
23        case EX_UNAVAILABLE:
24        case EX_SOFTWARE:
25        case EX_OSERR:
26        case EX_OSFILE:
27        case EX_CANTCREAT:
28        case EX_IOERR:
29        case EX_TEMPFAIL:
30        case EX_PROTOCOL:
31        case EX_NOPERM:
32        case EX_CONFIG:
33          break;
34        }
35       ],
36       [SYSEXITS_H=],
37       [SYSEXITS_H=sysexits.h])
38   else
39     HAVE_SYSEXITS_H=0
40     SYSEXITS_H=sysexits.h
41   fi
42   AC_SUBST([HAVE_SYSEXITS_H])
43   AC_SUBST([ABSOLUTE_SYSEXITS_H])
44   AC_SUBST([SYSEXITS_H])
45 ])