]> git.ipfire.org Git - thirdparty/openssl.git/blob - config
Import of old SSLeay release: SSLeay 0.9.0b
[thirdparty/openssl.git] / config
1 #!/bin/sh
2 #
3 # config - this is a merge of minarch and GuessOS from the Apache Group
4 # which then automatically runs Configure from SSLeay after
5 # mapping the Apache names for OSs into SSLeay names
6 #
7 # 16-Sep-97 tjh first cut of merged version
8 #
9 # Tim Hudson
10 # tjh@cryptsoft.com
11 #
12
13 # Original Apache Group comments on GuessOS
14
15 # Simple OS/Platform guesser. Similar to config.guess but
16 # much, much smaller. Since it was developed for use with
17 # Apache, it follows under Apache's regular licensing
18 # with one specific addition: Any changes or additions
19 # to this script should be Emailed to the Apache
20 # group (apache@apache.org) in general and to
21 # Jim Jagielski (jim@jaguNET.com) in specific.
22 #
23 # Be as similar to the output of config.guess/config.sub
24 # as possible.
25
26 # First get uname entries that we use below
27
28 MACHINE=`(uname -m) 2>/dev/null` || MACHINE="unknown"
29 RELEASE=`(uname -r) 2>/dev/null` || RELEASE="unknown"
30 SYSTEM=`(uname -s) 2>/dev/null` || SYSTEM="unknown"
31 VERSION=`(uname -v) 2>/dev/null` || VERSION="unknown"
32
33
34 # Now test for ISC and SCO, since it is has a braindamaged uname.
35 #
36 # We need to work around FreeBSD 1.1.5.1
37 (
38 XREL=`uname -X 2>/dev/null | grep "^Release" | awk '{print $3}'`
39 if [ "x$XREL" != "x" ]; then
40 if [ -f /etc/kconfig ]; then
41 case "$XREL" in
42 4.0|4.1)
43 echo "${MACHINE}-whatever-isc4"; exit 0
44 ;;
45 esac
46 else
47 case "$XREL" in
48 3.2v4.2)
49 echo "whatever-whatever-sco3"; exit 0
50 ;;
51 3.2v5.0*)
52 echo "whatever-whatever-sco5"; exit 0
53 ;;
54 4.2MP)
55 if [ "x$VERSION" = "x2.1.1" ]; then
56 echo "${MACHINE}-whatever-unixware211"; exit 0
57 else
58 echo "${MACHINE}-whatever-unixware2"; exit 0
59 fi
60 ;;
61 4.2)
62 echo "whatever-whatever-unixware1"; exit 0
63 ;;
64 esac
65 fi
66 fi
67 # Now we simply scan though... In most cases, the SYSTEM info is enough
68 #
69 case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
70 A/UX:*)
71 echo "m68k-apple-aux3"; exit 0
72 ;;
73
74 AIX:*)
75 echo "${MACHINE}-ibm-aix"; exit 0
76 ;;
77
78 dgux:*)
79 echo "${MACHINE}-dg-dgux"; exit 0
80 ;;
81
82 HI-UX:*)
83 echo "${MACHINE}-hi-hiux"; exit 0
84 ;;
85
86 HP-UX:*)
87 HPUXVER=`echo ${RELEASE}|sed -e 's/[^.]*.[0B]*//'`
88 case "$HPUXVER" in
89 10.*)
90 echo "${MACHINE}-hp-hpux10."; exit 0
91 ;;
92 *)
93 echo "${MACHINE}-hp-hpux"; exit 0
94 ;;
95 esac
96 ;;
97
98 IRIX:*)
99 echo "${MACHINE}-sgi-irix"; exit 0
100 ;;
101
102 IRIX64:*)
103 echo "${MACHINE}-sgi-irix64"; exit 0
104 ;;
105
106 Linux:[2-9].*)
107 echo "${MACHINE}-whatever-linux2"; exit 0
108 ;;
109
110 Linux:1.*)
111 echo "${MACHINE}-whatever-linux1"; exit 0
112 ;;
113
114 LynxOS:*)
115 echo "${MACHINE}-lynx-lynxos"; exit 0
116 ;;
117
118 BSD/386:*:*:*486*|BSD/OS:*:*:*:*486*)
119 echo "i486-whatever-bsdi"; exit 0
120 ;;
121
122 BSD/386:*|BSD/OS:*)
123 echo "${MACHINE}-whatever-bsdi"; exit 0
124 ;;
125
126 FreeBSD:*:*:*486*)
127 echo "i486-whatever-freebsd"; exit 0
128 ;;
129
130 FreeBSD:*)
131 echo "${MACHINE}-whatever-freebsd"; exit 0
132 ;;
133
134 NetBSD:*:*:*486*)
135 echo "i486-whatever-netbsd"; exit 0
136 ;;
137
138 NetBSD:*)
139 echo "${MACHINE}-whatever-netbsd"; exit 0
140 ;;
141
142 OpenBSD:*)
143 echo "${MACHINE}-whatever-openbsd"; exit 0
144 ;;
145
146 OSF1:*:*:*alpha*)
147 echo "${MACHINE}-dec-osf"; exit 0
148 ;;
149
150 QNX:*)
151 case "$VERSION" in
152 423)
153 echo "${MACHINE}-qssl-qnx32"
154 ;;
155 *)
156 echo "${MACHINE}-qssl-qnx"
157 ;;
158 esac
159 exit 0
160 ;;
161
162 Paragon*:*:*:*)
163 echo "i860-intel-osf1"; exit 0
164 ;;
165
166 SunOS:5.*)
167 echo "${MACHINE}-sun-solaris2"; exit 0
168 ;;
169
170 SunOS:*)
171 echo "${MACHINE}-sun-sunos4"; exit 0
172 ;;
173
174 UNIX_System_V:4.*:*)
175 echo "${MACHINE}-whatever-sysv4"; exit 0
176 ;;
177
178 *:4*:R4*:m88k)
179 echo "${MACHINE}-whatever-sysv4"; exit 0
180 ;;
181
182 DYNIX/ptx:4*:*)
183 echo "${MACHINE}-whatever-sysv4"; exit 0
184 ;;
185
186 *:4.0:3.0:3[34]?? | *:4.0:3.0:3[34]??,*)
187 echo "i486-ncr-sysv4"; exit 0
188 ;;
189
190 ULTRIX:*)
191 echo "${MACHINE}-unknown-ultrix"; exit 0
192 ;;
193
194 SINIX*)
195 echo "${MACHINE}-sni-sysv4"; exit 0
196 ;;
197
198 machten:*)
199 echo "${MACHINE}-tenon-${SYSTEM}"; exit 0;
200 ;;
201
202 library:*)
203 echo "${MACHINE}-ncr-sysv4"; exit 0
204 ;;
205
206 ConvexOS:*:11.0:*)
207 echo "${MACHINE}-v11-${SYSTEM}"; exit 0;
208 ;;
209
210 esac
211
212 #
213 # Ugg. These are all we can determine by what we know about
214 # the output of uname. Be more creative:
215 #
216
217 # Do the Apollo stuff first. Here, we just simply assume
218 # that the existance of the /usr/apollo directory is proof
219 # enough
220 if [ -d /usr/apollo ]; then
221 echo "whatever-apollo-whatever"
222 exit 0
223 fi
224
225 # Now NeXT
226 ISNEXT=`hostinfo 2>/dev/null`
227 case "$ISNEXT" in
228 *NeXT*)
229 echo "whatever-next-nextstep"; exit 0
230 ;;
231 esac
232
233 # At this point we gone through all the one's
234 # we know of: Punt
235
236 echo "${MACHINE}-whatever-${SYSTEM}|${RELEASE}|${VERSION}"
237 exit 0
238 ) 2>/dev/null | (
239
240 # ---------------------------------------------------------------------------
241 # this is where the translation occurs into SSLeay terms
242 # ---------------------------------------------------------------------------
243
244 PREFIX=""
245 SUFFIX=""
246 VERBOSE="false"
247 TEST="false"
248
249 # pick up any command line args to config
250 for i
251 do
252 case "$i" in
253 -d*) PREFIX="debug-";;
254 -v*) VERBOSE="true";;
255 -n*|-t*) TEST="true";;
256 esac
257 done
258
259 # figure out if gcc is available and if so we use it otherwise
260 # we fallback to whatever cc does on the system
261 GCCVER=`gcc -v 2>&1`
262 if [ $? = "0" ]; then
263 CC=gcc
264 else
265 CC=cc
266 fi
267
268 # read the output of the embedded GuessOS
269 read GUESSOS
270
271 if [ "$VERBOSE" = "true" ]; then
272 echo GUESSOS $GUESSOS
273 fi
274
275 # now map the output into SSLeay terms ... really should hack into the
276 # script above so we end up with values in vars but that would take
277 # more time that I want to waste at the moment
278 case "$GUESSOS" in
279 *-*-linux2) OUT="linux-elf" ;;
280 *-*-linux) OUT="linux-aout" ;;
281 sun4*-sun-solaris2) OUT="solaris-sparc-$CC" ;;
282 *86*-sun-solaris2) OUT="solaris-x86-$CC" ;;
283 *-*-sunos4) OUT="sunos-$CC" ;;
284 *-freebsd) OUT="FreeBSD" ;;
285 *86*-*-netbsd) OUT="NetBSD-x86" ;;
286 sun3*-*-netbsd) OUT="NetBSD-m68" ;;
287 *-*-netbsd) OUT="NetBSD-sparc" ;;
288 *-*-osf) OUT="alpha-$CC" ;;
289 *-*-unixware*) OUT="unixware-2.0" ;;
290 *-sni-sysv4) OUT="SINIX" ;;
291 # these are all covered by the catchall below
292 # *-hpux) OUT="hpux-$CC" ;;
293 # *-aix) OUT="aix-$CC" ;;
294 # *-dgux) OUT="dgux" ;;
295 *) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
296 esac
297
298 if [ -z "$OUT" ]; then
299 OUT="$CC"
300 fi
301
302 # run Configure to check to see if we need to specify the
303 # compiler for the platform ... in which case we add it on
304 # the end ... otherwise we leave it off
305 ./Configure 2>&1 | grep '$OUT-$CC' > /dev/null
306 if [ $? = "0" ]; then
307 OUT="$OUT-$CC"
308 fi
309
310 OUT="$PREFIX$OUT"
311
312 # at this point we have the answer ... which we could check again
313 # and then fallback to a vanilla SSLeay build but then this script
314 # wouldn't get updated
315 echo Configuring for $OUT
316
317 if [ "$TEST" = "true" ]; then
318 echo ./Configure $OUT
319 else
320 ./Configure $OUT
321 fi
322
323 )
324