2 # Copyright 1998-2017 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the OpenSSL license (the "License"). You may not use
5 # this file except in compliance with the License. You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
9 # OpenSSL config: determine the operating system and run ./Configure
10 # Derived from minarch and GuessOS from Apache.
12 # Do "config -h" for usage information.
19 # pick up any command line args to config
23 -d*) options=$options" --debug";;
24 -t*) DRYRUN="true" VERBOSE="true";;
26 -h*) DRYRUN="true"; cat <<EOF
27 Usage: config [options]
28 -d Build with debugging when possible.
29 -t Test mode, do not run the Configure perl script.
30 -v Verbose mode, show the exact Configure call that is being made.
33 Any other text will be passed to the Configure perl script.
34 See INSTALL for instructions.
38 *) i=`echo "$i" | sed -e "s|'|'\\\\\\''|g"`
39 options="$options '$i'" ;;
43 # First get uname entries that we use below
45 [ "$MACHINE" ] || MACHINE=`(uname -m) 2>/dev/null` || MACHINE="unknown"
46 [ "$RELEASE" ] || RELEASE=`(uname -r) 2>/dev/null` || RELEASE="unknown"
47 [ "$SYSTEM" ] || SYSTEM=`(uname -s) 2>/dev/null` || SYSTEM="unknown"
48 [ "$BUILD" ] || VERSION=`(uname -v) 2>/dev/null` || VERSION="unknown"
51 # Now test for ISC and SCO, since it is has a braindamaged uname.
53 # We need to work around FreeBSD 1.1.5.1
55 XREL=`uname -X 2>/dev/null | grep "^Release" | awk '{print $3}'`
56 if [ "x$XREL" != "x" ]; then
57 if [ -f /etc/kconfig ]; then
60 echo "${MACHINE}-whatever-isc4"; exit 0
66 echo "whatever-whatever-sco3"; exit 0
69 echo "whatever-whatever-sco5"; exit 0
73 x2.0*) echo "whatever-whatever-unixware20"; exit 0 ;;
74 x2.1*) echo "whatever-whatever-unixware21"; exit 0 ;;
75 x2*) echo "whatever-whatever-unixware2"; exit 0 ;;
79 echo "whatever-whatever-unixware1"; exit 0
83 # We hardcode i586 in place of ${MACHINE} for the
84 # following reason. The catch is that even though Pentium
85 # is minimum requirement for platforms in question,
86 # ${MACHINE} gets always assigned to i386. Now, problem
87 # with i386 is that it makes ./config pass 386 to
88 # ./Configure, which in turn makes make generate
89 # inefficient SHA-1 (for this moment) code.
90 x[678]*) echo "i586-sco-unixware7"; exit 0 ;;
96 # Now we simply scan though... In most cases, the SYSTEM info is enough
98 case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
100 echo "m68k-apple-aux3"; exit 0
104 echo "${MACHINE}-ibm-aix"; exit 0
108 echo "${MACHINE}-ibm-aix"; exit 0
112 echo "${MACHINE}-ibm-aix3"; exit 0
116 echo "${MACHINE}-hi-hiux"; exit 0
120 HPUXVER=`echo ${RELEASE}|sed -e 's/[^.]*.[0B]*//'`
122 1[0-9].*) # HPUX 10 and 11 targets are unified
123 echo "${MACHINE}-hp-hpux1x"; exit 0
126 echo "${MACHINE}-hp-hpux"; exit 0
132 echo "mips3-sgi-irix"; exit 0
136 echo "mips4-sgi-irix64"; exit 0
140 echo "${MACHINE}-whatever-linux2"; exit 0
144 echo "${MACHINE}-whatever-linux1"; exit 0
148 echo "hurd-x86"; exit 0;
152 echo "${MACHINE}-lynx-lynxos"; exit 0
155 BSD/OS:4.*) # BSD/OS always says 386
156 echo "i486-whatever-bsdi4"; exit 0
159 BSD/386:*:*:*486*|BSD/OS:*:*:*:*486*)
160 case `/sbin/sysctl -n hw.model` in
162 echo "i586-whatever-bsdi"; exit 0
165 echo "i386-whatever-bsdi"; exit 0
171 echo "${MACHINE}-whatever-bsdi"; exit 0
175 VERS=`echo ${RELEASE} | sed -e 's/[-(].*//'`
176 MACH=`sysctl -n hw.model`
179 *386* ) MACH="i386" ;;
180 *486* ) MACH="i486" ;;
181 Pentium\ II*) MACH="i686" ;;
182 Pentium* ) MACH="i586" ;;
183 * ) MACH="$MACHINE" ;;
186 i[0-9]86 ) ARCH="pc" ;;
188 echo "${MACH}-${ARCH}-freebsd${VERS}"; exit 0
192 echo "${MACHINE}-whatever-dragonfly"; exit 0
196 echo "${MACHINE}-whatever-freebsd"; exit 0
200 echo "${MACHINE}-whatever-haiku"; exit 0
204 echo "`(/usr/sbin/sysctl -n hw.model || /sbin/sysctl -n hw.model) | sed 's,.*\(.\)86-class.*,i\186,'`-whatever-netbsd"; exit 0
208 echo "${MACHINE}-whatever-netbsd"; exit 0
212 echo "${MACHINE}-whatever-openbsd"; exit 0
216 echo "${MACHINE}-unknown-OpenUNIX${VERSION}"; exit 0
220 OSFMAJOR=`echo ${RELEASE}| sed -e 's/^V\([0-9]*\)\..*$/\1/'`
223 echo "${MACHINE}-dec-tru64"; exit 0
226 echo "${MACHINE}-dec-osf"; exit 0
229 echo "${MACHINE}-dec-osf"; exit 0
237 echo "${MACHINE}-whatever-qnx4"
240 echo "${MACHINE}-whatever-qnx6"
243 echo "${MACHINE}-whatever-qnx"
250 echo "i860-intel-osf1"; exit 0
254 echo "ppc-apple-rhapsody"; exit 0
260 echo "ppc-apple-darwin${VERSION}"
263 echo "x86_64-apple-darwin${VERSION}"
266 echo "i686-apple-darwin${VERSION}"
273 echo "${MACHINE}-whatever-solaris2"; exit 0
277 echo "${MACHINE}-sun-sunos4"; exit 0
281 echo "${MACHINE}-whatever-sysv4"; exit 0
285 echo "i386-stratus-vos"; exit 0
289 echo "hppa1.1-stratus-vos"; exit 0
293 echo "${MACHINE}-whatever-sysv4"; exit 0
297 echo "${MACHINE}-whatever-sysv4"; exit 0
300 *:4.0:3.0:3[34]?? | *:4.0:3.0:3[34]??,*)
301 echo "i486-ncr-sysv4"; exit 0
305 echo "${MACHINE}-unknown-ultrix"; exit 0
309 echo "${MACHINE}-siemens-sysv4"; exit 0 # Here, $MACHINE == "BS2000"
313 echo "${MACHINE}-tenon-${SYSTEM}"; exit 0;
317 echo "${MACHINE}-ncr-sysv4"; exit 0
321 echo "${MACHINE}-v11-${SYSTEM}"; exit 0;
324 # The following combinations are supported
325 # MINGW64* on x86_64 => mingw64
326 # MINGW32* on x86_64 => mingw
327 # MINGW32* on i?86 => mingw
329 # MINGW64* on i?86 isn't expected to work...
331 echo "${MACHINE}-whatever-mingw64"; exit 0;
334 echo "${MACHINE}-whatever-mingw"; exit 0;
337 echo "${MACHINE}-pc-cygwin"; exit 0
341 echo "${MACHINE}-whatever-vxworks"; exit 0;
346 # Ugg. These are all we can determine by what we know about
347 # the output of uname. Be more creative:
350 # Do the Apollo stuff first. Here, we just simply assume
351 # that the existence of the /usr/apollo directory is proof
353 if [ -d /usr/apollo ]; then
354 echo "whatever-apollo-whatever"
359 ISNEXT=`hostinfo 2>/dev/null`
362 echo "whatever-next-nextstep3.3"; exit 0
365 echo "whatever-next-nextstep"; exit 0
369 # At this point we gone through all the one's
372 echo "${MACHINE}-whatever-${SYSTEM}"
376 # ---------------------------------------------------------------------------
377 # this is where the translation occurs into SSLeay terms
378 # ---------------------------------------------------------------------------
380 # Only set CC if not supplied already
381 if [ -z "$CROSS_COMPILE$CC" ]; then
382 GCCVER=`sh -c "gcc -dumpversion" 2>/dev/null`
383 if [ "$GCCVER" != "" ]; then
384 # then strip off whatever prefix egcs prepends the number with...
385 # Hopefully, this will work for any future prefixes as well.
386 GCCVER=`echo $GCCVER | LC_ALL=C sed 's/^[a-zA-Z]*\-//'`
387 # Since gcc 3.1 gcc --version behaviour has changed. gcc -dumpversion
388 # does give us what we want though, so we use that. We just just the
389 # major and minor version numbers.
390 # peak single digit before and after first dot, e.g. 2.95.1 gives 29
391 GCCVER=`echo $GCCVER | sed 's/\([0-9]\)\.\([0-9]\).*/\1\2/'`
398 if [ "$SYSTEM" = "HP-UX" ];then
399 # By default gcc is a ILP32 compiler (with long long == 64).
401 if [ $GCCVER -ge 30 ]; then
402 # PA64 support only came in with gcc 3.0.x.
403 # We check if the preprocessor symbol __LP64__ is defined...
404 if echo "__LP64__" | gcc -v -E -x c - 2>/dev/null | grep "^__LP64__" 2>&1 > /dev/null; then
405 : # __LP64__ has slipped through, it therefore is not defined
411 if [ "$SYSTEM" = "SunOS" ]; then
412 if [ $GCCVER -ge 30 ]; then
413 # 64-bit ABI isn't officially supported in gcc 3.0, but it appears
414 # to be working, at the very least 'make test' passes...
415 if gcc -v -E -x c /dev/null 2>&1 | grep __arch64__ > /dev/null; then
421 # check for WorkShop C, expected output is "cc: blah-blah C x.x"
422 CCVER=`(cc -V 2>&1) 2>/dev/null | \
423 egrep -e '^cc: .* C [0-9]\.[0-9]' | \
424 sed 's/.* C \([0-9]\)\.\([0-9]\).*/\1\2/'`
426 if [ $MACHINE != i86pc -a $CCVER -gt 40 ]; then
427 CC=cc # overrides gcc!!!
428 if [ $CCVER -eq 50 ]; then
429 echo "WARNING! Detected WorkShop C 5.0. Do make sure you have"
430 echo " patch #107357-01 or later applied."
436 if [ "${SYSTEM}" = "AIX" ]; then # favor vendor cc over gcc
437 (cc) 2>&1 | grep -iv "not found" > /dev/null && CC=cc
442 # read the output of the embedded GuessOS
445 echo Operating system: $GUESSOS
447 # now map the output into SSLeay terms ... really should hack into the
448 # script above so we end up with values in vars but that would take
449 # more time that I want to waste at the moment
461 echo "WARNING! If you wish to build 64-bit library, then you have to"
462 echo " invoke '$THERE/Configure irix64-mips4-$CC' *manually*."
463 if [ "$DRYRUN" = "false" -a -t 1 ]; then
464 echo " You have about 5 seconds to press Ctrl-C to abort."
465 (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
469 ppc-apple-rhapsody) OUT="rhapsody-ppc-cc" ;;
471 ISA64=`(sysctl -n hw.optional.64bitops) 2>/dev/null`
472 if [ "$ISA64" = "1" -a -z "$KERNEL_BITS" ]; then
473 echo "WARNING! If you wish to build 64-bit library, then you have to"
474 echo " invoke '$THERE/Configure darwin64-ppc-cc' *manually*."
475 if [ "$DRYRUN" = "false" -a -t 1 ]; then
476 echo " You have about 5 seconds to press Ctrl-C to abort."
477 (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
480 if [ "$ISA64" = "1" -a "$KERNEL_BITS" = "64" ]; then
481 OUT="darwin64-ppc-cc"
486 ISA64=`(sysctl -n hw.optional.x86_64) 2>/dev/null`
487 if [ "$ISA64" = "1" -a -z "$KERNEL_BITS" ]; then
488 echo "WARNING! If you wish to build 64-bit library, then you have to"
489 echo " invoke 'KERNEL_BITS=64 $THERE/config $options'."
490 if [ "$DRYRUN" = "false" -a -t 1 ]; then
491 echo " You have about 5 seconds to press Ctrl-C to abort."
492 (trap "stty `stty -g`; exit 1" 2; stty -icanon min 0 time 50; read waste; exit 0) <&1 || exit
495 if [ "$ISA64" = "1" -a "$KERNEL_BITS" = "64" ]; then
496 OUT="darwin64-x86_64-cc"
500 x86_64-apple-darwin*)
501 if [ "$KERNEL_BITS" = "32" ]; then
504 OUT="darwin64-x86_64-cc"
507 options="$options -arch%20armv6 -arch%20armv7"
508 OUT="iphoneos-cross" ;;
510 options="$options -arch%20${MACHINE}"
511 OUT="iphoneos-cross" ;;
512 arm64-*-iphoneos|*-*-ios64)
515 ISA=`awk '/cpu model/{print$4;exit(0);}' /proc/cpuinfo`
516 case ${ISA:-generic} in
517 *[678]) OUT="linux-alpha+bwx-$CC" ;;
518 *) OUT="linux-alpha-$CC" ;;
520 if [ "$CC" = "gcc" ]; then
521 case ${ISA:-generic} in
522 EV5|EV45) options="$options -mcpu=ev5";;
523 EV56|PCA56) options="$options -mcpu=ev56";;
524 *) options="$options -mcpu=ev6";;
529 if [ -z "$KERNEL_BITS" ]; then
530 echo "WARNING! If you wish to build 64-bit library, then you have to"
531 echo " invoke '$THERE/Configure linux-ppc64' *manually*."
532 if [ "$DRYRUN" = "false" -a -t 1 ]; then
533 echo " You have about 5 seconds to press Ctrl-C to abort."
534 (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
537 if [ "$KERNEL_BITS" = "64" ]; then
541 (echo "__LP64__" | gcc -E -x c - 2>/dev/null | grep "^__LP64__" 2>&1 > /dev/null) || options="$options -m32"
544 ppc64le-*-linux2) OUT="linux-ppc64le" ;;
545 ppc-*-linux2) OUT="linux-ppc" ;;
547 echo "WARNING! If you wish to build 64-bit library, then you have to"
548 echo " invoke '$THERE/Configure linux64-mips64' *manually*."
549 if [ "$DRYRUN" = "false" -a -t 1 ]; then
550 echo " You have about 5 seconds to press Ctrl-C to abort."
551 (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
555 mips*-*-linux2) OUT="linux-mips32" ;;
556 ppc60x-*-vxworks*) OUT="vxworks-ppc60x" ;;
557 ppcgen-*-vxworks*) OUT="vxworks-ppcgen" ;;
558 pentium-*-vxworks*) OUT="vxworks-pentium" ;;
559 simlinux-*-vxworks*) OUT="vxworks-simlinux" ;;
560 mips-*-vxworks*) OUT="vxworks-mips";;
561 ia64-*-linux?) OUT="linux-ia64" ;;
563 echo "WARNING! If you *know* that your GNU C supports 64-bit/V9 ABI"
564 echo " and wish to build 64-bit library, then you have to"
565 echo " invoke '$THERE/Configure linux64-sparcv9' *manually*."
566 if [ "$DRYRUN" = "false" -a -t 1 ]; then
567 echo " You have about 5 seconds to press Ctrl-C to abort."
568 (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
570 OUT="linux-sparcv9" ;;
572 KARCH=`awk '/^type/{print$3;exit(0);}' /proc/cpuinfo`
573 case ${KARCH:-sun4} in
574 sun4u*) OUT="linux-sparcv9" ;;
575 sun4m) OUT="linux-sparcv8" ;;
576 sun4d) OUT="linux-sparcv8" ;;
577 *) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
580 # 64-bit builds under parisc64 linux are not supported and
581 # compiler is expected to generate 32-bit objects...
582 CPUARCH=`awk '/cpu family/{print substr($5,1,3); exit(0);}' /proc/cpuinfo`
583 CPUSCHEDULE=`awk '/^cpu.[ ]*: PA/{print substr($3,3); exit(0);}' /proc/cpuinfo`
585 # ??TODO ?? Model transformations
586 # 0. CPU Architecture for the 1.1 processor has letter suffixes. We strip that off
587 # assuming no further arch. identification will ever be used by GCC.
588 # 1. I'm most concerned about whether is a 7300LC is closer to a 7100 versus a 7100LC.
589 # 2. The variant 64-bit processors cause concern should GCC support explicit schedulers
590 # for these chips in the future.
591 # PA7300LC -> 7100LC (1.1)
592 # PA8200 -> 8000 (2.0)
593 # PA8500 -> 8000 (2.0)
594 # PA8600 -> 8000 (2.0)
596 CPUSCHEDULE=`echo $CPUSCHEDULE|sed -e 's/7300LC/7100LC/' -e 's/8.00/8000/'`
597 # Finish Model transformations
599 options="$options -DB_ENDIAN -mschedule=$CPUSCHEDULE -march=$CPUARCH"
600 OUT="linux-generic32" ;;
601 armv[1-3]*-*-linux2) OUT="linux-generic32" ;;
602 armv[7-9]*-*-linux2) OUT="linux-armv4"; options="$options -march=armv7-a" ;;
603 arm*-*-linux2) OUT="linux-armv4" ;;
604 aarch64-*-linux2) OUT="linux-aarch64" ;;
605 sh*b-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
606 sh*-*-linux2) OUT="linux-generic32"; options="$options -DL_ENDIAN" ;;
607 m68k*-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
608 s390-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
610 # To be uncommented when glibc bug is fixed, see Configure...
611 #if egrep -e '^features.* highgprs' /proc/cpuinfo >/dev/null ; then
612 # echo "WARNING! If you wish to build \"highgprs\" 32-bit library, then you"
613 # echo " have to invoke './Configure linux32-s390x' *manually*."
614 # if [ "$DRYRUN" = "false" -a -t -1 ]; then
615 # echo " You have about 5 seconds to press Ctrl-C to abort."
616 # (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
622 if $CC -dM -E -x c /dev/null 2>&1 | grep -q ILP32 > /dev/null; then
628 # On machines where the compiler understands -m32, prefer a
629 # config target that uses it
630 if $CC -m32 -E -x c /dev/null > /dev/null 2>&1; then
635 *86-*-linux1) OUT="linux-aout" ;;
636 *-*-linux?) OUT="linux-generic32" ;;
637 sun4[uv]*-*-solaris2)
638 OUT="solaris-sparcv9-$CC"
639 ISA64=`(isainfo) 2>/dev/null | grep sparcv9`
640 if [ "$ISA64" != "" -a "$KERNEL_BITS" = "" ]; then
641 if [ "$CC" = "cc" -a $CCVER -ge 50 ]; then
642 echo "WARNING! If you wish to build 64-bit library, then you have to"
643 echo " invoke '$THERE/Configure solaris64-sparcv9-cc' *manually*."
644 if [ "$DRYRUN" = "false" -a -t 1 ]; then
645 echo " You have about 5 seconds to press Ctrl-C to abort."
646 (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
648 elif [ "$CC" = "gcc" -a "$GCC_ARCH" = "-m64" ]; then
649 # $GCC_ARCH denotes default ABI chosen by compiler driver
650 # (first one found on the $PATH). I assume that user
651 # expects certain consistency with the rest of his builds
652 # and therefore switch over to 64-bit. <appro>
653 OUT="solaris64-sparcv9-gcc"
654 echo "WARNING! If you wish to build 32-bit library, then you have to"
655 echo " invoke '$THERE/Configure solaris-sparcv9-gcc' *manually*."
656 if [ "$DRYRUN" = "false" -a -t 1 ]; then
657 echo " You have about 5 seconds to press Ctrl-C to abort."
658 (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
660 elif [ "$GCC_ARCH" = "-m32" ]; then
661 echo "NOTICE! If you *know* that your GNU C supports 64-bit/V9 ABI"
662 echo " and wish to build 64-bit library, then you have to"
663 echo " invoke '$THERE/Configure solaris64-sparcv9-gcc' *manually*."
664 if [ "$DRYRUN" = "false" -a -t 1 ]; then
665 echo " You have about 5 seconds to press Ctrl-C to abort."
666 (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
670 if [ "$ISA64" != "" -a "$KERNEL_BITS" = "64" ]; then
671 OUT="solaris64-sparcv9-$CC"
674 sun4m-*-solaris2) OUT="solaris-sparcv8-$CC" ;;
675 sun4d-*-solaris2) OUT="solaris-sparcv8-$CC" ;;
676 sun4*-*-solaris2) OUT="solaris-sparcv7-$CC" ;;
678 ISA64=`(isainfo) 2>/dev/null | grep amd64`
679 if [ "$ISA64" != "" -a ${KERNEL_BITS:-64} -eq 64 ]; then
680 OUT="solaris64-x86_64-$CC"
682 OUT="solaris-x86-$CC"
683 if [ `uname -r | sed -e 's/5\.//'` -lt 10 ]; then
684 options="$options no-sse2"
688 *-*-sunos4) OUT="sunos-$CC" ;;
690 *86*-*-bsdi4) OUT="BSD-x86-elf"; options="$options no-sse2 -ldl" ;;
691 alpha*-*-*bsd*) OUT="BSD-generic64"; options="$options -DL_ENDIAN" ;;
692 powerpc64-*-*bsd*) OUT="BSD-generic64"; options="$options -DB_ENDIAN" ;;
693 sparc64-*-*bsd*) OUT="BSD-sparc64" ;;
694 ia64-*-*bsd*) OUT="BSD-ia64" ;;
695 x86_64-*-dragonfly*) OUT="BSD-x86_64" ;;
696 amd64-*-*bsd*) OUT="BSD-x86_64" ;;
697 *86*-*-*bsd*) # mimic ld behaviour when it's looking for libc...
698 if [ -L /usr/lib/libc.so ]; then # [Free|Net]BSD
699 libc=/usr/lib/libc.so
701 # ld searches for highest libc.so.* and so do we
702 libc=`(ls /usr/lib/libc.so.* /lib/libc.so.* | tail -1) 2>/dev/null`
704 case "`(file -L $libc) 2>/dev/null`" in
705 *ELF*) OUT="BSD-x86-elf" ;;
706 *) OUT="BSD-x86"; options="$options no-sse2" ;;
708 *-*-*bsd*) OUT="BSD-generic32" ;;
710 x86_64-*-haiku) OUT="haiku-x86_64" ;;
711 *-*-haiku) OUT="haiku-x86" ;;
713 *-*-osf) OUT="osf1-alpha-cc" ;;
714 *-*-tru64) OUT="tru64-alpha-cc" ;;
716 if [ "$CC" = "gcc" ]; then
717 OUT="unixware-7-gcc" ; options="$options no-sse2"
719 OUT="unixware-7" ; options="$options no-sse2 -D__i386__"
722 *-*-[Uu]nix[Ww]are20*) OUT="unixware-2.0"; options="$options no-sse2 no-sha512" ;;
723 *-*-[Uu]nix[Ww]are21*) OUT="unixware-2.1"; options="$options no-sse2 no-sha512" ;;
725 options="$options no-threads no-shared no-asm no-dso"
728 BS2000-siemens-sysv4) OUT="BS2000-OSD" ;;
730 if [ $CC = "gcc" -a $GCC_BITS = "64" ]; then
731 OUT="hpux64-parisc2-gcc"
733 [ "$KERNEL_BITS" ] || KERNEL_BITS=`(getconf KERNEL_BITS) 2>/dev/null`
734 KERNEL_BITS=${KERNEL_BITS:-32}
735 CPU_VERSION=`(getconf CPU_VERSION) 2>/dev/null`
736 CPU_VERSION=${CPU_VERSION:-0}
737 # See <sys/unistd.h> for further info on CPU_VERSION.
738 if [ $CPU_VERSION -ge 768 ]; then # IA-64 CPU
739 if [ $KERNEL_BITS -eq 64 -a "$CC" = "cc" ]; then
744 elif [ $CPU_VERSION -ge 532 ]; then # PA-RISC 2.x CPU
745 OUT=${OUT:-"hpux-parisc2-${CC}"}
746 if [ $KERNEL_BITS -eq 64 -a "$CC" = "cc" ]; then
747 echo "WARNING! If you wish to build 64-bit library then you have to"
748 echo " invoke '$THERE/Configure hpux64-parisc2-cc' *manually*."
749 if [ "$DRYRUN" = "false" -a -t 1 ]; then
750 echo " You have about 5 seconds to press Ctrl-C to abort."
751 (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
754 # PA-RISC 2.0 is no longer supported as separate 32-bit
755 # target. This is compensated for by run-time detection
756 # in most critical assembly modules and taking advantage
757 # of 2.0 architecture in PA-RISC 1.1 build.
758 OUT="hpux-parisc1_1-${CC}"
759 elif [ $CPU_VERSION -ge 528 ]; then # PA-RISC 1.1+ CPU
760 OUT="hpux-parisc1_1-${CC}"
761 elif [ $CPU_VERSION -ge 523 ]; then # PA-RISC 1.0 CPU
762 OUT="hpux-parisc-${CC}"
763 else # Motorola(?) CPU
766 options="$options -D_REENTRANT" ;;
767 *-hpux) OUT="hpux-parisc-$CC" ;;
769 [ "$KERNEL_BITS" ] || KERNEL_BITS=`(getconf KERNEL_BITMODE) 2>/dev/null`
770 KERNEL_BITS=${KERNEL_BITS:-32}
771 OBJECT_MODE=${OBJECT_MODE:-32}
772 if [ "$CC" = "gcc" ]; then
774 if [ $OBJECT_MODE -eq 64 ]; then
775 echo 'Your $OBJECT_MODE was found to be set to 64'
778 elif [ $OBJECT_MODE -eq 64 ]; then
779 echo 'Your $OBJECT_MODE was found to be set to 64'
783 if [ $KERNEL_BITS -eq 64 ]; then
784 echo "WARNING! If you wish to build 64-bit kit, then you have to"
785 echo " invoke '$THERE/Configure aix64-cc' *manually*."
786 if [ "$DRYRUN" = "false" -a -t 1 ]; then
787 echo " You have ~5 seconds to press Ctrl-C to abort."
788 (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
792 if (lsattr -E -O -l `lsdev -c processor|awk '{print$1;exit}'` | grep -i powerpc) >/dev/null 2>&1; then
793 : # this applies even to Power3 and later, as they return PowerPC_POWER[345]
795 options="$options no-asm"
798 # these are all covered by the catchall below
799 i[3456]86-*-cygwin) OUT="Cygwin-x86" ;;
800 *-*-cygwin) OUT="Cygwin-${MACHINE}" ;;
801 x86pc-*-qnx6) OUT="QNX6-i386" ;;
802 *-*-qnx6) OUT="QNX6" ;;
803 x86-*-android|i?86-*-android) OUT="android-x86" ;;
804 armv[7-9]*-*-android)
805 OUT="android-armeabi"; options="$options -march=armv7-a" ;;
806 arm*-*-android) OUT="android-armeabi" ;;
807 *) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
810 # NB: This atalla support has been superseded by the ENGINE support
811 # That contains its own header and definitions anyway. Support can
812 # be enabled or disabled on any supported platform without external
813 # headers, eg. by adding the "hw-atalla" switch to ./config or
816 # See whether we can compile Atalla support
817 #if [ -f /usr/include/atasi.h ]
819 # options="$options -DATALLA"
822 if [ -n "$CONFIG_OPTIONS" ]; then
823 options="$options $CONFIG_OPTIONS"
826 if expr "$options" : '.*no\-asm' > /dev/null; then :; else
827 sh -c "$CROSS_COMPILE${CC:-gcc} -Wa,--help -c -o /tmp/null.$$.o -x assembler /dev/null && rm /tmp/null.$$.o" 2>&1 | \
828 grep \\--noexecstack >/dev/null && \
829 options="$options -Wa,--noexecstack"
832 # gcc < 2.8 does not support -march=ultrasparc
833 if [ "$OUT" = solaris-sparcv9-gcc -a $GCCVER -lt 28 ]
835 echo "WARNING! Falling down to 'solaris-sparcv8-gcc'."
836 echo " Upgrade to gcc-2.8 or later."
838 OUT=solaris-sparcv8-gcc
840 if [ "$OUT" = "linux-sparcv9" -a $GCCVER -lt 28 ]
842 echo "WARNING! Falling down to 'linux-sparcv8'."
843 echo " Upgrade to gcc-2.8 or later."
849 i386-*) options="$options 386" ;;
852 for i in aes aria bf camellia cast des dh dsa ec hmac idea md2 md5 mdc2 rc2 rc4 rc5 ripemd rsa seed sha sm3 sm4
854 if [ ! -d $THERE/crypto/$i ]
856 options="$options no-$i"
860 if [ -z "$OUT" ]; then
864 if [ ".$PERL" = . ] ; then
865 for i in . `echo $PATH | sed 's/:/ /g'`; do
866 if [ -f "$i/perl5$EXE" ] ; then
873 if [ ".$PERL" = . ] ; then
874 for i in . `echo $PATH | sed 's/:/ /g'`; do
875 if [ -f "$i/perl$EXE" ] ; then
876 if "$i/perl$EXE" -e 'exit($]<5.0)'; then
884 if [ ".$PERL" = . ] ; then
885 echo "You need Perl 5."
889 # run Configure to check to see if we need to specify the
890 # compiler for the platform ... in which case we add it on
891 # the end ... otherwise we leave it off
893 $PERL $THERE/Configure LIST | grep "$OUT-$CC" > /dev/null
894 if [ $? = "0" ]; then
900 $PERL $THERE/Configure LIST | grep "$OUT" > /dev/null
901 if [ $? = "0" ]; then
902 if [ "$VERBOSE" = "true" ]; then
903 echo $PERL $THERE/Configure $OUT $options
905 if [ "$DRYRUN" = "false" ]; then
906 # eval to make sure quoted options, possibly with spaces inside,
908 eval $PERL $THERE/Configure $OUT $options
911 echo "This system ($OUT) is not supported. See file INSTALL for details."
915 if [ "$OUT" = "darwin64-x86_64-cc" ]; then
916 echo "WARNING! If you wish to build 32-bit libraries, then you have to"
917 echo " invoke 'KERNEL_BITS=32 $THERE/config $options'."