This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Populate metaconfig branch.
[metaconfig.git] / dist-3.0at70 / mcon / U / d_wifstat.U
1 ?RCS: $Id: d_wifstat.U,v 3.0.1.3 1997/02/28 15:47:43 ram Exp $
2 ?RCS:
3 ?RCS: Copyright (c) 1991-1993, 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 3.0.
10 ?RCS:
11 ?RCS: $Log: d_wifstat.U,v $
12 ?RCS: Revision 3.0.1.3  1997/02/28  15:47:43  ram
13 ?RCS: patch61: added a ?F: metalint hint
14 ?RCS:
15 ?RCS: Revision 3.0.1.2  1995/07/25  14:09:10  ram
16 ?RCS: patch56: re-arranged compile line to include ldflags before objects
17 ?RCS:
18 ?RCS: Revision 3.0.1.1  1995/03/21  08:47:46  ram
19 ?RCS: patch52: created
20 ?RCS:
21 ?MAKE:d_wifstat: d_uwait +cc +ccflags +ldflags +libs Oldconfig cat rm
22 ?MAKE:  -pick add $@ %<
23 ?S:d_wifstat:
24 ?S:     This symbol conditionally defines USE_WIFSTAT if the C program can
25 ?S:     safely use the WIFxxx macros with the kind of wait() parameter
26 ?S:     declared in the program (see UNION_WAIT), or if it can't. Should
27 ?S:     only matter on HP-UX, where the macros are incorrectly written and
28 ?S:     therefore cause programs using them with an 'union wait' variable
29 ?S:     to not compile properly.
30 ?S:.
31 ?C:USE_WIFSTAT:
32 ?C:     This symbol, if defined, indicates to the C program that the argument
33 ?C:     for the WIFxxx set of macros such as WIFSIGNALED or WIFEXITED can
34 ?C:     be of the same kind as the one used to hold the wait() status. Should
35 ?C:     only matter on HP-UX, where the macros are incorrectly written and
36 ?C:     therefore cause programs using them with an 'union wait' variable
37 ?C:     to not compile properly. See also UNION_WAIT.
38 ?C:.
39 ?H:#$d_wifstat USE_WIFSTAT              /**/
40 ?H:.
41 ?T:type
42 ?F:!foo
43 : see if we can use WIFxxx macros
44 echo " "
45 case "$d_wifstat" in
46 "$define") echo "As before, you can safely use WIFEXITED and friends!" >&4;;
47 "$undef") echo "You still can't use WIFEXITED and friends!" >&4;;
48 *)
49         echo "Let's see whether you can use the WIFEXITED(status) macro and its"
50         case "$d_uwait" in
51         "$define") type='union wait';;
52         *) type='int';;
53         esac
54         echo "friends with status declared as '$type status'..."
55         $cat >foo.c <<EOCP
56 #include <sys/types.h>
57 #include <sys/wait.h>
58
59 main()
60 {
61         $type status;
62         int e = 0;
63
64 #ifdef WIFEXITED
65         if (WIFEXITED(status))
66                 printf("\n");
67         exit(0);
68 #else
69         exit(2);
70 #endif
71 }
72 EOCP
73         d_wifstat="$undef"
74         if $cc $ccflags $ldflags foo.c -o foo $libs >/dev/null 2>&1; then
75                 if ./foo >/dev/null; then
76                         echo "Great! Looks like we can use the WIFxxx macros." >&4
77                         d_wifstat="$define"
78                 else
79                         echo "You don't seem to have WIFxxx macros, but that's ok." >&4
80                 fi
81         else
82                 echo "Apparently you can't use WIFxxx macros properly." >&4
83         fi
84         $rm -f foo.* foo core
85         ;;
86 esac
87