diff options
Diffstat (limited to 'src/lib/libssl/src/config')
-rw-r--r-- | src/lib/libssl/src/config | 279 |
1 files changed, 229 insertions, 50 deletions
diff --git a/src/lib/libssl/src/config b/src/lib/libssl/src/config index 7643930ee0..93e2317c3f 100644 --- a/src/lib/libssl/src/config +++ b/src/lib/libssl/src/config | |||
@@ -1,14 +1,11 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # | 2 | # |
3 | # config - this is a merge of minarch and GuessOS from the Apache Group | 3 | # OpenSSL config: determine the operating system and run ./Configure |
4 | # which then automatically runs Configure from SSLeay after | ||
5 | # mapping the Apache names for OSs into SSLeay names | ||
6 | # | 4 | # |
7 | # 16-Sep-97 tjh first cut of merged version | 5 | # "config -h" for usage information. |
8 | # | ||
9 | # Tim Hudson | ||
10 | # tjh@cryptsoft.com | ||
11 | # | 6 | # |
7 | # this is a merge of minarch and GuessOS from the Apache Group. | ||
8 | # Originally written by Tim Hudson <tjh@cryptsoft.com>. | ||
12 | 9 | ||
13 | # Original Apache Group comments on GuessOS | 10 | # Original Apache Group comments on GuessOS |
14 | 11 | ||
@@ -30,7 +27,6 @@ RELEASE=`(uname -r) 2>/dev/null` || RELEASE="unknown" | |||
30 | SYSTEM=`(uname -s) 2>/dev/null` || SYSTEM="unknown" | 27 | SYSTEM=`(uname -s) 2>/dev/null` || SYSTEM="unknown" |
31 | VERSION=`(uname -v) 2>/dev/null` || VERSION="unknown" | 28 | VERSION=`(uname -v) 2>/dev/null` || VERSION="unknown" |
32 | 29 | ||
33 | |||
34 | # Now test for ISC and SCO, since it is has a braindamaged uname. | 30 | # Now test for ISC and SCO, since it is has a braindamaged uname. |
35 | # | 31 | # |
36 | # We need to work around FreeBSD 1.1.5.1 | 32 | # We need to work around FreeBSD 1.1.5.1 |
@@ -86,8 +82,11 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in | |||
86 | HP-UX:*) | 82 | HP-UX:*) |
87 | HPUXVER=`echo ${RELEASE}|sed -e 's/[^.]*.[0B]*//'` | 83 | HPUXVER=`echo ${RELEASE}|sed -e 's/[^.]*.[0B]*//'` |
88 | case "$HPUXVER" in | 84 | case "$HPUXVER" in |
85 | 11.*) | ||
86 | echo "${MACHINE}-hp-hpux11"; exit 0 | ||
87 | ;; | ||
89 | 10.*) | 88 | 10.*) |
90 | echo "${MACHINE}-hp-hpux10."; exit 0 | 89 | echo "${MACHINE}-hp-hpux10"; exit 0 |
91 | ;; | 90 | ;; |
92 | *) | 91 | *) |
93 | echo "${MACHINE}-hp-hpux"; exit 0 | 92 | echo "${MACHINE}-hp-hpux"; exit 0 |
@@ -95,12 +94,16 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in | |||
95 | esac | 94 | esac |
96 | ;; | 95 | ;; |
97 | 96 | ||
98 | IRIX:*) | 97 | IRIX:5.*) |
99 | echo "${MACHINE}-sgi-irix"; exit 0 | 98 | echo "mips2-sgi-irix"; exit 0 |
99 | ;; | ||
100 | |||
101 | IRIX:6.*) | ||
102 | echo "mips3-sgi-irix"; exit 0 | ||
100 | ;; | 103 | ;; |
101 | 104 | ||
102 | IRIX64:*) | 105 | IRIX64:*) |
103 | echo "${MACHINE}-sgi-irix64"; exit 0 | 106 | echo "mips4-sgi-irix64"; exit 0 |
104 | ;; | 107 | ;; |
105 | 108 | ||
106 | Linux:[2-9].*) | 109 | Linux:[2-9].*) |
@@ -115,24 +118,45 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in | |||
115 | echo "${MACHINE}-lynx-lynxos"; exit 0 | 118 | echo "${MACHINE}-lynx-lynxos"; exit 0 |
116 | ;; | 119 | ;; |
117 | 120 | ||
121 | BSD/OS:4.*) # BSD/OS always says 386 | ||
122 | echo "i486-whatever-bsdi4"; exit 0 | ||
123 | ;; | ||
124 | |||
118 | BSD/386:*:*:*486*|BSD/OS:*:*:*:*486*) | 125 | BSD/386:*:*:*486*|BSD/OS:*:*:*:*486*) |
119 | echo "i486-whatever-bsdi"; exit 0 | 126 | case `/sbin/sysctl -n hw.model` in |
127 | Pentium*) | ||
128 | echo "i586-whatever-bsdi"; exit 0 | ||
129 | ;; | ||
130 | *) | ||
131 | echo "i386-whatever-bsdi"; exit 0 | ||
132 | ;; | ||
133 | esac; | ||
120 | ;; | 134 | ;; |
121 | 135 | ||
122 | BSD/386:*|BSD/OS:*) | 136 | BSD/386:*|BSD/OS:*) |
123 | echo "${MACHINE}-whatever-bsdi"; exit 0 | 137 | echo "${MACHINE}-whatever-bsdi"; exit 0 |
124 | ;; | 138 | ;; |
125 | 139 | ||
126 | FreeBSD:*:*:*486*) | ||
127 | echo "i486-whatever-freebsd"; exit 0 | ||
128 | ;; | ||
129 | |||
130 | FreeBSD:*) | 140 | FreeBSD:*) |
131 | echo "${MACHINE}-whatever-freebsd"; exit 0 | 141 | VERS=`echo ${RELEASE} | sed -e 's/[-(].*//'` |
132 | ;; | 142 | MACH=`sysctl -n hw.model` |
133 | 143 | ARCH='whatever' | |
134 | NetBSD:*:*:*486*) | 144 | case ${MACH} in |
135 | echo "i486-whatever-netbsd"; exit 0 | 145 | *386* ) MACH="i386" ;; |
146 | *486* ) MACH="i486" ;; | ||
147 | Pentium\ II*) MACH="i686" ;; | ||
148 | Pentium* ) MACH="i586" ;; | ||
149 | Alpha* ) MACH="alpha" ;; | ||
150 | * ) MACH="$MACHINE" ;; | ||
151 | esac | ||
152 | case ${MACH} in | ||
153 | i[0-9]86 ) ARCH="pc" ;; | ||
154 | esac | ||
155 | echo "${MACH}-${ARCH}-freebsd${VERS}"; exit 0 | ||
156 | ;; | ||
157 | |||
158 | NetBSD:*:*:*386*) | ||
159 | echo "`sysctl -n hw.model | sed 's,.*\(.\)86-class.*,i\186,'`-whateve\r-netbsd"; exit 0 | ||
136 | ;; | 160 | ;; |
137 | 161 | ||
138 | NetBSD:*) | 162 | NetBSD:*) |
@@ -191,8 +215,12 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in | |||
191 | echo "${MACHINE}-unknown-ultrix"; exit 0 | 215 | echo "${MACHINE}-unknown-ultrix"; exit 0 |
192 | ;; | 216 | ;; |
193 | 217 | ||
194 | SINIX*) | 218 | SINIX*|ReliantUNIX*) |
195 | echo "${MACHINE}-sni-sysv4"; exit 0 | 219 | echo "${MACHINE}-siemens-sysv4"; exit 0 |
220 | ;; | ||
221 | |||
222 | POSIX-BC*) | ||
223 | echo "${MACHINE}-siemens-sysv4"; exit 0 # Here, $MACHINE == "BS2000" | ||
196 | ;; | 224 | ;; |
197 | 225 | ||
198 | machten:*) | 226 | machten:*) |
@@ -225,6 +253,9 @@ fi | |||
225 | # Now NeXT | 253 | # Now NeXT |
226 | ISNEXT=`hostinfo 2>/dev/null` | 254 | ISNEXT=`hostinfo 2>/dev/null` |
227 | case "$ISNEXT" in | 255 | case "$ISNEXT" in |
256 | *'NeXT Mach 3.3'*) | ||
257 | echo "whatever-next-nextstep3.3"; exit 0 | ||
258 | ;; | ||
228 | *NeXT*) | 259 | *NeXT*) |
229 | echo "whatever-next-nextstep"; exit 0 | 260 | echo "whatever-next-nextstep"; exit 0 |
230 | ;; | 261 | ;; |
@@ -233,7 +264,7 @@ esac | |||
233 | # At this point we gone through all the one's | 264 | # At this point we gone through all the one's |
234 | # we know of: Punt | 265 | # we know of: Punt |
235 | 266 | ||
236 | echo "${MACHINE}-whatever-${SYSTEM}|${RELEASE}|${VERSION}" | 267 | echo "${MACHINE}-whatever-${SYSTEM}" |
237 | exit 0 | 268 | exit 0 |
238 | ) 2>/dev/null | ( | 269 | ) 2>/dev/null | ( |
239 | 270 | ||
@@ -243,7 +274,6 @@ exit 0 | |||
243 | 274 | ||
244 | PREFIX="" | 275 | PREFIX="" |
245 | SUFFIX="" | 276 | SUFFIX="" |
246 | VERBOSE="false" | ||
247 | TEST="false" | 277 | TEST="false" |
248 | 278 | ||
249 | # pick up any command line args to config | 279 | # pick up any command line args to config |
@@ -251,77 +281,226 @@ for i | |||
251 | do | 281 | do |
252 | case "$i" in | 282 | case "$i" in |
253 | -d*) PREFIX="debug-";; | 283 | -d*) PREFIX="debug-";; |
254 | -v*) VERBOSE="true";; | 284 | -t*) TEST="true";; |
255 | -n*|-t*) TEST="true";; | 285 | -h*) TEST="true"; cat <<EOF |
286 | Usage: config [options] | ||
287 | -d Add a debug- prefix to machine choice. | ||
288 | -t Test mode, do not run the Configure perl script. | ||
289 | -h This help. | ||
290 | |||
291 | Any other text will be passed to the Configure perl script. | ||
292 | See INSTALL for instructions. | ||
293 | |||
294 | EOF | ||
295 | ;; | ||
296 | *) options=$options" $i" ;; | ||
256 | esac | 297 | esac |
257 | done | 298 | done |
258 | 299 | ||
259 | # figure out if gcc is available and if so we use it otherwise | 300 | # figure out if gcc is available and if so we use it otherwise |
260 | # we fallback to whatever cc does on the system | 301 | # we fallback to whatever cc does on the system |
261 | GCCVER=`gcc -v 2>&1` | 302 | GCCVER=`(gcc --version) 2>/dev/null` |
262 | if [ $? = "0" ]; then | 303 | if [ "$GCCVER" != "" ]; then |
263 | CC=gcc | 304 | CC=gcc |
305 | # then strip off whatever prefix Cygnus prepends the number with... | ||
306 | GCCVER=`echo $GCCVER | sed 's/^[a-z]*\-//'` | ||
307 | # peak single digit before and after first dot, e.g. 2.95.1 gives 29 | ||
308 | GCCVER=`echo $GCCVER | sed 's/\([0-9]\)\.\([0-9]\).*/\1\2/'` | ||
264 | else | 309 | else |
265 | CC=cc | 310 | CC=cc |
266 | fi | 311 | fi |
267 | 312 | ||
313 | if [ "$SYSTEM" = "SunOS" ]; then | ||
314 | # assume output is "blah-blah C x.x" | ||
315 | CCVER=`(cc -V 2>&1) 2>/dev/null | \ | ||
316 | egrep -e '^cc: .* C [0-9]\.[0-9]' | \ | ||
317 | sed 's/.* C \([0-9]\)\.\([0-9]\).*/\1\2/'` | ||
318 | CCVER=${CCVER:-0} | ||
319 | if [ $CCVER -gt 40 ]; then | ||
320 | CC=cc # overrides gcc!!! | ||
321 | if [ $CCVER -eq 50 ]; then | ||
322 | echo "WARNING! Detected WorkShop C 5.0. Do make sure you have" | ||
323 | echo " patch #107357-01 or later applied." | ||
324 | sleep 5 | ||
325 | fi | ||
326 | elif [ "$CC" = "cc" -a $CCVER -gt 0 ]; then | ||
327 | CC=sc3 | ||
328 | fi | ||
329 | fi | ||
330 | |||
331 | GCCVER=${GCCVER:-0} | ||
332 | CCVER=${CCVER:-0} | ||
333 | |||
268 | # read the output of the embedded GuessOS | 334 | # read the output of the embedded GuessOS |
269 | read GUESSOS | 335 | read GUESSOS |
270 | 336 | ||
271 | if [ "$VERBOSE" = "true" ]; then | 337 | echo Operating system: $GUESSOS |
272 | echo GUESSOS $GUESSOS | ||
273 | fi | ||
274 | 338 | ||
275 | # now map the output into SSLeay terms ... really should hack into the | 339 | # 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 | 340 | # 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 | 341 | # more time that I want to waste at the moment |
278 | case "$GUESSOS" in | 342 | case "$GUESSOS" in |
343 | alpha-*-linux2) OUT="alpha-gcc" ;; | ||
344 | ppc-*-linux2) OUT="linux-ppc" ;; | ||
345 | mips-*-linux?) OUT="linux-mips" ;; | ||
346 | mips2-sgi-irix) | ||
347 | CPU=`(hinv -t cpu) 2>/dev/null | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'` | ||
348 | CPU=${CPU:-0} | ||
349 | if [ $CPU -ge 4000 ]; then | ||
350 | options="$options -mips2" | ||
351 | fi | ||
352 | OUT="irix-$CC" | ||
353 | ;; | ||
354 | mips3-sgi-irix) | ||
355 | CPU=`(hinv -t cpu) 2>/dev/null | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'` | ||
356 | CPU=${CPU:-0} | ||
357 | if [ $CPU -ge 5000 ]; then | ||
358 | options="$options -mips4" | ||
359 | else | ||
360 | options="$options -mips3" | ||
361 | fi | ||
362 | OUT="irix-mips3-$CC" | ||
363 | ;; | ||
364 | mips4-sgi-irix64) | ||
365 | echo "WARNING! If you wish to build 64-bit library, then you have to" | ||
366 | echo " invoke './Configre irix64-mips4-$CC' *manually*." | ||
367 | echo " Type Ctrl-C if you don't want to continue." | ||
368 | read waste < /dev/tty | ||
369 | options="$options -mips4" | ||
370 | OUT="irix-mips3-$CC" | ||
371 | ;; | ||
372 | sparc64-*-linux2) | ||
373 | #Before we can uncomment following lines we have to wait at least | ||
374 | #till 64-bit glibc for SPARC is operational:-( | ||
375 | #echo "WARNING! If you wish to build 64-bit library, then you have to" | ||
376 | #echo " invoke './Configure linux64-sparcv9' *manually*." | ||
377 | #echo " Type Ctrl-C if you don't want to continue." | ||
378 | #read waste < /dev/tty | ||
379 | OUT="linux-sparcv9" ;; | ||
380 | sparc-*-linux2) | ||
381 | KARCH=`awk '/type/{print$3}' /proc/cpuinfo` | ||
382 | case ${KARCH:-sun4} in | ||
383 | sun4u*) OUT="linux-sparcv9" ;; | ||
384 | sun4m) OUT="linux-sparcv8" ;; | ||
385 | sun4d) OUT="linux-sparcv8" ;; | ||
386 | *) OUT="linux-sparcv7" ;; | ||
387 | esac ;; | ||
279 | *-*-linux2) OUT="linux-elf" ;; | 388 | *-*-linux2) OUT="linux-elf" ;; |
280 | *-*-linux) OUT="linux-aout" ;; | 389 | *-*-linux1) OUT="linux-aout" ;; |
281 | sun4*-sun-solaris2) OUT="solaris-sparc-$CC" ;; | 390 | sun4u*-sun-solaris2) |
391 | ISA64=`(isalist) 2>/dev/null | grep sparcv9` | ||
392 | if [ "$ISA64" != "" -a "$CC" = "cc" -a $CCVER -ge 50 ]; then | ||
393 | echo "WARNING! If you wish to build 64-bit library, then you have to" | ||
394 | echo " invoke './Configure solaris64-sparcv9-cc' *manually*." | ||
395 | echo " Type Ctrl-C if you don't want to continue." | ||
396 | read waste < /dev/tty | ||
397 | fi | ||
398 | OUT="solaris-sparcv9-$CC" ;; | ||
399 | sun4m-sun-solaris2) OUT="solaris-sparcv8-$CC" ;; | ||
400 | sun4d-sun-solaris2) OUT="solaris-sparcv8-$CC" ;; | ||
401 | sun4*-sun-solaris2) OUT="solaris-sparcv7-$CC" ;; | ||
282 | *86*-sun-solaris2) OUT="solaris-x86-$CC" ;; | 402 | *86*-sun-solaris2) OUT="solaris-x86-$CC" ;; |
283 | *-*-sunos4) OUT="sunos-$CC" ;; | 403 | *-*-sunos4) OUT="sunos-$CC" ;; |
284 | *-freebsd) OUT="FreeBSD" ;; | 404 | alpha*-*-freebsd*) OUT="FreeBSD-alpha" ;; |
405 | *-freebsd[3-9]*) OUT="FreeBSD-elf" ;; | ||
406 | *-freebsd[1-2]*) OUT="FreeBSD" ;; | ||
285 | *86*-*-netbsd) OUT="NetBSD-x86" ;; | 407 | *86*-*-netbsd) OUT="NetBSD-x86" ;; |
286 | sun3*-*-netbsd) OUT="NetBSD-m68" ;; | 408 | sun3*-*-netbsd) OUT="NetBSD-m68" ;; |
287 | *-*-netbsd) OUT="NetBSD-sparc" ;; | 409 | *-*-netbsd) OUT="NetBSD-sparc" ;; |
288 | *86*-*-openbsd) OUT="OpenBSD-x86" ;; | 410 | *86*-*-openbsd) OUT="OpenBSD-x86" ;; |
289 | alpha*-*-openbsd) OUT="OpenBSD-alpha" ;; | 411 | alpha*-*-openbsd) OUT="OpenBSD-alpha" ;; |
290 | *-*-openbsd) OUT="OpenBSD-bigendian" ;; | 412 | pmax*-*-openbsd) OUT="OpenBSD-mips" ;; |
291 | *-*-osf) OUT="alpha-$CC" ;; | 413 | *-*-openbsd) OUT="OpenBSD" ;; |
414 | *86*-*-bsdi4) OUT="bsdi-elf-gcc" ;; | ||
415 | *-*-osf) OUT="alpha-cc" ;; | ||
292 | *-*-unixware*) OUT="unixware-2.0" ;; | 416 | *-*-unixware*) OUT="unixware-2.0" ;; |
293 | *-sni-sysv4) OUT="SINIX" ;; | 417 | BS2000-siemens-sysv4) OUT="BS2000-OSD" ;; |
418 | RM*-siemens-sysv4) OUT="ReliantUNIX" ;; | ||
419 | *-siemens-sysv4) OUT="SINIX" ;; | ||
294 | # these are all covered by the catchall below | 420 | # these are all covered by the catchall below |
295 | # *-hpux) OUT="hpux-$CC" ;; | 421 | # *-hpux*) OUT="hpux-$CC" ;; |
296 | # *-aix) OUT="aix-$CC" ;; | 422 | # *-aix) OUT="aix-$CC" ;; |
297 | # *-dgux) OUT="dgux" ;; | 423 | # *-dgux) OUT="dgux" ;; |
298 | *) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;; | 424 | *) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;; |
299 | esac | 425 | esac |
300 | 426 | ||
427 | # gcc < 2.8 does not support -mcpu=ultrasparc | ||
428 | if [ "$OUT" = solaris-sparcv9-gcc -a $GCCVER -lt 28 ] | ||
429 | then | ||
430 | echo "WARNING! Do consider upgrading to gcc-2.8 or later." | ||
431 | sleep 5 | ||
432 | OUT=solaris-sparcv9-gcc27 | ||
433 | fi | ||
434 | if [ "$OUT" = "linux-sparcv9" -a $GCCVER -lt 28 ] | ||
435 | then | ||
436 | echo "WARNING! Falling down to 'linux-sparcv8'." | ||
437 | echo " Upgrade to gcc-2.8 or later." | ||
438 | sleep 5 | ||
439 | OUT=linux-sparcv8 | ||
440 | fi | ||
441 | |||
442 | case "$GUESSOS" in | ||
443 | i386-*) options="$options 386" ;; | ||
444 | esac | ||
445 | |||
446 | for i in bf cast des dh dsa hmac md2 md5 mdc2 rc2 rc4 rc5 ripemd rsa sha | ||
447 | do | ||
448 | if [ ! -d crypto/$i ] | ||
449 | then | ||
450 | options="$options no-$i" | ||
451 | fi | ||
452 | done | ||
453 | |||
301 | if [ -z "$OUT" ]; then | 454 | if [ -z "$OUT" ]; then |
302 | OUT="$CC" | 455 | OUT="$CC" |
303 | fi | 456 | fi |
304 | 457 | ||
458 | if [ ".$PERL" = . ] ; then | ||
459 | for i in . `echo $PATH | sed 's/:/ /g'`; do | ||
460 | if [ -f "$i/perl5" ] ; then | ||
461 | PERL="$i/perl5" | ||
462 | break; | ||
463 | fi; | ||
464 | done | ||
465 | fi | ||
466 | |||
467 | if [ ".$PERL" = . ] ; then | ||
468 | for i in . `echo $PATH | sed 's/:/ /g'`; do | ||
469 | if [ -f "$i/perl" ] ; then | ||
470 | if "$i/perl" -e 'exit($]<5.0)'; then | ||
471 | PERL="$i/perl" | ||
472 | break; | ||
473 | fi; | ||
474 | fi; | ||
475 | done | ||
476 | fi | ||
477 | |||
478 | if [ ".$PERL" = . ] ; then | ||
479 | echo "You need Perl 5." | ||
480 | exit 1 | ||
481 | fi | ||
482 | |||
305 | # run Configure to check to see if we need to specify the | 483 | # run Configure to check to see if we need to specify the |
306 | # compiler for the platform ... in which case we add it on | 484 | # compiler for the platform ... in which case we add it on |
307 | # the end ... otherwise we leave it off | 485 | # the end ... otherwise we leave it off |
308 | ./Configure 2>&1 | grep '$OUT-$CC' > /dev/null | 486 | |
487 | $PERL ./Configure 2>&1 | grep "$OUT-$CC" > /dev/null | ||
309 | if [ $? = "0" ]; then | 488 | if [ $? = "0" ]; then |
310 | OUT="$OUT-$CC" | 489 | OUT="$OUT-$CC" |
311 | fi | 490 | fi |
312 | 491 | ||
313 | OUT="$PREFIX$OUT" | 492 | OUT="$PREFIX$OUT" |
314 | 493 | ||
315 | # at this point we have the answer ... which we could check again | 494 | $PERL ./Configure 2>&1 | grep "$OUT" > /dev/null |
316 | # and then fallback to a vanilla SSLeay build but then this script | 495 | if [ $? = "0" ]; then |
317 | # wouldn't get updated | 496 | echo Configuring for $OUT |
318 | echo Configuring for $OUT | ||
319 | 497 | ||
320 | if [ "$TEST" = "true" ]; then | 498 | if [ "$TEST" = "true" ]; then |
321 | echo ./Configure -DNO_IDEA $OUT | 499 | echo $PERL ./Configure $OUT $options |
500 | else | ||
501 | $PERL ./Configure $OUT $options | ||
502 | fi | ||
322 | else | 503 | else |
323 | ./Configure -DNO_IDEA $OUT | 504 | echo "This system ($OUT) is not supported. See file INSTALL for details." |
324 | fi | 505 | fi |
325 | |||
326 | ) | 506 | ) |
327 | |||