Commit | Line | Data |
---|---|---|
d8875586 MBT |
1 | ?RCS: $Id: Guess.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: Guess.U,v $ | |
12 | ?RCS: Revision 3.0.1.5 1995/07/25 13:37:14 ram | |
13 | ?RCS: patch56: now knows about OS/2 platforms | |
14 | ?RCS: | |
15 | ?RCS: Revision 3.0.1.4 1994/10/29 15:53:55 ram | |
16 | ?RCS: patch36: added ?F: line for metalint file checking | |
17 | ?RCS: patch36: call ./xenix explicitly instead of relying on PATH | |
18 | ?RCS: | |
19 | ?RCS: Revision 3.0.1.3 1993/12/15 08:14:35 ram | |
20 | ?RCS: patch15: variable d_bsd was not always set properly | |
21 | ?RCS: | |
22 | ?RCS: Revision 3.0.1.2 1993/08/30 08:57:14 ram | |
23 | ?RCS: patch8: fixed comment which wrongly attributed the usrinc symbol | |
24 | ?RCS: patch8: no more ugly messages when no /usr/include/ctype.h | |
25 | ?RCS: | |
26 | ?RCS: Revision 3.0.1.1 1993/08/27 14:37:37 ram | |
27 | ?RCS: patch7: added support for OSF/1 machines | |
28 | ?RCS: | |
29 | ?RCS: Revision 3.0 1993/08/18 12:04:57 ram | |
30 | ?RCS: Baseline for dist 3.0 netwide release. | |
31 | ?RCS: | |
32 | ?X: | |
33 | ?X: This unit hazards some guesses as to what the general nature of the system | |
34 | ?X: is. The information it collects here is used primarily to establish default | |
35 | ?X: answers to other questions. | |
36 | ?X: | |
37 | ?MAKE:Guess d_eunice d_xenix d_bsd d_linux d_dos d_os2: cat test echo n c \ | |
38 | contains rm tr Loc eunicefix | |
39 | ?MAKE: -pick add $@ %< | |
40 | ?S:d_eunice: | |
41 | ?S: This variable conditionally defines the symbols EUNICE_SYSTEM, which | |
42 | ?S: alerts the C program that it must deal with ideosyncracies of VMS. | |
43 | ?S:. | |
44 | ?S:d_xenix: | |
45 | ?S: This variable conditionally defines the symbol XENIX_SYSTEM, which alerts | |
46 | ?S: the C program that it runs under Xenix. | |
47 | ?S:. | |
48 | ?S:d_dos: | |
49 | ?S: This symbol conditionally defines the symbol DOS_SYSTEM when running on | |
50 | ?S: DOS with DJGPP or Cygwin. | |
51 | ?S:. | |
52 | ?S:d_os2: | |
53 | ?S: This symbol conditionally defines the symbol OS2_SYSTEM when running on | |
54 | ?S: an OS/2 system. | |
55 | ?S:. | |
56 | ?S:d_bsd: | |
57 | ?S: This symbol conditionally defines the symbol BSD_SYSTEM when running on a | |
58 | ?S: BSD system. | |
59 | ?S:. | |
60 | ?S:d_linux: | |
61 | ?S: This symbol conditionally defines the symbol LINUX_SYSTEM when running | |
62 | ?S: on a Linux system. | |
63 | ?S:. | |
64 | ?C:EUNICE_SYSTEM (EUNICE): | |
65 | ?C: This symbol, if defined, indicates that the program is being compiled | |
66 | ?C: under the EUNICE package under VMS. The program will need to handle | |
67 | ?C: things like files that don't go away the first time you unlink them, | |
68 | ?C: due to version numbering. It will also need to compensate for lack | |
69 | ?C: of a respectable link() command. | |
70 | ?C:. | |
71 | ?C:VMS_SYSTEM (VMS): | |
72 | ?C: This symbol, if defined, indicates that the program is running under | |
73 | ?C: VMS. It is currently only set in conjunction with the EUNICE symbol. | |
74 | ?C:. | |
75 | ?C:XENIX_SYSTEM (XENIX): | |
76 | ?C: This symbol, if defined, indicates that the program is running under | |
77 | ?C: Xenix (at least 3.0 ?). | |
78 | ?C:. | |
79 | ?C:DOS_SYSTEM: | |
80 | ?C: This symbol, if defined, indicates that the program is running under | |
81 | ?C: DOS with DJGPP. | |
82 | ?C:. | |
83 | ?C:OS2_SYSTEM: | |
84 | ?C: This symbol, if defined, indicates that the program is running under | |
85 | ?C: an OS/2 system. | |
86 | ?C:. | |
87 | ?C:BSD_SYSTEM: | |
88 | ?C: This symbol, if defined, indicates that the program is running under | |
89 | ?C: a BSD system. | |
90 | ?C:. | |
91 | ?C:LINUX_SYSTEM: | |
92 | ?C: This symbol, if defined, indicates that the program is running under | |
93 | ?C: a Linux system. | |
94 | ?C:. | |
95 | ?H:#$d_eunice EUNICE_SYSTEM /**/ | |
96 | ?H:#$d_eunice VMS_SYSTEM /**/ | |
97 | ?H:#$d_xenix XENIX_SYSTEM /**/ | |
98 | ?H:#$d_dos DOS_SYSTEM /**/ | |
99 | ?H:#$d_os2 OS2_SYSTEM /**/ | |
100 | ?H:#$d_bsd BSD_SYSTEM /**/ | |
101 | ?H:#$d_linux LINUX_SYSTEM /**/ | |
102 | ?H:. | |
103 | ?F:./bsd ./usg ./v7 ./osf1 ./eunice ./xenix ./venix ./dos ./os2 ./gnu ./linux | |
104 | ?T:xxx DJGPP MACHTYPE | |
105 | : make some quick guesses about what we are up against | |
106 | echo " " | |
107 | $echo $n "Hmm... $c" | |
108 | echo exit 1 >bsd | |
109 | echo exit 1 >usg | |
110 | echo exit 1 >v7 | |
111 | echo exit 1 >osf1 | |
112 | echo exit 1 >eunice | |
113 | echo exit 1 >xenix | |
114 | echo exit 1 >venix | |
115 | echo exit 1 >os2 | |
116 | echo exit 1 >gnu | |
117 | echo exit 1 >linux | |
118 | echo exit 1 >dos | |
119 | d_bsd="$undef" | |
120 | d_linux="$undef" | |
121 | d_dos="$undef" | |
122 | d_os2="$undef" | |
123 | ?X: | |
124 | ?X: Do not use 'usrinc', or we get a circular dependency. because | |
125 | ?X: usrinc is defined in usrinc.U, which relies on us... | |
126 | ?X: | |
127 | $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null | |
128 | if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1 | |
129 | then | |
130 | echo "Looks kind of like an OSF/1 system, but we'll see..." | |
131 | echo exit 0 >osf1 | |
132 | elif test `echo abc | $tr a-z A-Z` = Abc ; then | |
133 | xxx=`./loc addbib blurfl $pth` | |
134 | if $test -f $xxx; then | |
135 | echo "Looks kind of like a USG system with BSD features, but we'll see..." | |
136 | echo exit 0 >bsd | |
137 | echo exit 0 >usg | |
138 | else | |
139 | if $contains SIGTSTP foo >/dev/null 2>&1 ; then | |
140 | echo "Looks kind of like an extended USG system, but we'll see..." | |
141 | else | |
142 | echo "Looks kind of like a USG system, but we'll see..." | |
143 | fi | |
144 | echo exit 0 >usg | |
145 | fi | |
146 | elif $contains SIGTSTP foo >/dev/null 2>&1 ; then | |
147 | echo "Looks kind of like a BSD system, but we'll see..." | |
148 | d_bsd="$define" | |
149 | echo exit 0 >bsd | |
150 | elif | |
151 | $rm --version 2>/dev/null >foo; | |
152 | $contains "Free Software Foundation" foo >/dev/null | |
153 | then | |
154 | xxx=`uname` | |
155 | echo exit 0 >gnu | |
156 | echo "Looks kind of like a GNU/$xxx system, but we'll see..." | |
157 | if $test X$xxx = XLinux; then | |
158 | d_linux="$define" | |
159 | echo exit 0 >linux | |
160 | fi | |
161 | else | |
162 | echo "Looks kind of like a Version 7 system, but we'll see..." | |
163 | echo exit 0 >v7 | |
164 | fi | |
165 | case "$eunicefix" in | |
166 | *unixtovms*) | |
167 | $cat <<'EOI' | |
168 | There is, however, a strange, musty smell in the air that reminds me of | |
169 | something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit. | |
170 | EOI | |
171 | echo exit 0 >eunice | |
172 | d_eunice="$define" | |
173 | : it so happens the Eunice I know will not run shell scripts in Unix format | |
174 | ;; | |
175 | *) | |
176 | echo " " | |
177 | echo "Congratulations. You aren't running Eunice." | |
178 | d_eunice="$undef" | |
179 | ;; | |
180 | esac | |
181 | case "$p_" in | |
182 | :) ;; | |
183 | *) | |
184 | $cat <<'EOI' | |
185 | I have the feeling something is not exactly right, however...don't tell me... | |
186 | EOI | |
187 | if test -n "$DJGPP"; then | |
188 | case "X${MACHTYPE:-nonesuchmach}" in | |
189 | cygwin) echo "hah!... you're running under Cygwin!";; | |
190 | *) echo "got it... you're running DOS with DJGPP!";; | |
191 | esac | |
192 | echo exit 0 >dos | |
193 | d_dos="$define" | |
194 | else | |
195 | $cat <<'EOI' | |
196 | lemme think...does HAL ring a bell?...no, of course, you're only running OS/2! | |
197 | EOI | |
198 | echo exit 0 >os2 | |
199 | d_os2="$define" | |
200 | fi | |
201 | ;; | |
202 | esac | |
203 | if test -f /xenix; then | |
204 | echo "Actually, this looks more like a XENIX system..." | |
205 | echo exit 0 >xenix | |
206 | d_xenix="$define" | |
207 | else | |
208 | echo " " | |
209 | echo "It's not Xenix..." | |
210 | d_xenix="$undef" | |
211 | fi | |
212 | chmod +x xenix | |
213 | $eunicefix xenix | |
214 | if test -f /venix; then | |
215 | echo "Actually, this looks more like a VENIX system..." | |
216 | echo exit 0 >venix | |
217 | else | |
218 | echo " " | |
219 | if ./xenix; then | |
220 | : null | |
221 | else | |
222 | echo "Nor is it Venix..." | |
223 | fi | |
224 | fi | |
225 | chmod +x bsd usg v7 osf1 eunice xenix venix dos os2 gnu linux | |
226 | $eunicefix bsd usg v7 osf1 eunice xenix venix dos os2 gnu linux | |
227 | $rm -f foo | |
228 |