summaryrefslogtreecommitdiff
path: root/mcon/U/Guess.U
blob: 6f6e6b4c37a4b11d71ade26be23749ee760c5941 (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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
?RCS: $Id: Guess.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: Guess.U,v $
?RCS: Revision 3.0.1.5  1995/07/25  13:37:14  ram
?RCS: patch56: now knows about OS/2 platforms
?RCS:
?RCS: Revision 3.0.1.4  1994/10/29  15:53:55  ram
?RCS: patch36: added ?F: line for metalint file checking
?RCS: patch36: call ./xenix explicitely instead of relying on PATH
?RCS:
?RCS: Revision 3.0.1.3  1993/12/15  08:14:35  ram
?RCS: patch15: variable d_bsd was not always set properly
?RCS:
?RCS: Revision 3.0.1.2  1993/08/30  08:57:14  ram
?RCS: patch8: fixed comment which wrongly attributed the usrinc symbol
?RCS: patch8: no more ugly messages when no /usr/include/ctype.h
?RCS:
?RCS: Revision 3.0.1.1  1993/08/27  14:37:37  ram
?RCS: patch7: added support for OSF/1 machines
?RCS:
?RCS: Revision 3.0  1993/08/18  12:04:57  ram
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
?X: 
?X: This unit hazards some guesses as to what the general nature of the system
?X: is.  The information it collects here is used primarily to establish default
?X: answers to other questions.
?X: 
?MAKE:Guess d_eunice d_xenix d_bsd d_linux d_dos d_os2 d_windows: cat test \
	echo n c contains rm tr Loc eunicefix
?MAKE:	-pick add $@ %<
?S:d_eunice:
?S:	This variable conditionally defines the symbols EUNICE_SYSTEM, which
?S:	alerts the C program that it must deal with ideosyncracies of VMS.
?S:.
?S:d_xenix:
?S:	This variable conditionally defines the symbol XENIX_SYSTEM, which alerts
?S:	the C program that it runs under Xenix.
?S:.
?S:d_dos:
?S:	This symbol conditionally defines the symbol DOS_SYSTEM when running on
?S:	DOS with DJGPP or Cygwin.
?S:.
?S:d_os2:
?S:	This symbol conditionally defines the symbol OS2_SYSTEM when running on
?S:	an OS/2 system.
?S:.
?S:d_bsd:
?S:	This symbol conditionally defines the symbol BSD_SYSTEM when running on a
?S:	BSD system.
?S:.
?S:d_linux:
?S:	This symbol conditionally defines the symbol LINUX_SYSTEM when running
?S:	on a Linux system.
?S:.
?S:d_windows:
?S:	This symbol conditionally defines the symbol WINDOWS_SYSTEM when running
?S:	on a Windows system.
?S:.
?C:EUNICE_SYSTEM (EUNICE):
?C:	This symbol, if defined, indicates that the program is being compiled
?C:	under the EUNICE package under VMS.  The program will need to handle
?C:	things like files that don't go away the first time you unlink them,
?C:	due to version numbering.  It will also need to compensate for lack
?C:	of a respectable link() command.
?C:.
?C:VMS_SYSTEM (VMS):
?C:	This symbol, if defined, indicates that the program is running under
?C:	VMS.  It is currently only set in conjunction with the EUNICE symbol.
?C:.
?C:XENIX_SYSTEM (XENIX):
?C:	This symbol, if defined, indicates that the program is running under
?C:	Xenix (at least 3.0 ?).
?C:.
?C:DOS_SYSTEM:
?C:	This symbol, if defined, indicates that the program is running under
?C:	DOS with DJGPP.
?C:.
?C:OS2_SYSTEM:
?C:	This symbol, if defined, indicates that the program is running under
?C:	an OS/2 system.
?C:.
?C:BSD_SYSTEM:
?C:	This symbol, if defined, indicates that the program is running under
?C:	a BSD system.
?C:.
?C:LINUX_SYSTEM:
?C:	This symbol, if defined, indicates that the program is running under
?C:	a Linux system.
?C:.
?C:WINDOWS_SYSTEM:
?C:	This symbol, if defined, indicates that the program is running under
?C:	a Windows system.
?C:.
?H:#$d_eunice EUNICE_SYSTEM		/**/
?H:#$d_eunice VMS_SYSTEM		/**/
?H:#$d_xenix XENIX_SYSTEM		/**/
?H:#$d_dos DOS_SYSTEM		/**/
?H:#$d_os2 OS2_SYSTEM		/**/
?H:#$d_bsd BSD_SYSTEM		/**/
?H:#$d_linux LINUX_SYSTEM		/**/
?H:#$d_windows WINDOWS_SYSTEM		/**/
?H:.
?F:./bsd ./usg ./v7 ./osf1 ./eunice ./xenix ./venix ./dos ./os2 ./gnu
?F:./windows ./linux
?T:xxx DJGPP MACHTYPE
: make some quick guesses about what we are up against
echo " "
$echo $n "Hmm...  $c"
echo exit 1 >bsd
echo exit 1 >usg
echo exit 1 >v7
echo exit 1 >osf1
echo exit 1 >eunice
echo exit 1 >xenix
echo exit 1 >venix
echo exit 1 >os2
echo exit 1 >gnu
echo exit 1 >linux
echo exit 1 >dos
echo exit 1 >windows
d_bsd="$undef"
d_linux="$undef"
d_dos="$undef"
d_os2="$undef"
d_windows="$undef"
?X:
?X: Do not use 'usrinc', or we get a circular dependency. because
?X: usrinc is defined in usrinc.U, which relies on us...
?X:
$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
then
	echo "Looks kind of like an OSF/1 system, but we'll see..."
	echo exit 0 >osf1
elif test `echo abc | $tr a-z A-Z` = Abc ; then
	xxx=`./loc addbib blurfl $pth`
	if $test -f $xxx; then
	echo "Looks kind of like a USG system with BSD features, but we'll see..."
		echo exit 0 >bsd
		echo exit 0 >usg
	else
		if $contains SIGTSTP foo >/dev/null 2>&1 ; then
			echo "Looks kind of like an extended USG system, but we'll see..."
		else
			echo "Looks kind of like a USG system, but we'll see..."
		fi
		echo exit 0 >usg
	fi
elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
	echo "Looks kind of like a BSD system, but we'll see..."
	d_bsd="$define"
	echo exit 0 >bsd
elif
	$rm --version 2>/dev/null >foo;
	$contains "Free Software Foundation" foo >/dev/null
then
	xxx=`uname`
	echo exit 0 >gnu
	echo "Looks kind of like a GNU/$xxx system, but we'll see..."
	if $test X$xxx = XLinux; then
		d_linux="$define"
		echo exit 0 >linux
	fi
else
	echo "Looks kind of like a Version 7 system, but we'll see..."
	echo exit 0 >v7
fi
case "$eunicefix" in
*unixtovms*)
	$cat <<'EOI'
There is, however, a strange, musty smell in the air that reminds me of
something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
EOI
	echo exit 0 >eunice
	d_eunice="$define"
: it so happens the Eunice I know will not run shell scripts in Unix format
	;;
*)
	echo " "
	echo "Congratulations.  You aren't running Eunice."
	d_eunice="$undef"
	;;
esac
if test -d c:/.; then
	case "X${MACHTYPE:-nonesuchmach}" in
	*cygwin) echo " "; echo "Hah!... you're running under Cygwin!";;
	*msys) echo " "; echo "Hah!... you're running under MinGW!";;
	esac
	case "X${MACHTYPE:-nonesuchmach}" in
	*cygwin|*msys)
		echo exit 0 >windows
		d_windows="$define"
		;;
	esac
fi
case "$p_" in
:) ;;
*)
	$cat <<'EOI'
I have the feeling something is not exactly right, however...don't tell me...
EOI
	if test -n "$DJGPP"; then
		echo exit 0 >dos
		d_dos="$define"
	else
		$cat <<'EOI'
lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
EOI
		echo exit 0 >os2
		d_os2="$define"
	fi
	;;
esac
if test -f /xenix; then
	echo "Actually, this looks more like a XENIX system..."
	echo exit 0 >xenix
	d_xenix="$define"
else
	echo " "
	echo "It's not Xenix..."
	d_xenix="$undef"
fi
chmod +x xenix
$eunicefix xenix
if test -f /venix; then
	echo "Actually, this looks more like a VENIX system..."
	echo exit 0 >venix
else
	echo " "
	if ./xenix; then
		: null
	else
		echo "Nor is it Venix..."
	fi
fi
chmod +x bsd usg v7 osf1 eunice xenix venix dos os2 gnu linux windows
$eunicefix bsd usg v7 osf1 eunice xenix venix dos os2 gnu linux windows
$rm -f foo