Imported Upstream version 0.18.1.1
[platform/upstream/gettext.git] / gettext-tools / gnulib-m4 / unionwait.m4
1 # unionwait.m4 serial 1 (gettext-0.11)
2 dnl Copyright (C) 1993-2002 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 dnl Taken from GNU make 3.79.1.
8
9 AC_DEFUN([gt_UNION_WAIT],
10 [
11 AC_CHECK_FUNCS(waitpid)
12 AC_MSG_CHECKING(for union wait)
13 AC_CACHE_VAL(gt_cv_union_wait, [dnl
14 AC_TRY_LINK([#include <sys/types.h>
15 #include <sys/wait.h>],
16             [union wait status; int pid; pid = wait (&status);
17 #ifdef WEXITSTATUS
18 /* Some POSIXoid systems have both the new-style macros and the old
19    union wait type, and they do not work together.  If union wait
20    conflicts with WEXITSTATUS et al, we don't want to use it at all.  */
21 if (WEXITSTATUS (status) != 0) pid = -1;
22 #ifdef WTERMSIG
23 /* If we have WEXITSTATUS and WTERMSIG, just use them on ints.  */
24 -- blow chunks here --
25 #endif
26 #endif
27 #ifdef HAVE_WAITPID
28 /* Make sure union wait works with waitpid.  */
29 pid = waitpid (-1, &status, 0);
30 #endif
31 ],
32             [gt_cv_union_wait=yes], [gt_cv_union_wait=no])])
33 if test "$gt_cv_union_wait" = yes; then
34   AC_DEFINE(HAVE_UNION_WAIT, 1,
35             [Define if <sys/wait.h> defines the 'union wait' type.])
36 fi
37 AC_MSG_RESULT($gt_cv_union_wait)
38 ])