This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[UTIL] Perl system does not default to $_
[metaconfig.git] / dist / U / d_setpgrp.U
CommitLineData
33a01fd2 1?RCS: $Id$
d8875586
MBT
2?RCS:
3?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
4?RCS:
33a01fd2 5?RCS: You may redistribute only under the terms of the Artistic License,
d8875586
MBT
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
33a01fd2 8?RCS: that same Artistic License; a copy of which may be found at the root
d8875586
MBT
9?RCS: of the source tree for dist 4.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)
33a01fd2 22?RCS: patch36: call ./usg explicitely instead of relying on PATH
d8875586
MBT
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 \
28 +ldflags Inlibc Guess Setvar i_unistd
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?F:!set.c !set
52?T:xxx
53?LINT:set d_setpgrp d_bsdsetpgrp
54: see if setpgrp exists
55set setpgrp d_setpgrp
56eval $inlibc
57
58@if USE_BSD_SETPGRP || d_bsdsetpgrp
59case "$d_setpgrp" in
60"$define")
61 echo " "
62 echo "Checking to see which flavor of setpgrp is in use..."
63 $cat >set.c <<EOP
64#$i_unistd I_UNISTD
65#include <sys/types.h>
66#ifdef I_UNISTD
67# include <unistd.h>
68#endif
69int main()
70{
71 if (getuid() == 0) {
72 printf("(I see you are running Configure as super-user...)\n");
73 setuid(1);
74 }
75#ifdef TRY_BSD_PGRP
76 if (-1 == setpgrp(1, 1))
77 exit(0);
78#else
79 if (setpgrp() != -1)
80 exit(0);
81#endif
82 exit(1);
83}
84EOP
85 if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
86 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
87 val="$define"
88 elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
89 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
90 val="$undef"
91 else
92 echo "(I can't seem to compile and run the test program.)"
93 if ./usg; then
94 xxx="a USG one, i.e. you use setpgrp()."
95 else
96 # SVR4 systems can appear rather BSD-ish.
97 case "$i_unistd" in
98 $undef)
99 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
100 val="$define"
101 ;;
102 $define)
103 xxx="probably a USG one, i.e. you use setpgrp()."
104 val="$undef"
105 ;;
106 esac
107 fi
108 echo "Assuming your setpgrp is $xxx" >&4
109 fi
110 ;;
111*) val="$undef";;
112esac
113set d_bsdsetpgrp
114eval $setvar
115$rm -f set set.c
116@end