summaryrefslogtreecommitdiff
path: root/src/lib/libssl/src/config
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/src/config')
-rw-r--r--src/lib/libssl/src/config279
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"
30SYSTEM=`(uname -s) 2>/dev/null` || SYSTEM="unknown" 27SYSTEM=`(uname -s) 2>/dev/null` || SYSTEM="unknown"
31VERSION=`(uname -v) 2>/dev/null` || VERSION="unknown" 28VERSION=`(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
226ISNEXT=`hostinfo 2>/dev/null` 254ISNEXT=`hostinfo 2>/dev/null`
227case "$ISNEXT" in 255case "$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
236echo "${MACHINE}-whatever-${SYSTEM}|${RELEASE}|${VERSION}" 267echo "${MACHINE}-whatever-${SYSTEM}"
237exit 0 268exit 0
238) 2>/dev/null | ( 269) 2>/dev/null | (
239 270
@@ -243,7 +274,6 @@ exit 0
243 274
244PREFIX="" 275PREFIX=""
245SUFFIX="" 276SUFFIX=""
246VERBOSE="false"
247TEST="false" 277TEST="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
251do 281do
252case "$i" in 282case "$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
286Usage: 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
291Any other text will be passed to the Configure perl script.
292See INSTALL for instructions.
293
294EOF
295;;
296*) options=$options" $i" ;;
256esac 297esac
257done 298done
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
261GCCVER=`gcc -v 2>&1` 302GCCVER=`(gcc --version) 2>/dev/null`
262if [ $? = "0" ]; then 303if [ "$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/'`
264else 309else
265 CC=cc 310 CC=cc
266fi 311fi
267 312
313if [ "$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
329fi
330
331GCCVER=${GCCVER:-0}
332CCVER=${CCVER:-0}
333
268# read the output of the embedded GuessOS 334# read the output of the embedded GuessOS
269read GUESSOS 335read GUESSOS
270 336
271if [ "$VERBOSE" = "true" ]; then 337echo Operating system: $GUESSOS
272 echo GUESSOS $GUESSOS
273fi
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
278case "$GUESSOS" in 342case "$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}'`;;
299esac 425esac
300 426
427# gcc < 2.8 does not support -mcpu=ultrasparc
428if [ "$OUT" = solaris-sparcv9-gcc -a $GCCVER -lt 28 ]
429then
430 echo "WARNING! Do consider upgrading to gcc-2.8 or later."
431 sleep 5
432 OUT=solaris-sparcv9-gcc27
433fi
434if [ "$OUT" = "linux-sparcv9" -a $GCCVER -lt 28 ]
435then
436 echo "WARNING! Falling down to 'linux-sparcv8'."
437 echo " Upgrade to gcc-2.8 or later."
438 sleep 5
439 OUT=linux-sparcv8
440fi
441
442case "$GUESSOS" in
443 i386-*) options="$options 386" ;;
444esac
445
446for i in bf cast des dh dsa hmac md2 md5 mdc2 rc2 rc4 rc5 ripemd rsa sha
447do
448 if [ ! -d crypto/$i ]
449 then
450 options="$options no-$i"
451 fi
452done
453
301if [ -z "$OUT" ]; then 454if [ -z "$OUT" ]; then
302 OUT="$CC" 455 OUT="$CC"
303fi 456fi
304 457
458if [ ".$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
465fi
466
467if [ ".$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
476fi
477
478if [ ".$PERL" = . ] ; then
479 echo "You need Perl 5."
480 exit 1
481fi
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
309if [ $? = "0" ]; then 488if [ $? = "0" ]; then
310 OUT="$OUT-$CC" 489 OUT="$OUT-$CC"
311fi 490fi
312 491
313OUT="$PREFIX$OUT" 492OUT="$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 495if [ $? = "0" ]; then
317# wouldn't get updated 496 echo Configuring for $OUT
318echo Configuring for $OUT
319 497
320if [ "$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
322else 503else
323 ./Configure -DNO_IDEA $OUT 504 echo "This system ($OUT) is not supported. See file INSTALL for details."
324fi 505fi
325
326) 506)
327