Commit | Line | Data |
---|---|---|
ff19f974 JH |
1 | ?RCS: $Id: d_setpgrp.U,v 3.0.1.3 1997/02/28 15:44:16 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_setpgrp.U,v $ | |
12 | ?RCS: Revision 3.0.1.3 1997/02/28 15:44:16 ram | |
13 | ?RCS: patch61: obsoleted USE_BSDGRP in favor of USE_BSD_SETPGRP | |
14 | ?RCS: patch61: another unit now also defines a USE_BSD_GETPGRP | |
15 | ?RCS: patch61: fallback for test program failure improved | |
16 | ?RCS: | |
17 | ?RCS: Revision 3.0.1.2 1995/07/25 13:59:30 ram | |
18 | ?RCS: patch56: re-arranged compile line to include ldflags before objects | |
19 | ?RCS: | |
20 | ?RCS: Revision 3.0.1.1 1994/10/29 16:15:37 ram | |
21 | ?RCS: patch36: added 'ldflags' to the test compile line (ADO) | |
22 | ?RCS: patch36: call ./usg explicitely instead of relying on PATH | |
23 | ?RCS: | |
24 | ?RCS: Revision 3.0 1993/08/18 12:07:09 ram | |
25 | ?RCS: Baseline for dist 3.0 netwide release. | |
26 | ?RCS: | |
27 | ?MAKE:d_setpgrp d_bsdsetpgrp: cat rm +cc +libs +ccflags \ | |
0f00356b | 28 | +ldflags Inlibc Guess Setvar i_unistd run |
ff19f974 JH |
29 | ?MAKE: -pick add $@ %< |
30 | ?S:d_setpgrp: | |
31 | ?S: This variable conditionally defines HAS_SETPGRP if setpgrp() is | |
32 | ?S: available to set the current process group. | |
33 | ?S:. | |
34 | ?S:d_bsdsetpgrp (d_bsdpgrp): | |
35 | ?S: This variable conditionally defines USE_BSD_SETPGRP if | |
36 | ?S: setpgrp needs two arguments whereas USG one needs none. | |
37 | ?S: See also d_setpgid for a POSIX interface. | |
38 | ?S:. | |
39 | ?C:HAS_SETPGRP (SETPGRP): | |
40 | ?C: This symbol, if defined, indicates that the setpgrp routine is | |
41 | ?C: available to set the current process group. | |
42 | ?C:. | |
43 | ?C:USE_BSD_SETPGRP (USE_BSDPGRP BSDPGRP): | |
44 | ?C: This symbol, if defined, indicates that setpgrp needs two | |
45 | ?C: arguments whereas USG one needs none. See also HAS_SETPGID | |
46 | ?C: for a POSIX interface. | |
47 | ?C:. | |
48 | ?H:#$d_setpgrp HAS_SETPGRP /**/ | |
49 | ?H:#$d_bsdsetpgrp USE_BSD_SETPGRP /**/ | |
50 | ?H:. | |
51 | ?T:xxx | |
52 | ?LINT:set d_setpgrp d_bsdsetpgrp | |
53 | : see if setpgrp exists | |
54 | set setpgrp d_setpgrp | |
55 | eval $inlibc | |
56 | ||
57 | @if USE_BSD_SETPGRP || d_bsdsetpgrp | |
58 | case "$d_setpgrp" in | |
59 | "$define") | |
60 | echo " " | |
61 | echo "Checking to see which flavor of setpgrp is in use..." | |
0f00356b | 62 | $cat >try.c <<EOP |
ff19f974 JH |
63 | #$i_unistd I_UNISTD |
64 | #include <sys/types.h> | |
65 | #ifdef I_UNISTD | |
66 | # include <unistd.h> | |
67 | #endif | |
68 | int main() | |
69 | { | |
70 | if (getuid() == 0) { | |
71 | printf("(I see you are running Configure as super-user...)\n"); | |
72 | setuid(1); | |
73 | } | |
74 | #ifdef TRY_BSD_PGRP | |
75 | if (-1 == setpgrp(1, 1)) | |
76 | exit(0); | |
77 | #else | |
78 | if (setpgrp() != -1) | |
79 | exit(0); | |
80 | #endif | |
81 | exit(1); | |
82 | } | |
83 | EOP | |
0f00356b | 84 | if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then |
ff19f974 JH |
85 | echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4 |
86 | val="$define" | |
0f00356b | 87 | elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then |
ff19f974 JH |
88 | echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4 |
89 | val="$undef" | |
90 | else | |
91 | echo "(I can't seem to compile and run the test program.)" | |
92 | if ./usg; then | |
93 | xxx="a USG one, i.e. you use setpgrp()." | |
94 | else | |
95 | # SVR4 systems can appear rather BSD-ish. | |
96 | case "$i_unistd" in | |
97 | $undef) | |
98 | xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)." | |
99 | val="$define" | |
100 | ;; | |
101 | $define) | |
102 | xxx="probably a USG one, i.e. you use setpgrp()." | |
103 | val="$undef" | |
104 | ;; | |
105 | esac | |
106 | fi | |
107 | echo "Assuming your setpgrp is $xxx" >&4 | |
108 | fi | |
109 | ;; | |
110 | *) val="$undef";; | |
111 | esac | |
112 | set d_bsdsetpgrp | |
113 | eval $setvar | |
0f00356b | 114 | $rm -f try try.* |
ff19f974 | 115 | @end |