| 1 | ?RCS: $Id: d_getpgrp.U,v 3.0.1.1 1997/02/28 15:34:28 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 License, |
| 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 License; 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_getpgrp.U,v $ |
| 12 | ?RCS: Revision 3.0.1.1 1997/02/28 15:34:28 ram |
| 13 | ?RCS: patch61: new USE_BSD_GETPGRP to detect the getpgrp() flavor |
| 14 | ?RCS: |
| 15 | ?RCS: Revision 3.0 1993/08/18 12:06:15 ram |
| 16 | ?RCS: Baseline for dist 3.0 netwide release. |
| 17 | ?RCS: |
| 18 | ?MAKE:d_getpgrp d_bsdgetpgrp: Guess Inlibc Setvar cat rm_try \ |
| 19 | +cc +ccflags +ldflags +libs i_unistd i_stdlib run |
| 20 | ?MAKE: -pick add $@ %< |
| 21 | ?S:d_getpgrp: |
| 22 | ?S: This variable conditionally defines HAS_GETPGRP if getpgrp() is |
| 23 | ?S: available to get the current process group. |
| 24 | ?S:. |
| 25 | ?S:d_bsdgetpgrp: |
| 26 | ?S: This variable conditionally defines USE_BSD_GETPGRP if |
| 27 | ?S: getpgrp needs one arguments whereas USG one needs none. |
| 28 | ?S:. |
| 29 | ?C:HAS_GETPGRP (GETPGRP): |
| 30 | ?C: This symbol, if defined, indicates that the getpgrp routine is |
| 31 | ?C: available to get the current process group. |
| 32 | ?C:. |
| 33 | ?C:USE_BSD_GETPGRP: |
| 34 | ?C: This symbol, if defined, indicates that getpgrp needs one |
| 35 | ?C: arguments whereas USG one needs none. |
| 36 | ?C:. |
| 37 | ?H:#$d_getpgrp HAS_GETPGRP /**/ |
| 38 | ?H:#$d_bsdgetpgrp USE_BSD_GETPGRP /**/ |
| 39 | ?H:. |
| 40 | ?T:xxx |
| 41 | ?F:!try |
| 42 | ?LINT:set d_getpgrp d_bsdgetpgrp |
| 43 | : see if getpgrp exists |
| 44 | set getpgrp d_getpgrp |
| 45 | eval $inlibc |
| 46 | |
| 47 | @if USE_BSD_GETPGRP || d_bsdgetpgrp |
| 48 | case "$d_getpgrp" in |
| 49 | "$define") |
| 50 | echo " " |
| 51 | echo "Checking to see which flavor of getpgrp is in use..." |
| 52 | $cat >try.c <<EOP |
| 53 | #include <stdio.h> |
| 54 | #$i_unistd I_UNISTD |
| 55 | #include <sys/types.h> |
| 56 | #ifdef I_UNISTD |
| 57 | # include <unistd.h> |
| 58 | #endif |
| 59 | #$i_stdlib I_STDLIB |
| 60 | #ifdef I_STDLIB |
| 61 | #include <stdlib.h> |
| 62 | #endif |
| 63 | int main() |
| 64 | { |
| 65 | if (getuid() == 0) { |
| 66 | printf("(I see you are running Configure as super-user...)\n"); |
| 67 | setuid(1); |
| 68 | } |
| 69 | #ifdef TRY_BSD_PGRP |
| 70 | if (getpgrp(1) == 0) |
| 71 | exit(0); |
| 72 | #else |
| 73 | if (getpgrp() > 0) |
| 74 | exit(0); |
| 75 | #endif |
| 76 | exit(1); |
| 77 | } |
| 78 | EOP |
| 79 | if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then |
| 80 | echo "You have to use getpgrp(pid) instead of getpgrp()." >&4 |
| 81 | val="$define" |
| 82 | elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then |
| 83 | echo "You have to use getpgrp() instead of getpgrp(pid)." >&4 |
| 84 | val="$undef" |
| 85 | else |
| 86 | echo "I can't seem to compile and run the test program." |
| 87 | if ./usg; then |
| 88 | xxx="a USG one, i.e. you use getpgrp()." |
| 89 | else |
| 90 | # SVR4 systems can appear rather BSD-ish. |
| 91 | case "$i_unistd" in |
| 92 | $undef) |
| 93 | xxx="a BSD one, i.e. you use getpgrp(pid)." |
| 94 | val="$define" |
| 95 | ;; |
| 96 | $define) |
| 97 | xxx="probably a USG one, i.e. you use getpgrp()." |
| 98 | val="$undef" |
| 99 | ;; |
| 100 | esac |
| 101 | fi |
| 102 | echo "Assuming your getpgrp is $xxx" >&4 |
| 103 | fi |
| 104 | ;; |
| 105 | *) val="$undef";; |
| 106 | esac |
| 107 | set d_bsdgetpgrp |
| 108 | eval $setvar |
| 109 | $rm_try |
| 110 | @end |
| 111 | |