Commit | Line | Data |
---|---|---|
d8875586 MBT |
1 | ?RCS: $Id: d_shmat.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_shmat.U,v $ | |
12 | ?RCS: Revision 3.0.1.3 1995/07/25 14:04:23 ram | |
13 | ?RCS: patch56: use findhdr to find <sys/shm.h>, to get the right one (ADO) | |
14 | ?RCS: | |
15 | ?RCS: Revision 3.0.1.2 1994/05/13 15:18:56 ram | |
16 | ?RCS: patch27: added new symbol HAS_SHMAT_PROTOTYPE (ADO) | |
17 | ?RCS: | |
18 | ?RCS: Revision 3.0.1.1 1994/05/06 14:54:18 ram | |
19 | ?RCS: patch23: new Shmat_t symbol to declare return type of shmat() | |
20 | ?RCS: | |
21 | ?RCS: Revision 3.0 1993/08/18 12:07:18 ram | |
22 | ?RCS: Baseline for dist 3.0 netwide release. | |
23 | ?RCS: | |
24 | ?MAKE:d_shmat shmattype d_shmatprototype: Inlibc cat +cc +ccflags \ | |
25 | rm cppstdin cppflags cppminus Findhdr Setvar contains | |
26 | ?MAKE: -pick add $@ %< | |
27 | ?S:d_shmat: | |
28 | ?S: This variable conditionally defines the HAS_SHMAT symbol, which | |
29 | ?S: indicates to the C program that the shmat() routine is available. | |
30 | ?S:. | |
31 | ?S:shmattype: | |
32 | ?S: This symbol contains the type of pointer returned by shmat(). | |
33 | ?S: It can be 'void *' or 'char *'. | |
34 | ?S:. | |
35 | ?S:d_shmatprototype: | |
36 | ?S: This variable conditionally defines the HAS_SHMAT_PROTOTYPE | |
37 | ?S: symbol, which indicates that sys/shm.h has a prototype for | |
38 | ?S: shmat. | |
39 | ?S:. | |
40 | ?C:HAS_SHMAT: | |
41 | ?C: This symbol, if defined, indicates that the shmat() routine is | |
42 | ?C: available to attach a shared memory segment to the process space. | |
43 | ?C:. | |
44 | ?C:Shmat_t: | |
45 | ?C: This symbol holds the return type of the shmat() system call. | |
46 | ?C: Usually set to 'void *' or 'char *'. | |
47 | ?C:. | |
48 | ?C:HAS_SHMAT_PROTOTYPE: | |
49 | ?C: This symbol, if defined, indicates that the sys/shm.h includes | |
50 | ?C: a prototype for shmat(). Otherwise, it is up to the program to | |
51 | ?C: guess one. Shmat_t shmat _((int, Shmat_t, int)) is a good guess, | |
52 | ?C: but not always right so it should be emitted by the program only | |
53 | ?C: when HAS_SHMAT_PROTOTYPE is not defined to avoid conflicting defs. | |
54 | ?C:. | |
55 | ?H:#$d_shmat HAS_SHMAT /**/ | |
56 | ?H:#define Shmat_t $shmattype /**/ | |
57 | ?H:#$d_shmatprototype HAS_SHMAT_PROTOTYPE /**/ | |
58 | ?H:. | |
59 | ?LINT:set d_shmat d_shmatprototype | |
60 | ?T:xxx | |
61 | : see if shmat exists | |
62 | set shmat d_shmat | |
63 | eval $inlibc | |
64 | : see what shmat returns | |
65 | case "$d_shmat" in | |
66 | "$define") | |
67 | $cat >shmat.c <<'END' | |
68 | #include <sys/shm.h> | |
69 | void *shmat(); | |
70 | END | |
71 | if $cc $ccflags -c shmat.c >/dev/null 2>&1; then | |
72 | shmattype='void *' | |
73 | else | |
74 | shmattype='char *' | |
75 | fi | |
76 | echo "and it returns ($shmattype)." >&4 | |
77 | : see if a prototype for shmat is available | |
78 | xxx=`./findhdr sys/shm.h` | |
79 | $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null | |
80 | if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then | |
81 | val="$define" | |
82 | else | |
83 | val="$undef" | |
84 | fi | |
85 | $rm -f shmat.[co] | |
86 | ;; | |
87 | *) | |
88 | val="$undef" | |
89 | ;; | |
90 | esac | |
91 | set d_shmatprototype | |
92 | eval $setvar | |
93 |