summaryrefslogtreecommitdiff
path: root/mcon/U/d_SHM_MAC.U
blob: bcf30e2f0117d3973f20d4415d6326bbe1ffbc33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
?RCS: $Id: d_SHM_MAC.U 167 2013-05-08 17:58:00Z rmanfredi $
?RCS:
?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
?RCS: 
?RCS: You may redistribute only under the terms of the Artistic License,
?RCS: as specified in the README file that comes with the distribution.
?RCS: You may reuse parts of this distribution only within the terms of
?RCS: that same Artistic License; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS:
?RCS: $Log: d_SHM_MAC.U,v $
?RCS: Revision 3.0  1993/08/18  12:05:41  ram
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
?MAKE:d_SHM_MAC d_SHM_PRM d_SHM_SEG d_SHM_IMMU: cat d_shm test rm +cc +ccflags
?MAKE:	-pick add $@ %<
?S:d_SHM_MAC:
?S:	Sometimes, the SHMLBA manifest needs sys/sysmacros.h, usually for
?S:	the ctob() macro.
?S:.
?S:d_SHM_PRM:
?S:	Sometimes, the SHMLBA manifest needs sys/param.h, usually for the
?S:	NBPC constant.
?S:.
?S:d_SHM_SEG:
?S:	Sometimes, the SHMLBA manifest needs sys/seg.h, usually for the
?S:	SNUMSHFT constant.
?S:.
?S:d_SHM_IMMU:
?S:	Sometimes, the SHMLBA manifest needs sys/immu.h, usually for the
?S:	stob() macro.
?S:.
?C:SHMLBA_WANTS_SYSMACROS:
?C:	This value tells us to include <sys/sysmacros.h> because SHMLBA
?C:	needs something from there, probably the ctob() macro.
?C:.
?C:SHMLBA_WANTS_PARAM:
?C:	This value tells us to include <sys/param.h> because SHMLBA needs
?C:	something from there, probably the NBPC constant.
?C:.
?C:SHMLBA_WANTS_SEG:
?C:	This value tells us to include <sys/seg.h> because SHMLBA needs
?C:	something from there, probably the SNUMSHFT constant.
?C:.
?C:SHMLBA_WANTS_IMMU:
?C:	This value tells us to include <sys/immu.h> because SHMLBA needs
?C:	something from there, probably the stob() macro.  (tower_600 only?)
?C:.
?H:#$d_SHM_MAC	SHMLBA_WANTS_SYSMACROS	/* SHMLBA wants ctob()? */
?H:#$d_SHM_PRM	SHMLBA_WANTS_PARAM	/* SHMLBA wants NBPC? */
?H:#$d_SHM_SEG	SHMLBA_WANTS_SEG	/* SHMLBA wants SNUMSHFT? */
?H:#$d_SHM_IMMU	SHMLBA_WANTS_IMMU	/* SHMLBA wants stob()? */
?H:.
?T:flags D_sys_immu D_sys_seg D_sys_sysmacros D_sys_param
: check for SHMLBA braindamage
d_SHM_MAC="$undef"
d_SHM_PRM="$undef"
d_SHM_SEG="$undef"
d_SHM_IMMU="$undef"
if $test "$d_shm" = "$define" ; then
	echo " "
	$cat >&4 <<EOM
Checking to see if SHMLBA needs additional headers.
The headers I'll be checking are:

    sys/macros.h (for the ctob() macro)
    sys/param.h  (for NBPC)
    sys/seg.h    (for SNUMSHFT)
    sys/immu.h	 (for the stob() macro)

EOM
	$cat >shm_mac.c <<'EOCP'
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#ifdef I_SYS_IMMU
#include <sys/immu.h>
#endif
#ifdef I_SYS_SYSMACROS
#include <sys/sysmacros.h>
#endif
#ifdef I_SYS_PARAM
#include <sys/param.h>
#endif
#ifdef I_SYS_SEG
#include <sys/seg.h>
#endif

int main() {
	int foo = SHMLBA ;
	}
EOCP
	flags='xxx'
	for D_sys_immu in '' '-DI_SYS_IMMU'; do
	for D_sys_seg in '' '-DI_SYS_SEG'; do
	for D_sys_sysmacros in '' '-DI_SYS_SYSMACROS'; do
	for D_sys_param in '' '-DI_SYS_PARAM'; do
		case "$flags" in
		'xxx')
			case "$D_sys_immu$D_sys_param$D_sys_sysmacros$D_sys_seg" in
			'')
				echo "Trying it normally..."
				;;
			*)
			echo "Trying $D_sys_immu $D_sys_param $D_sys_sysmacros $D_sys_seg"
			;;
			esac
			if $cc $ccflags \
			$D_sys_immu $D_sys_param $D_sys_sysmacros $D_sys_seg \
			-o shm_mac shm_mac.c >/dev/null 2>&1 ; then
				set X $D_sys_immu $D_sys_param $D_sys_sysmacros $D_sys_seg
				shift
				flags="$*"
				echo "Succeeded with $flags"
			fi
			;;
		esac
	done
	done
	done
	done
	case "$flags" in
	xxx)
		echo "I don't know how to keep SHMLBA happy.  Good luck!"
		;;
	esac
	case "$flags" in
	*I_SYS_PARAM*) d_SHM_PRM="$define";;
	esac
	case "$flags" in
	*I_SYS_SYSMACROS*) d_SHM_MAC="$define";;
	esac
	case "$flags" in
	*I_SYS_SEG*) d_SHM_SEG="$define";;
	esac
	case "$flags" in
	*I_SYS_IMMU*) d_SHM_IMMU="$define";;
	esac
fi
$rm -f shm_mac*