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