This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add the files from dist/meta to perl's repo
[metaconfig.git] / dist / U / d_uwait.U
1 ?RCS: $Id: d_uwait.U 1 2006-08-24 12:32:52Z rmanfredi $
2 ?RCS:
3 ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
4 ?RCS: 
5 ?RCS: You may redistribute only under the terms of the Artistic Licence,
6 ?RCS: as specified in the README file that comes with the distribution.
7 ?RCS: You may reuse parts of this distribution only within the terms of
8 ?RCS: that same Artistic Licence; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 4.0.
10 ?RCS:
11 ?RCS: $Log: d_uwait.U,v $
12 ?RCS: Revision 3.0.1.1  1994/01/24  14:10:49  ram
13 ?RCS: patch16: added knowledge about wait3()
14 ?RCS: patch16: revised 'union wait' look-up algorithm
15 ?RCS: patch16: fixed make dependency line accordingly
16 ?RCS:
17 ?RCS: Revision 3.0  1993/08/18  12:07:54  ram
18 ?RCS: Baseline for dist 3.0 netwide release.
19 ?RCS:
20 ?MAKE:d_uwait d_uwait3: cat contains cppstdin cppminus +cppflags rm \
21         Setvar Findhdr
22 ?MAKE:  -pick add $@ %<
23 ?S:d_uwait:
24 ?S:     This symbol conditionally defines UNION_WAIT which indicates to the C
25 ?S:     program that argument for the wait() system call should be declared as
26 ?S:     'union wait status' instead of 'int status'.
27 ?S:.
28 ?S:d_uwait3:
29 ?S:     This symbol conditionally defines UNION_WAIT3 which indicates to the C
30 ?S:     program that the first argument for the wait3() system call should be
31 ?S:     declared as 'union wait status' instead of 'int status'.
32 ?S:.
33 ?C:UNION_WAIT:
34 ?C:     This symbol if defined indicates to the C program that the argument
35 ?C:     for the wait() system call should be declared as 'union wait status'
36 ?C:     instead of 'int status'. You probably need to include <sys/wait.h>
37 ?C:     in the former case (see I_SYSWAIT).
38 ?C:.
39 ?C:UNION_WAIT3:
40 ?C:     This symbol if defined indicates to the C program that the first argument
41 ?C:     for the wait3() system call should be declared as 'union wait status'
42 ?C:     instead of 'int status'. You probably need to include <sys/wait.h>
43 ?C:     in the former case (see I_SYSWAIT). It seems safe to assume that the
44 ?C:     same rule applies to the second parameter of wait4().
45 ?C:.
46 ?H:#$d_uwait UNION_WAIT         /**/
47 ?H:#$d_uwait3 UNION_WAIT3       /**/
48 ?H:.
49 ?T:val2 flags f also
50 ?LINT:set d_uwait d_uwait3
51 : see if union wait is available
52 echo " "
53 ?X:
54 ?X: Unfortunately, we can't just grep <sys/wait.h> for "union wait" because
55 ?X: some weird systems (did I hear HP-UX?) define union wait only when _BSD
56 ?X: is defined. The same thing happens on OSF/1, who is pushing weirdness to
57 ?X: its limits by requiring wait() to use (int *) but wait3() to use
58 ?X: (union wait *), unless _BSD is defined and -lbsd is used, in which case
59 ?X: wait() also expects (union wait *). Aaargh!!--RAM
60 ?X:
61 set X $cppflags
62 shift
63 flags=''
64 also=''
65 for f in $*; do
66         case "$f" in
67         *NO_PROTO*) ;;
68         *) flags="$flags $f";;
69         esac
70 done
71 $cat `./findhdr sys/wait.h` /dev/null | \
72         $cppstdin $flags $cppminus >wait.out 2>/dev/null
73 if $contains 'union.*wait.*{' wait.out >/dev/null 2>&1 ; then
74         echo "Looks like your <sys/wait.h> knows about 'union wait'..." >&4
75         val="$define"
76 @if UNION_WAIT
77         also='also '
78         if $contains 'extern.*wait[     ]*([    ]*int' wait.out >/dev/null 2>&1
79         then
80                 echo "But wait() seems to expect an 'int' pointer (POSIX way)." >&4
81                 val="$undef"
82                 also=''
83         elif $contains 'extern.*wait[   ]*([    ]*union' wait.out >/dev/null 2>&1
84         then
85                 echo "And indeed wait() expects an 'union wait' pointer (BSD way)." >&4
86         else
87                 echo "So we'll use that for wait()." >&4
88         fi
89 @end
90 @if UNION_WAIT3 || d_uwait3
91         val2="$define"
92 @end
93 @if UNION_WAIT3
94         if $contains 'extern.*wait3[    ]*([    ]*int' wait.out >/dev/null 2>&1
95         then
96                 echo "However wait3() seems to expect an 'int' pointer, weird." >&4
97                 val2="$undef"
98         elif $contains 'extern.*wait3[  ]*([    ]*union' wait.out >/dev/null 2>&1
99         then
100                 echo "And wait3() ${also}expects an 'union wait' pointer, fine." >&4
101         else
102                 echo "As expected, wait3() ${also}uses an 'union wait' pointer." >&4
103         fi
104 @end
105 else
106         echo "No trace of 'union wait' in <sys/wait.h>..." >&4
107         val="$undef"
108 @if UNION_WAIT && UNION_WAIT3
109         echo "Both wait() and wait3() will use a plain 'int' pointer then." >&4
110 @elsif UNION_WAIT
111         echo "Your wait() should be happy with a plain 'int' pointer." >&4
112 @elsif UNION_WAIT3
113         echo "Your wait3() should be happy with a plain 'int' pointer." >&4
114 @end
115 fi
116 set d_uwait
117 eval $setvar
118 @if UNION_WAIT3 || d_uwait3
119 val="$val2"; set d_uwait3
120 eval $setvar
121 @end
122 $rm -f wait.out
123