Home | History | Annotate | Line # | Download | only in dist
config revision 1.1.1.9.2.1
      1          1.1  christos #!/bin/sh
      2      1.1.1.9  christos # Copyright 1998-2019 The OpenSSL Project Authors. All Rights Reserved.
      3          1.1  christos #
      4      1.1.1.7  christos # Licensed under the OpenSSL license (the "License").  You may not use
      5      1.1.1.7  christos # this file except in compliance with the License.  You can obtain a copy
      6      1.1.1.7  christos # in the file LICENSE in the source distribution or at
      7      1.1.1.7  christos # https://www.openssl.org/source/license.html
      8          1.1  christos 
      9      1.1.1.7  christos # OpenSSL config: determine the operating system and run ./Configure
     10      1.1.1.7  christos # Derived from minarch and GuessOS from Apache.
     11          1.1  christos #
     12      1.1.1.7  christos # Do "config -h" for usage information.
     13          1.1  christos SUFFIX=""
     14      1.1.1.7  christos DRYRUN="false"
     15      1.1.1.7  christos VERBOSE="false"
     16          1.1  christos EXE=""
     17      1.1.1.7  christos THERE=`dirname $0`
     18          1.1  christos 
     19          1.1  christos # pick up any command line args to config
     20          1.1  christos for i
     21          1.1  christos do
     22      1.1.1.9  christos case "$i" in
     23      1.1.1.7  christos -d*) options=$options" --debug";;
     24      1.1.1.7  christos -t*) DRYRUN="true" VERBOSE="true";;
     25      1.1.1.7  christos -v*) VERBOSE="true";;
     26      1.1.1.7  christos -h*) DRYRUN="true"; cat <<EOF
     27          1.1  christos Usage: config [options]
     28      1.1.1.7  christos  -d	Build with debugging when possible.
     29          1.1  christos  -t	Test mode, do not run the Configure perl script.
     30      1.1.1.7  christos  -v	Verbose mode, show the exact Configure call that is being made.
     31          1.1  christos  -h	This help.
     32          1.1  christos 
     33          1.1  christos Any other text will be passed to the Configure perl script.
     34          1.1  christos See INSTALL for instructions.
     35          1.1  christos 
     36          1.1  christos EOF
     37          1.1  christos ;;
     38      1.1.1.8  christos *)  i=`echo "$i" | sed -e "s|'|'\\\\\\''|g"`
     39      1.1.1.8  christos     options="$options '$i'" ;;
     40          1.1  christos esac
     41          1.1  christos done
     42          1.1  christos 
     43      1.1.1.8  christos # Environment that's being passed to Configure
     44      1.1.1.8  christos __CNF_CPPDEFINES=
     45      1.1.1.8  christos __CNF_CPPINCLUDES=
     46      1.1.1.8  christos __CNF_CPPFLAGS=
     47      1.1.1.8  christos __CNF_CFLAGS=
     48      1.1.1.8  christos __CNF_CXXFLAGS=
     49      1.1.1.8  christos __CNF_LDFLAGS=
     50      1.1.1.8  christos __CNF_LDLIBS=
     51      1.1.1.8  christos 
     52          1.1  christos # First get uname entries that we use below
     53          1.1  christos 
     54      1.1.1.2  christos [ "$MACHINE" ] || MACHINE=`(uname -m) 2>/dev/null` || MACHINE="unknown"
     55      1.1.1.2  christos [ "$RELEASE" ] || RELEASE=`(uname -r) 2>/dev/null` || RELEASE="unknown"
     56      1.1.1.2  christos [ "$SYSTEM" ] || SYSTEM=`(uname -s) 2>/dev/null`  || SYSTEM="unknown"
     57      1.1.1.2  christos [ "$BUILD" ] || VERSION=`(uname -v) 2>/dev/null` || VERSION="unknown"
     58          1.1  christos 
     59          1.1  christos 
     60          1.1  christos # Now test for ISC and SCO, since it is has a braindamaged uname.
     61          1.1  christos #
     62      1.1.1.9  christos # We need to work around FreeBSD 1.1.5.1
     63          1.1  christos (
     64          1.1  christos XREL=`uname -X 2>/dev/null | grep "^Release" | awk '{print $3}'`
     65          1.1  christos if [ "x$XREL" != "x" ]; then
     66          1.1  christos     if [ -f /etc/kconfig ]; then
     67          1.1  christos 	case "$XREL" in
     68          1.1  christos 	    4.0|4.1)
     69          1.1  christos 		    echo "${MACHINE}-whatever-isc4"; exit 0
     70          1.1  christos 		;;
     71          1.1  christos 	esac
     72          1.1  christos     else
     73          1.1  christos 	case "$XREL" in
     74          1.1  christos 	    3.2v4.2)
     75          1.1  christos 		echo "whatever-whatever-sco3"; exit 0
     76          1.1  christos 		;;
     77          1.1  christos 	    3.2v5.0*)
     78          1.1  christos 		echo "whatever-whatever-sco5"; exit 0
     79          1.1  christos 		;;
     80          1.1  christos 	    4.2MP)
     81          1.1  christos 		case "x${VERSION}" in
     82          1.1  christos 		    x2.0*) echo "whatever-whatever-unixware20"; exit 0 ;;
     83          1.1  christos 		    x2.1*) echo "whatever-whatever-unixware21"; exit 0 ;;
     84          1.1  christos 		    x2*)   echo "whatever-whatever-unixware2";  exit 0 ;;
     85          1.1  christos 		esac
     86          1.1  christos 		;;
     87          1.1  christos 	    4.2)
     88          1.1  christos 		echo "whatever-whatever-unixware1"; exit 0
     89          1.1  christos 		;;
     90          1.1  christos 	    5*)
     91          1.1  christos 		case "x${VERSION}" in
     92          1.1  christos 		    # We hardcode i586 in place of ${MACHINE} for the
     93          1.1  christos 		    # following reason. The catch is that even though Pentium
     94          1.1  christos 		    # is minimum requirement for platforms in question,
     95          1.1  christos 		    # ${MACHINE} gets always assigned to i386. Now, problem
     96          1.1  christos 		    # with i386 is that it makes ./config pass 386 to
     97          1.1  christos 		    # ./Configure, which in turn makes make generate
     98          1.1  christos 		    # inefficient SHA-1 (for this moment) code.
     99          1.1  christos 		    x[678]*)  echo "i586-sco-unixware7"; exit 0 ;;
    100          1.1  christos 		esac
    101          1.1  christos 		;;
    102          1.1  christos 	esac
    103          1.1  christos     fi
    104          1.1  christos fi
    105          1.1  christos # Now we simply scan though... In most cases, the SYSTEM info is enough
    106          1.1  christos #
    107          1.1  christos case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
    108          1.1  christos     A/UX:*)
    109          1.1  christos 	echo "m68k-apple-aux3"; exit 0
    110          1.1  christos 	;;
    111          1.1  christos 
    112          1.1  christos     AIX:[3-9]:4:*)
    113          1.1  christos 	echo "${MACHINE}-ibm-aix"; exit 0
    114          1.1  christos 	;;
    115          1.1  christos 
    116          1.1  christos     AIX:*:[5-9]:*)
    117          1.1  christos 	echo "${MACHINE}-ibm-aix"; exit 0
    118          1.1  christos 	;;
    119          1.1  christos 
    120          1.1  christos     AIX:*)
    121          1.1  christos 	echo "${MACHINE}-ibm-aix3"; exit 0
    122          1.1  christos 	;;
    123          1.1  christos 
    124          1.1  christos     HI-UX:*)
    125          1.1  christos 	echo "${MACHINE}-hi-hiux"; exit 0
    126          1.1  christos 	;;
    127          1.1  christos 
    128          1.1  christos     HP-UX:*)
    129          1.1  christos 	HPUXVER=`echo ${RELEASE}|sed -e 's/[^.]*.[0B]*//'`
    130          1.1  christos 	case "$HPUXVER" in
    131          1.1  christos 	    1[0-9].*)	# HPUX 10 and 11 targets are unified
    132          1.1  christos 		echo "${MACHINE}-hp-hpux1x"; exit 0
    133          1.1  christos 		;;
    134          1.1  christos 	    *)
    135          1.1  christos 		echo "${MACHINE}-hp-hpux"; exit 0
    136          1.1  christos 		;;
    137          1.1  christos 	esac
    138          1.1  christos 	;;
    139          1.1  christos 
    140          1.1  christos     IRIX:6.*)
    141          1.1  christos 	echo "mips3-sgi-irix"; exit 0
    142          1.1  christos 	;;
    143          1.1  christos 
    144          1.1  christos     IRIX64:*)
    145          1.1  christos 	echo "mips4-sgi-irix64"; exit 0
    146          1.1  christos 	;;
    147          1.1  christos 
    148          1.1  christos     Linux:[2-9].*)
    149          1.1  christos 	echo "${MACHINE}-whatever-linux2"; exit 0
    150          1.1  christos 	;;
    151          1.1  christos 
    152          1.1  christos     Linux:1.*)
    153          1.1  christos 	echo "${MACHINE}-whatever-linux1"; exit 0
    154          1.1  christos 	;;
    155          1.1  christos 
    156          1.1  christos     GNU*)
    157          1.1  christos 	echo "hurd-x86"; exit 0;
    158          1.1  christos 	;;
    159          1.1  christos 
    160          1.1  christos     LynxOS:*)
    161          1.1  christos 	echo "${MACHINE}-lynx-lynxos"; exit 0
    162          1.1  christos 	;;
    163          1.1  christos 
    164          1.1  christos     BSD/OS:4.*)  # BSD/OS always says 386
    165          1.1  christos 	echo "i486-whatever-bsdi4"; exit 0
    166          1.1  christos 	;;
    167          1.1  christos 
    168          1.1  christos     BSD/386:*:*:*486*|BSD/OS:*:*:*:*486*)
    169          1.1  christos         case `/sbin/sysctl -n hw.model` in
    170          1.1  christos 	    Pentium*)
    171          1.1  christos                 echo "i586-whatever-bsdi"; exit 0
    172          1.1  christos                 ;;
    173          1.1  christos             *)
    174          1.1  christos                 echo "i386-whatever-bsdi"; exit 0
    175          1.1  christos                 ;;
    176          1.1  christos             esac;
    177          1.1  christos 	;;
    178          1.1  christos 
    179          1.1  christos     BSD/386:*|BSD/OS:*)
    180          1.1  christos 	echo "${MACHINE}-whatever-bsdi"; exit 0
    181          1.1  christos 	;;
    182          1.1  christos 
    183          1.1  christos     FreeBSD:*:*:*386*)
    184          1.1  christos         VERS=`echo ${RELEASE} | sed -e 's/[-(].*//'`
    185          1.1  christos         MACH=`sysctl -n hw.model`
    186          1.1  christos         ARCH='whatever'
    187          1.1  christos         case ${MACH} in
    188          1.1  christos            *386*       ) MACH="i386"     ;;
    189          1.1  christos            *486*       ) MACH="i486"     ;;
    190          1.1  christos            Pentium\ II*) MACH="i686"     ;;
    191          1.1  christos            Pentium*    ) MACH="i586"     ;;
    192          1.1  christos            *           ) MACH="$MACHINE" ;;
    193          1.1  christos         esac
    194          1.1  christos         case ${MACH} in
    195          1.1  christos            i[0-9]86 ) ARCH="pc" ;;
    196          1.1  christos         esac
    197          1.1  christos         echo "${MACH}-${ARCH}-freebsd${VERS}"; exit 0
    198          1.1  christos         ;;
    199          1.1  christos 
    200      1.1.1.8  christos     DragonFly:*)
    201      1.1.1.8  christos 	echo "${MACHINE}-whatever-dragonfly"; exit 0
    202      1.1.1.8  christos 	;;
    203      1.1.1.8  christos 
    204          1.1  christos     FreeBSD:*)
    205          1.1  christos 	echo "${MACHINE}-whatever-freebsd"; exit 0
    206          1.1  christos 	;;
    207          1.1  christos 
    208      1.1.1.7  christos     Haiku:*)
    209      1.1.1.7  christos 	echo "${MACHINE}-whatever-haiku"; exit 0
    210      1.1.1.7  christos 	;;
    211      1.1.1.7  christos 
    212          1.1  christos     NetBSD:*:*:*386*)
    213          1.1  christos         echo "`(/usr/sbin/sysctl -n hw.model || /sbin/sysctl -n hw.model) | sed 's,.*\(.\)86-class.*,i\186,'`-whatever-netbsd"; exit 0
    214          1.1  christos 	;;
    215          1.1  christos 
    216          1.1  christos     NetBSD:*)
    217          1.1  christos 	echo "${MACHINE}-whatever-netbsd"; exit 0
    218          1.1  christos 	;;
    219          1.1  christos 
    220          1.1  christos     OpenBSD:*)
    221          1.1  christos 	echo "${MACHINE}-whatever-openbsd"; exit 0
    222          1.1  christos 	;;
    223          1.1  christos 
    224          1.1  christos     OpenUNIX:*)
    225          1.1  christos 	echo "${MACHINE}-unknown-OpenUNIX${VERSION}"; exit 0
    226          1.1  christos 	;;
    227          1.1  christos 
    228          1.1  christos     OSF1:*:*:*alpha*)
    229          1.1  christos 	OSFMAJOR=`echo ${RELEASE}| sed -e 's/^V\([0-9]*\)\..*$/\1/'`
    230          1.1  christos 	case "$OSFMAJOR" in
    231          1.1  christos 	    4|5)
    232          1.1  christos 		echo "${MACHINE}-dec-tru64"; exit 0
    233          1.1  christos 		;;
    234          1.1  christos 	    1|2|3)
    235          1.1  christos 		echo "${MACHINE}-dec-osf"; exit 0
    236          1.1  christos 		;;
    237          1.1  christos 	    *)
    238          1.1  christos 		echo "${MACHINE}-dec-osf"; exit 0
    239          1.1  christos 		;;
    240          1.1  christos 	esac
    241          1.1  christos 	;;
    242          1.1  christos 
    243          1.1  christos     Paragon*:*:*:*)
    244          1.1  christos 	echo "i860-intel-osf1"; exit 0
    245          1.1  christos 	;;
    246          1.1  christos 
    247          1.1  christos     Rhapsody:*)
    248          1.1  christos 	echo "ppc-apple-rhapsody"; exit 0
    249          1.1  christos 	;;
    250          1.1  christos 
    251          1.1  christos     Darwin:*)
    252          1.1  christos 	case "$MACHINE" in
    253          1.1  christos 	    Power*)
    254          1.1  christos 		echo "ppc-apple-darwin${VERSION}"
    255          1.1  christos 		;;
    256      1.1.1.7  christos 	    x86_64)
    257      1.1.1.7  christos 		echo "x86_64-apple-darwin${VERSION}"
    258      1.1.1.7  christos 		;;
    259          1.1  christos 	    *)
    260          1.1  christos 		echo "i686-apple-darwin${VERSION}"
    261          1.1  christos 		;;
    262          1.1  christos 	esac
    263          1.1  christos 	exit 0
    264          1.1  christos 	;;
    265          1.1  christos 
    266          1.1  christos     SunOS:5.*)
    267          1.1  christos 	echo "${MACHINE}-whatever-solaris2"; exit 0
    268          1.1  christos 	;;
    269          1.1  christos 
    270          1.1  christos     SunOS:*)
    271          1.1  christos 	echo "${MACHINE}-sun-sunos4"; exit 0
    272          1.1  christos 	;;
    273          1.1  christos 
    274          1.1  christos     UNIX_System_V:4.*:*)
    275          1.1  christos 	echo "${MACHINE}-whatever-sysv4"; exit 0
    276          1.1  christos 	;;
    277          1.1  christos 
    278          1.1  christos     VOS:*:*:i786)
    279          1.1  christos      echo "i386-stratus-vos"; exit 0
    280          1.1  christos      ;;
    281          1.1  christos 
    282          1.1  christos     VOS:*:*:*)
    283          1.1  christos      echo "hppa1.1-stratus-vos"; exit 0
    284          1.1  christos      ;;
    285          1.1  christos 
    286          1.1  christos     *:4*:R4*:m88k)
    287          1.1  christos 	echo "${MACHINE}-whatever-sysv4"; exit 0
    288          1.1  christos 	;;
    289          1.1  christos 
    290          1.1  christos     DYNIX/ptx:4*:*)
    291          1.1  christos 	echo "${MACHINE}-whatever-sysv4"; exit 0
    292          1.1  christos 	;;
    293          1.1  christos 
    294          1.1  christos     *:4.0:3.0:3[34]?? | *:4.0:3.0:3[34]??,*)
    295          1.1  christos 	echo "i486-ncr-sysv4"; exit 0
    296          1.1  christos 	;;
    297          1.1  christos 
    298          1.1  christos     ULTRIX:*)
    299          1.1  christos 	echo "${MACHINE}-unknown-ultrix"; exit 0
    300          1.1  christos 	;;
    301          1.1  christos 
    302          1.1  christos     POSIX-BC*)
    303          1.1  christos 	echo "${MACHINE}-siemens-sysv4"; exit 0   # Here, $MACHINE == "BS2000"
    304          1.1  christos 	;;
    305          1.1  christos 
    306          1.1  christos     machten:*)
    307          1.1  christos        echo "${MACHINE}-tenon-${SYSTEM}"; exit 0;
    308          1.1  christos        ;;
    309          1.1  christos 
    310          1.1  christos     library:*)
    311          1.1  christos 	echo "${MACHINE}-ncr-sysv4"; exit 0
    312          1.1  christos 	;;
    313          1.1  christos 
    314          1.1  christos     ConvexOS:*:11.0:*)
    315          1.1  christos 	echo "${MACHINE}-v11-${SYSTEM}"; exit 0;
    316          1.1  christos 	;;
    317          1.1  christos 
    318      1.1.1.7  christos     # The following combinations are supported
    319      1.1.1.7  christos     # MINGW64* on x86_64 => mingw64
    320      1.1.1.7  christos     # MINGW32* on x86_64 => mingw
    321      1.1.1.7  christos     # MINGW32* on i?86 => mingw
    322      1.1.1.7  christos     #
    323      1.1.1.7  christos     # MINGW64* on i?86 isn't expected to work...
    324      1.1.1.7  christos     MINGW64*:*:*:x86_64)
    325      1.1.1.7  christos 	echo "${MACHINE}-whatever-mingw64"; exit 0;
    326          1.1  christos 	;;
    327          1.1  christos     MINGW*)
    328          1.1  christos 	echo "${MACHINE}-whatever-mingw"; exit 0;
    329          1.1  christos 	;;
    330          1.1  christos     CYGWIN*)
    331      1.1.1.7  christos 	echo "${MACHINE}-pc-cygwin"; exit 0
    332          1.1  christos 	;;
    333          1.1  christos 
    334      1.1.1.4  christos     vxworks*)
    335      1.1.1.4  christos        echo "${MACHINE}-whatever-vxworks"; exit 0;
    336      1.1.1.4  christos        ;;
    337          1.1  christos esac
    338          1.1  christos 
    339          1.1  christos #
    340          1.1  christos # Ugg. These are all we can determine by what we know about
    341          1.1  christos # the output of uname. Be more creative:
    342          1.1  christos #
    343          1.1  christos 
    344          1.1  christos # Do the Apollo stuff first. Here, we just simply assume
    345      1.1.1.7  christos # that the existence of the /usr/apollo directory is proof
    346          1.1  christos # enough
    347          1.1  christos if [ -d /usr/apollo ]; then
    348          1.1  christos     echo "whatever-apollo-whatever"
    349          1.1  christos     exit 0
    350          1.1  christos fi
    351          1.1  christos 
    352          1.1  christos # Now NeXT
    353          1.1  christos ISNEXT=`hostinfo 2>/dev/null`
    354          1.1  christos case "$ISNEXT" in
    355          1.1  christos     *'NeXT Mach 3.3'*)
    356          1.1  christos 	echo "whatever-next-nextstep3.3"; exit 0
    357          1.1  christos 	;;
    358          1.1  christos     *NeXT*)
    359          1.1  christos 	echo "whatever-next-nextstep"; exit 0
    360          1.1  christos 	;;
    361          1.1  christos esac
    362          1.1  christos 
    363          1.1  christos # At this point we gone through all the one's
    364          1.1  christos # we know of: Punt
    365          1.1  christos 
    366      1.1.1.9  christos echo "${MACHINE}-whatever-${SYSTEM}"
    367          1.1  christos exit 0
    368          1.1  christos ) 2>/dev/null | (
    369          1.1  christos 
    370          1.1  christos # ---------------------------------------------------------------------------
    371          1.1  christos # this is where the translation occurs into SSLeay terms
    372          1.1  christos # ---------------------------------------------------------------------------
    373          1.1  christos 
    374          1.1  christos # Only set CC if not supplied already
    375      1.1.1.4  christos if [ -z "$CROSS_COMPILE$CC" ]; then
    376      1.1.1.4  christos   GCCVER=`sh -c "gcc -dumpversion" 2>/dev/null`
    377          1.1  christos   if [ "$GCCVER" != "" ]; then
    378      1.1.1.4  christos     # then strip off whatever prefix egcs prepends the number with...
    379      1.1.1.4  christos     # Hopefully, this will work for any future prefixes as well.
    380      1.1.1.4  christos     GCCVER=`echo $GCCVER | LC_ALL=C sed 's/^[a-zA-Z]*\-//'`
    381      1.1.1.4  christos     # Since gcc 3.1 gcc --version behaviour has changed.  gcc -dumpversion
    382      1.1.1.4  christos     # does give us what we want though, so we use that.  We just just the
    383      1.1.1.4  christos     # major and minor version numbers.
    384      1.1.1.4  christos     # peak single digit before and after first dot, e.g. 2.95.1 gives 29
    385      1.1.1.4  christos     GCCVER=`echo $GCCVER | sed 's/\([0-9]\)\.\([0-9]\).*/\1\2/'`
    386          1.1  christos     CC=gcc
    387          1.1  christos   else
    388          1.1  christos     CC=cc
    389          1.1  christos   fi
    390          1.1  christos fi
    391          1.1  christos GCCVER=${GCCVER:-0}
    392          1.1  christos if [ "$SYSTEM" = "HP-UX" ];then
    393          1.1  christos   # By default gcc is a ILP32 compiler (with long long == 64).
    394          1.1  christos   GCC_BITS="32"
    395          1.1  christos   if [ $GCCVER -ge 30 ]; then
    396          1.1  christos     # PA64 support only came in with gcc 3.0.x.
    397          1.1  christos     # We check if the preprocessor symbol __LP64__ is defined...
    398          1.1  christos     if echo "__LP64__" | gcc -v -E -x c - 2>/dev/null | grep "^__LP64__" 2>&1 > /dev/null; then
    399          1.1  christos       : # __LP64__ has slipped through, it therefore is not defined
    400          1.1  christos     else
    401          1.1  christos       GCC_BITS="64"
    402          1.1  christos     fi
    403          1.1  christos   fi
    404          1.1  christos fi
    405          1.1  christos if [ "$SYSTEM" = "SunOS" ]; then
    406          1.1  christos   if [ $GCCVER -ge 30 ]; then
    407          1.1  christos     # 64-bit ABI isn't officially supported in gcc 3.0, but it appears
    408          1.1  christos     # to be working, at the very least 'make test' passes...
    409          1.1  christos     if gcc -v -E -x c /dev/null 2>&1 | grep __arch64__ > /dev/null; then
    410          1.1  christos       GCC_ARCH="-m64"
    411          1.1  christos     else
    412          1.1  christos       GCC_ARCH="-m32"
    413          1.1  christos     fi
    414          1.1  christos   fi
    415          1.1  christos   # check for WorkShop C, expected output is "cc: blah-blah C x.x"
    416          1.1  christos   CCVER=`(cc -V 2>&1) 2>/dev/null | \
    417          1.1  christos   	egrep -e '^cc: .* C [0-9]\.[0-9]' | \
    418          1.1  christos 	sed 's/.* C \([0-9]\)\.\([0-9]\).*/\1\2/'`
    419          1.1  christos   CCVER=${CCVER:-0}
    420          1.1  christos   if [ $MACHINE != i86pc -a $CCVER -gt 40 ]; then
    421          1.1  christos     CC=cc	# overrides gcc!!!
    422          1.1  christos     if [ $CCVER -eq 50 ]; then
    423          1.1  christos       echo "WARNING! Detected WorkShop C 5.0. Do make sure you have"
    424          1.1  christos       echo "         patch #107357-01 or later applied."
    425          1.1  christos       sleep 5
    426          1.1  christos     fi
    427          1.1  christos   fi
    428          1.1  christos fi
    429          1.1  christos 
    430          1.1  christos if [ "${SYSTEM}" = "AIX" ]; then	# favor vendor cc over gcc
    431          1.1  christos     (cc) 2>&1 | grep -iv "not found" > /dev/null && CC=cc
    432          1.1  christos fi
    433          1.1  christos 
    434          1.1  christos CCVER=${CCVER:-0}
    435          1.1  christos 
    436      1.1.1.9  christos # read the output of the embedded GuessOS
    437          1.1  christos read GUESSOS
    438          1.1  christos 
    439          1.1  christos echo Operating system: $GUESSOS
    440          1.1  christos 
    441          1.1  christos # now map the output into SSLeay terms ... really should hack into the
    442          1.1  christos # script above so we end up with values in vars but that would take
    443          1.1  christos # more time that I want to waste at the moment
    444          1.1  christos case "$GUESSOS" in
    445          1.1  christos   uClinux*64*)
    446          1.1  christos     OUT=uClinux-dist64
    447          1.1  christos 	;;
    448          1.1  christos   uClinux*)
    449          1.1  christos     OUT=uClinux-dist
    450          1.1  christos 	;;
    451          1.1  christos   mips3-sgi-irix)
    452          1.1  christos 	OUT="irix-mips3-$CC"
    453          1.1  christos 	;;
    454          1.1  christos   mips4-sgi-irix64)
    455          1.1  christos 	echo "WARNING! If you wish to build 64-bit library, then you have to"
    456      1.1.1.7  christos 	echo "         invoke '$THERE/Configure irix64-mips4-$CC' *manually*."
    457      1.1.1.7  christos 	if [ "$DRYRUN" = "false" -a -t 1 ]; then
    458          1.1  christos 	  echo "         You have about 5 seconds to press Ctrl-C to abort."
    459      1.1.1.7  christos 	  (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
    460          1.1  christos 	fi
    461          1.1  christos 	OUT="irix-mips3-$CC"
    462          1.1  christos 	;;
    463          1.1  christos   ppc-apple-rhapsody) OUT="rhapsody-ppc-cc" ;;
    464          1.1  christos   ppc-apple-darwin*)
    465          1.1  christos 	ISA64=`(sysctl -n hw.optional.64bitops) 2>/dev/null`
    466      1.1.1.4  christos 	if [ "$ISA64" = "1" -a -z "$KERNEL_BITS" ]; then
    467          1.1  christos 	    echo "WARNING! If you wish to build 64-bit library, then you have to"
    468      1.1.1.7  christos 	    echo "         invoke '$THERE/Configure darwin64-ppc-cc' *manually*."
    469      1.1.1.7  christos 	    if [ "$DRYRUN" = "false" -a -t 1 ]; then
    470          1.1  christos 	      echo "         You have about 5 seconds to press Ctrl-C to abort."
    471      1.1.1.7  christos 	      (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
    472          1.1  christos 	    fi
    473          1.1  christos 	fi
    474      1.1.1.4  christos 	if [ "$ISA64" = "1" -a "$KERNEL_BITS" = "64" ]; then
    475      1.1.1.4  christos 	    OUT="darwin64-ppc-cc"
    476      1.1.1.4  christos 	else
    477      1.1.1.4  christos 	    OUT="darwin-ppc-cc"
    478      1.1.1.4  christos 	fi ;;
    479          1.1  christos   i?86-apple-darwin*)
    480          1.1  christos 	ISA64=`(sysctl -n hw.optional.x86_64) 2>/dev/null`
    481      1.1.1.4  christos 	if [ "$ISA64" = "1" -a -z "$KERNEL_BITS" ]; then
    482          1.1  christos 	    echo "WARNING! If you wish to build 64-bit library, then you have to"
    483      1.1.1.7  christos 	    echo "         invoke 'KERNEL_BITS=64 $THERE/config $options'."
    484      1.1.1.7  christos 	    if [ "$DRYRUN" = "false" -a -t 1 ]; then
    485          1.1  christos 	      echo "         You have about 5 seconds to press Ctrl-C to abort."
    486      1.1.1.8  christos 	      (trap "stty `stty -g`; exit 1" 2; stty -icanon min 0 time 50; read waste; exit 0) <&1 || exit
    487          1.1  christos 	    fi
    488          1.1  christos 	fi
    489      1.1.1.4  christos 	if [ "$ISA64" = "1" -a "$KERNEL_BITS" = "64" ]; then
    490      1.1.1.4  christos 	    OUT="darwin64-x86_64-cc"
    491      1.1.1.4  christos 	else
    492      1.1.1.4  christos 	    OUT="darwin-i386-cc"
    493      1.1.1.4  christos 	fi ;;
    494      1.1.1.7  christos   x86_64-apple-darwin*)
    495      1.1.1.7  christos 	if [ "$KERNEL_BITS" = "32" ]; then
    496      1.1.1.7  christos 	    OUT="darwin-i386-cc"
    497      1.1.1.7  christos 	else
    498      1.1.1.7  christos 	    OUT="darwin64-x86_64-cc"
    499      1.1.1.7  christos 	fi ;;
    500      1.1.1.4  christos   armv6+7-*-iphoneos)
    501  1.1.1.9.2.1    martin 	__CNF_CFLAGS="$__CNF_CFLAGS -arch armv6 -arch armv7"
    502  1.1.1.9.2.1    martin 	__CNF_CXXFLAGS="$__CNF_CXXFLAGS -arch armv6 -arch armv7"
    503      1.1.1.4  christos 	OUT="iphoneos-cross" ;;
    504      1.1.1.4  christos   *-*-iphoneos)
    505  1.1.1.9.2.1    martin 	__CNF_CFLAGS="$__CNF_CFLAGS -arch ${MACHINE}"
    506  1.1.1.9.2.1    martin 	__CNF_CXXFLAGS="$__CNF_CXXFLAGS -arch ${MACHINE}"
    507      1.1.1.4  christos 	OUT="iphoneos-cross" ;;
    508      1.1.1.7  christos   arm64-*-iphoneos|*-*-ios64)
    509      1.1.1.7  christos 	OUT="ios64-cross" ;;
    510          1.1  christos   alpha-*-linux2)
    511          1.1  christos         ISA=`awk '/cpu model/{print$4;exit(0);}' /proc/cpuinfo`
    512          1.1  christos 	case ${ISA:-generic} in
    513          1.1  christos 	*[678])	OUT="linux-alpha+bwx-$CC" ;;
    514          1.1  christos 	*)	OUT="linux-alpha-$CC" ;;
    515          1.1  christos 	esac
    516          1.1  christos 	if [ "$CC" = "gcc" ]; then
    517          1.1  christos 	    case ${ISA:-generic} in
    518      1.1.1.8  christos 	    EV5|EV45)		__CNF_CFLAGS="$__CNF_CFLAGS -mcpu=ev5"
    519      1.1.1.8  christos 				__CNF_CXXFLAGS="$__CNF_CFLAGS -mcpu=ev5";;
    520      1.1.1.8  christos 	    EV56|PCA56)		__CNF_CFLAGS="$__CNF_CFLAGS -mcpu=ev56"
    521      1.1.1.8  christos 				__CNF_CXXFLAGS="$__CNF_CXXFLAGS -mcpu=ev56";;
    522      1.1.1.8  christos 	    *)			__CNF_CFLAGS="$__CNF_CFLAGS -mcpu=ev6"
    523      1.1.1.8  christos 				__CNF_CXXFLAGS="$__CNF_CXXFLAGS -mcpu=ev6";;
    524          1.1  christos 	    esac
    525          1.1  christos 	fi
    526          1.1  christos 	;;
    527          1.1  christos   ppc64-*-linux2)
    528      1.1.1.6       spz 	if [ -z "$KERNEL_BITS" ]; then
    529      1.1.1.6       spz 	    echo "WARNING! If you wish to build 64-bit library, then you have to"
    530      1.1.1.7  christos 	    echo "         invoke '$THERE/Configure linux-ppc64' *manually*."
    531      1.1.1.7  christos 	    if [ "$DRYRUN" = "false" -a -t 1 ]; then
    532      1.1.1.6       spz 		echo "         You have about 5 seconds to press Ctrl-C to abort."
    533      1.1.1.7  christos 		(trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
    534      1.1.1.6       spz 	    fi
    535      1.1.1.6       spz 	fi
    536      1.1.1.6       spz 	if [ "$KERNEL_BITS" = "64" ]; then
    537      1.1.1.6       spz 	    OUT="linux-ppc64"
    538      1.1.1.6       spz 	else
    539      1.1.1.6       spz 	    OUT="linux-ppc"
    540      1.1.1.8  christos 	    if (echo "__LP64__" | gcc -E -x c - 2>/dev/null | grep "^__LP64__" 2>&1 > /dev/null); then
    541      1.1.1.8  christos 		:;
    542      1.1.1.8  christos 	    else
    543      1.1.1.8  christos 		__CNF_CFLAGS="$__CNF_CFLAGS -m32"
    544      1.1.1.8  christos 		__CNF_CXXFLAGS="$__CNF_CXXFLAGS -m32"
    545      1.1.1.8  christos 	    fi
    546      1.1.1.6       spz 	fi
    547      1.1.1.6       spz 	;;
    548      1.1.1.6       spz   ppc64le-*-linux2) OUT="linux-ppc64le" ;;
    549      1.1.1.6       spz   ppc-*-linux2) OUT="linux-ppc" ;;
    550      1.1.1.6       spz   mips64*-*-linux2)
    551          1.1  christos 	echo "WARNING! If you wish to build 64-bit library, then you have to"
    552      1.1.1.7  christos 	echo "         invoke '$THERE/Configure linux64-mips64' *manually*."
    553      1.1.1.7  christos 	if [ "$DRYRUN" = "false" -a -t 1 ]; then
    554          1.1  christos 	    echo "         You have about 5 seconds to press Ctrl-C to abort."
    555      1.1.1.7  christos 	    (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
    556          1.1  christos 	fi
    557      1.1.1.6       spz 	OUT="linux-mips64"
    558          1.1  christos 	;;
    559      1.1.1.6       spz   mips*-*-linux2) OUT="linux-mips32" ;;
    560      1.1.1.4  christos   ppc60x-*-vxworks*) OUT="vxworks-ppc60x" ;;
    561      1.1.1.4  christos   ppcgen-*-vxworks*) OUT="vxworks-ppcgen" ;;
    562      1.1.1.4  christos   pentium-*-vxworks*) OUT="vxworks-pentium" ;;
    563      1.1.1.4  christos   simlinux-*-vxworks*) OUT="vxworks-simlinux" ;;
    564      1.1.1.4  christos   mips-*-vxworks*) OUT="vxworks-mips";;
    565          1.1  christos   ia64-*-linux?) OUT="linux-ia64" ;;
    566          1.1  christos   sparc64-*-linux2)
    567          1.1  christos 	echo "WARNING! If you *know* that your GNU C supports 64-bit/V9 ABI"
    568          1.1  christos 	echo "         and wish to build 64-bit library, then you have to"
    569      1.1.1.7  christos 	echo "         invoke '$THERE/Configure linux64-sparcv9' *manually*."
    570      1.1.1.7  christos 	if [ "$DRYRUN" = "false" -a -t 1 ]; then
    571          1.1  christos 	  echo "          You have about 5 seconds to press Ctrl-C to abort."
    572      1.1.1.7  christos 	  (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
    573          1.1  christos 	fi
    574          1.1  christos 	OUT="linux-sparcv9" ;;
    575          1.1  christos   sparc-*-linux2)
    576          1.1  christos 	KARCH=`awk '/^type/{print$3;exit(0);}' /proc/cpuinfo`
    577          1.1  christos 	case ${KARCH:-sun4} in
    578          1.1  christos 	sun4u*)	OUT="linux-sparcv9" ;;
    579          1.1  christos 	sun4m)	OUT="linux-sparcv8" ;;
    580          1.1  christos 	sun4d)	OUT="linux-sparcv8" ;;
    581      1.1.1.8  christos 	*)	OUT="linux-generic32";
    582      1.1.1.8  christos 		__CNF_CPPFLAGS="$__CNF_CPPFLAGS -DB_ENDIAN" ;;
    583          1.1  christos 	esac ;;
    584          1.1  christos   parisc*-*-linux2)
    585          1.1  christos 	# 64-bit builds under parisc64 linux are not supported and
    586          1.1  christos 	# compiler is expected to generate 32-bit objects...
    587          1.1  christos 	CPUARCH=`awk '/cpu family/{print substr($5,1,3); exit(0);}' /proc/cpuinfo`
    588          1.1  christos 	CPUSCHEDULE=`awk '/^cpu.[ 	]*: PA/{print substr($3,3); exit(0);}' /proc/cpuinfo`
    589          1.1  christos 
    590          1.1  christos 	# ??TODO ??  Model transformations
    591          1.1  christos 	# 0. CPU Architecture for the 1.1 processor has letter suffixes. We strip that off
    592          1.1  christos 	#    assuming no further arch. identification will ever be used by GCC.
    593          1.1  christos 	# 1. I'm most concerned about whether is a 7300LC is closer to a 7100 versus a 7100LC.
    594          1.1  christos 	# 2. The variant 64-bit processors cause concern should GCC support explicit schedulers
    595          1.1  christos 	#    for these chips in the future.
    596          1.1  christos 	#         PA7300LC -> 7100LC (1.1)
    597          1.1  christos 	#         PA8200   -> 8000   (2.0)
    598          1.1  christos 	#         PA8500   -> 8000   (2.0)
    599          1.1  christos 	#         PA8600   -> 8000   (2.0)
    600          1.1  christos 
    601          1.1  christos 	CPUSCHEDULE=`echo $CPUSCHEDULE|sed -e 's/7300LC/7100LC/' -e 's/8.00/8000/'`
    602          1.1  christos 	# Finish Model transformations
    603          1.1  christos 
    604      1.1.1.8  christos 	__CNF_CPPFLAGS="$__CNF_CPPFLAGS -DB_ENDIAN"
    605      1.1.1.8  christos 	__CNF_CFLAGS="$__CNF_CFLAGS -mschedule=$CPUSCHEDULE -march=$CPUARCH"
    606      1.1.1.8  christos 	__CNF_CXXFLAGS="$__CNF_CXXFLAGS -mschedule=$CPUSCHEDULE -march=$CPUARCH"
    607          1.1  christos 	OUT="linux-generic32" ;;
    608          1.1  christos   armv[1-3]*-*-linux2) OUT="linux-generic32" ;;
    609      1.1.1.8  christos   armv[7-9]*-*-linux2) OUT="linux-armv4"
    610      1.1.1.8  christos 		       __CNF_CFLAGS="$__CNF_CFLAGS -march=armv7-a"
    611      1.1.1.8  christos 		       __CNF_CXXFLAGS="$__CNF_CXXFLAGS -march=armv7-a"
    612      1.1.1.8  christos 		       ;;
    613          1.1  christos   arm*-*-linux2) OUT="linux-armv4" ;;
    614      1.1.1.6       spz   aarch64-*-linux2) OUT="linux-aarch64" ;;
    615      1.1.1.8  christos   sh*b-*-linux2) OUT="linux-generic32";
    616      1.1.1.8  christos 		 __CNF_CPPFLAGS="$__CNF_CPPFLAGS -DB_ENDIAN" ;;
    617      1.1.1.8  christos   sh*-*-linux2)	 OUT="linux-generic32";
    618      1.1.1.8  christos 		 __CNF_CPPFLAGS="$__CNF_CPPFLAGS -DL_ENDIAN" ;;
    619      1.1.1.8  christos   m68k*-*-linux2) OUT="linux-generic32";
    620      1.1.1.8  christos 		  __CNF_CPPFLAGS="$__CNF_CPPFLAGS -DB_ENDIAN" ;;
    621      1.1.1.8  christos   s390-*-linux2) OUT="linux-generic32";
    622      1.1.1.8  christos 		 __CNF_CPPFLAGS="$__CNF_CPPFLAGS -DB_ENDIAN" ;;
    623      1.1.1.4  christos   s390x-*-linux2)
    624      1.1.1.4  christos 	# To be uncommented when glibc bug is fixed, see Configure...
    625      1.1.1.4  christos 	#if egrep -e '^features.* highgprs' /proc/cpuinfo >/dev/null ; then
    626      1.1.1.4  christos 	#  echo "WARNING! If you wish to build \"highgprs\" 32-bit library, then you"
    627      1.1.1.4  christos 	#  echo "         have to invoke './Configure linux32-s390x' *manually*."
    628      1.1.1.7  christos 	#  if [ "$DRYRUN" = "false" -a -t -1 ]; then
    629      1.1.1.4  christos 	#    echo "         You have about 5 seconds to press Ctrl-C to abort."
    630      1.1.1.7  christos 	#    (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
    631      1.1.1.4  christos 	#  fi
    632      1.1.1.4  christos 	#fi
    633      1.1.1.4  christos 	OUT="linux64-s390x"
    634      1.1.1.4  christos 	;;
    635      1.1.1.7  christos   x86_64-*-linux?)
    636      1.1.1.7  christos 	if $CC -dM -E -x c /dev/null 2>&1 | grep -q ILP32 > /dev/null; then
    637      1.1.1.7  christos 	    OUT="linux-x32"
    638      1.1.1.7  christos 	else
    639      1.1.1.7  christos 	    OUT="linux-x86_64"
    640      1.1.1.7  christos 	fi ;;
    641      1.1.1.7  christos   *86-*-linux2)
    642      1.1.1.7  christos         # On machines where the compiler understands -m32, prefer a
    643      1.1.1.7  christos         # config target that uses it
    644      1.1.1.7  christos         if $CC -m32 -E -x c /dev/null > /dev/null 2>&1; then
    645      1.1.1.7  christos             OUT="linux-x86"
    646      1.1.1.7  christos         else
    647      1.1.1.7  christos             OUT="linux-elf"
    648          1.1  christos         fi ;;
    649      1.1.1.7  christos   *86-*-linux1) OUT="linux-aout" ;;
    650      1.1.1.7  christos   *-*-linux?) OUT="linux-generic32" ;;
    651          1.1  christos   sun4[uv]*-*-solaris2)
    652          1.1  christos 	OUT="solaris-sparcv9-$CC"
    653      1.1.1.7  christos 	ISA64=`(isainfo) 2>/dev/null | grep sparcv9`
    654      1.1.1.4  christos 	if [ "$ISA64" != "" -a "$KERNEL_BITS" = "" ]; then
    655          1.1  christos 	    if [ "$CC" = "cc" -a $CCVER -ge 50 ]; then
    656          1.1  christos 		echo "WARNING! If you wish to build 64-bit library, then you have to"
    657      1.1.1.7  christos 		echo "         invoke '$THERE/Configure solaris64-sparcv9-cc' *manually*."
    658      1.1.1.7  christos 		if [ "$DRYRUN" = "false" -a -t 1 ]; then
    659          1.1  christos 		  echo "         You have about 5 seconds to press Ctrl-C to abort."
    660      1.1.1.7  christos 		  (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
    661          1.1  christos 		fi
    662          1.1  christos 	    elif [ "$CC" = "gcc" -a "$GCC_ARCH" = "-m64" ]; then
    663          1.1  christos 		# $GCC_ARCH denotes default ABI chosen by compiler driver
    664          1.1  christos 		# (first one found on the $PATH). I assume that user
    665          1.1  christos 		# expects certain consistency with the rest of his builds
    666          1.1  christos 		# and therefore switch over to 64-bit. <appro>
    667          1.1  christos 		OUT="solaris64-sparcv9-gcc"
    668          1.1  christos 		echo "WARNING! If you wish to build 32-bit library, then you have to"
    669      1.1.1.7  christos 		echo "         invoke '$THERE/Configure solaris-sparcv9-gcc' *manually*."
    670      1.1.1.7  christos 		if [ "$DRYRUN" = "false" -a -t 1 ]; then
    671          1.1  christos 		  echo "         You have about 5 seconds to press Ctrl-C to abort."
    672      1.1.1.7  christos 		  (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
    673          1.1  christos 		fi
    674          1.1  christos 	    elif [ "$GCC_ARCH" = "-m32" ]; then
    675          1.1  christos 		echo "NOTICE! If you *know* that your GNU C supports 64-bit/V9 ABI"
    676          1.1  christos 		echo "        and wish to build 64-bit library, then you have to"
    677      1.1.1.7  christos 		echo "        invoke '$THERE/Configure solaris64-sparcv9-gcc' *manually*."
    678      1.1.1.7  christos 		if [ "$DRYRUN" = "false" -a -t 1 ]; then
    679          1.1  christos 		  echo "         You have about 5 seconds to press Ctrl-C to abort."
    680      1.1.1.7  christos 		  (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
    681          1.1  christos 		fi
    682          1.1  christos 	    fi
    683          1.1  christos 	fi
    684      1.1.1.4  christos 	if [ "$ISA64" != "" -a "$KERNEL_BITS" = "64" ]; then
    685      1.1.1.4  christos 	    OUT="solaris64-sparcv9-$CC"
    686      1.1.1.4  christos 	fi
    687          1.1  christos 	;;
    688          1.1  christos   sun4m-*-solaris2)	OUT="solaris-sparcv8-$CC" ;;
    689          1.1  christos   sun4d-*-solaris2)	OUT="solaris-sparcv8-$CC" ;;
    690          1.1  christos   sun4*-*-solaris2)	OUT="solaris-sparcv7-$CC" ;;
    691          1.1  christos   *86*-*-solaris2)
    692      1.1.1.7  christos 	ISA64=`(isainfo) 2>/dev/null | grep amd64`
    693      1.1.1.4  christos 	if [ "$ISA64" != "" -a ${KERNEL_BITS:-64} -eq 64 ]; then
    694          1.1  christos 	    OUT="solaris64-x86_64-$CC"
    695          1.1  christos 	else
    696          1.1  christos 	    OUT="solaris-x86-$CC"
    697          1.1  christos 	    if [ `uname -r | sed -e 's/5\.//'` -lt 10 ]; then
    698          1.1  christos 		options="$options no-sse2"
    699          1.1  christos 	    fi
    700          1.1  christos 	fi
    701          1.1  christos 	;;
    702          1.1  christos   *-*-sunos4)		OUT="sunos-$CC" ;;
    703          1.1  christos 
    704      1.1.1.8  christos   *86*-*-bsdi4)		OUT="BSD-x86-elf"; options="$options no-sse2";
    705      1.1.1.8  christos 			__CNF_LDFLAGS="$__CNF_LDFLAGS -ldl" ;;
    706      1.1.1.8  christos   alpha*-*-*bsd*)	OUT="BSD-generic64";
    707      1.1.1.8  christos 			__CNF_CPPFLAGS="$__CNF_CPPFLAGS -DL_ENDIAN" ;;
    708      1.1.1.8  christos   powerpc64-*-*bsd*)	OUT="BSD-generic64";
    709      1.1.1.8  christos 			__CNF_CPPFLAGS="$__CNF_CPPFLAGS -DB_ENDIAN" ;;
    710          1.1  christos   sparc64-*-*bsd*)	OUT="BSD-sparc64" ;;
    711          1.1  christos   ia64-*-*bsd*)		OUT="BSD-ia64" ;;
    712      1.1.1.8  christos   x86_64-*-dragonfly*)  OUT="BSD-x86_64" ;;
    713          1.1  christos   amd64-*-*bsd*)	OUT="BSD-x86_64" ;;
    714          1.1  christos   *86*-*-*bsd*)		# mimic ld behaviour when it's looking for libc...
    715          1.1  christos 			if [ -L /usr/lib/libc.so ]; then	# [Free|Net]BSD
    716          1.1  christos 			    libc=/usr/lib/libc.so
    717          1.1  christos 			else					# OpenBSD
    718          1.1  christos 			    # ld searches for highest libc.so.* and so do we
    719      1.1.1.5  christos 			    libc=`(ls /usr/lib/libc.so.* /lib/libc.so.* | tail -1) 2>/dev/null`
    720          1.1  christos 			fi
    721          1.1  christos 			case "`(file -L $libc) 2>/dev/null`" in
    722          1.1  christos 			*ELF*)	OUT="BSD-x86-elf" ;;
    723          1.1  christos 			*)	OUT="BSD-x86"; options="$options no-sse2" ;;
    724          1.1  christos 			esac ;;
    725          1.1  christos   *-*-*bsd*)		OUT="BSD-generic32" ;;
    726          1.1  christos 
    727      1.1.1.7  christos   x86_64-*-haiku)	OUT="haiku-x86_64" ;;
    728      1.1.1.7  christos   *-*-haiku)		OUT="haiku-x86" ;;
    729      1.1.1.7  christos 
    730          1.1  christos   *-*-osf)		OUT="osf1-alpha-cc" ;;
    731          1.1  christos   *-*-tru64)		OUT="tru64-alpha-cc" ;;
    732          1.1  christos   *-*-[Uu]nix[Ww]are7)
    733          1.1  christos 	if [ "$CC" = "gcc" ]; then
    734          1.1  christos 	  OUT="unixware-7-gcc" ; options="$options no-sse2"
    735      1.1.1.9  christos 	else
    736      1.1.1.8  christos 	  OUT="unixware-7" ; options="$options no-sse2"
    737      1.1.1.8  christos 	  __CNF_CPPFLAGS="$__CNF_CPPFLAGS -D__i386__"
    738          1.1  christos 	fi
    739          1.1  christos 	;;
    740          1.1  christos   *-*-[Uu]nix[Ww]are20*) OUT="unixware-2.0"; options="$options no-sse2 no-sha512" ;;
    741          1.1  christos   *-*-[Uu]nix[Ww]are21*) OUT="unixware-2.1"; options="$options no-sse2 no-sha512" ;;
    742          1.1  christos   *-*-vos)
    743          1.1  christos 	options="$options no-threads no-shared no-asm no-dso"
    744          1.1  christos 	EXE=".pm"
    745          1.1  christos 	OUT="vos-$CC" ;;
    746          1.1  christos   BS2000-siemens-sysv4) OUT="BS2000-OSD" ;;
    747          1.1  christos   *-hpux1*)
    748          1.1  christos 	if [ $CC = "gcc" -a $GCC_BITS = "64" ]; then
    749          1.1  christos 	    OUT="hpux64-parisc2-gcc"
    750          1.1  christos 	fi
    751      1.1.1.4  christos 	[ "$KERNEL_BITS" ] || KERNEL_BITS=`(getconf KERNEL_BITS) 2>/dev/null`
    752          1.1  christos 	KERNEL_BITS=${KERNEL_BITS:-32}
    753          1.1  christos 	CPU_VERSION=`(getconf CPU_VERSION) 2>/dev/null`
    754          1.1  christos 	CPU_VERSION=${CPU_VERSION:-0}
    755          1.1  christos 	# See <sys/unistd.h> for further info on CPU_VERSION.
    756          1.1  christos 	if   [ $CPU_VERSION -ge 768 ]; then	# IA-64 CPU
    757      1.1.1.4  christos 	     if [ $KERNEL_BITS -eq 64 -a "$CC" = "cc" ]; then
    758      1.1.1.4  christos 	        OUT="hpux64-ia64-cc"
    759      1.1.1.4  christos              else
    760      1.1.1.4  christos 	        OUT="hpux-ia64-cc"
    761      1.1.1.4  christos              fi
    762          1.1  christos 	elif [ $CPU_VERSION -ge 532 ]; then	# PA-RISC 2.x CPU
    763      1.1.1.8  christos 	     # PA-RISC 2.0 is no longer supported as separate 32-bit
    764      1.1.1.8  christos 	     # target. This is compensated for by run-time detection
    765      1.1.1.8  christos 	     # in most critical assembly modules and taking advantage
    766      1.1.1.8  christos 	     # of 2.0 architecture in PA-RISC 1.1 build.
    767      1.1.1.8  christos 	     OUT=${OUT:-"hpux-parisc1_1-${CC}"}
    768          1.1  christos 	     if [ $KERNEL_BITS -eq 64 -a "$CC" = "cc" ]; then
    769          1.1  christos 		echo "WARNING! If you wish to build 64-bit library then you have to"
    770      1.1.1.7  christos 		echo "         invoke '$THERE/Configure hpux64-parisc2-cc' *manually*."
    771      1.1.1.7  christos 		if [ "$DRYRUN" = "false" -a -t 1 ]; then
    772          1.1  christos 		  echo "         You have about 5 seconds to press Ctrl-C to abort."
    773      1.1.1.7  christos 		  (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
    774          1.1  christos 		fi
    775          1.1  christos 	     fi
    776          1.1  christos 	elif [ $CPU_VERSION -ge 528 ]; then	# PA-RISC 1.1+ CPU
    777      1.1.1.7  christos 	     OUT="hpux-parisc1_1-${CC}"
    778          1.1  christos 	elif [ $CPU_VERSION -ge 523 ]; then	# PA-RISC 1.0 CPU
    779          1.1  christos 	     OUT="hpux-parisc-${CC}"
    780          1.1  christos 	else					# Motorola(?) CPU
    781          1.1  christos 	     OUT="hpux-$CC"
    782          1.1  christos 	fi
    783      1.1.1.8  christos 	__CNF_CPPFLAGS="$__CNF_CPPFLAGS -D_REENTRANT" ;;
    784          1.1  christos   *-hpux)	OUT="hpux-parisc-$CC" ;;
    785          1.1  christos   *-aix)
    786      1.1.1.4  christos 	[ "$KERNEL_BITS" ] || KERNEL_BITS=`(getconf KERNEL_BITMODE) 2>/dev/null`
    787          1.1  christos 	KERNEL_BITS=${KERNEL_BITS:-32}
    788          1.1  christos 	OBJECT_MODE=${OBJECT_MODE:-32}
    789          1.1  christos 	if [ "$CC" = "gcc" ]; then
    790          1.1  christos 	    OUT="aix-gcc"
    791      1.1.1.3       spz           if [ $OBJECT_MODE -eq 64 ]; then
    792      1.1.1.3       spz             echo 'Your $OBJECT_MODE was found to be set to 64'
    793      1.1.1.3       spz             OUT="aix64-gcc"
    794      1.1.1.3       spz           fi
    795          1.1  christos 	elif [ $OBJECT_MODE -eq 64 ]; then
    796      1.1.1.9  christos 	    echo 'Your $OBJECT_MODE was found to be set to 64'
    797          1.1  christos 	    OUT="aix64-cc"
    798          1.1  christos 	else
    799          1.1  christos 	    OUT="aix-cc"
    800          1.1  christos 	    if [ $KERNEL_BITS -eq 64 ]; then
    801          1.1  christos 		echo "WARNING! If you wish to build 64-bit kit, then you have to"
    802      1.1.1.7  christos 		echo "         invoke '$THERE/Configure aix64-cc' *manually*."
    803      1.1.1.7  christos 		if [ "$DRYRUN" = "false" -a -t 1 ]; then
    804          1.1  christos 		    echo "         You have ~5 seconds to press Ctrl-C to abort."
    805      1.1.1.7  christos 		    (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
    806          1.1  christos 		fi
    807          1.1  christos 	    fi
    808          1.1  christos 	fi
    809          1.1  christos 	if (lsattr -E -O -l `lsdev -c processor|awk '{print$1;exit}'` | grep -i powerpc) >/dev/null 2>&1; then
    810          1.1  christos 	    :	# this applies even to Power3 and later, as they return PowerPC_POWER[345]
    811          1.1  christos 	else
    812          1.1  christos 	    options="$options no-asm"
    813          1.1  christos 	fi
    814          1.1  christos 	;;
    815          1.1  christos   # these are all covered by the catchall below
    816      1.1.1.7  christos   i[3456]86-*-cygwin) OUT="Cygwin-x86" ;;
    817      1.1.1.6       spz   *-*-cygwin) OUT="Cygwin-${MACHINE}" ;;
    818      1.1.1.4  christos   x86-*-android|i?86-*-android) OUT="android-x86" ;;
    819      1.1.1.7  christos   armv[7-9]*-*-android)
    820      1.1.1.8  christos       OUT="android-armeabi"
    821      1.1.1.8  christos       __CNF_CFLAGS="$__CNF_CFLAGS -march=armv7-a"
    822      1.1.1.8  christos       __CNF_CXXFLAGS="$__CNF_CXXFLAGS -march=armv7-a";;
    823      1.1.1.7  christos   arm*-*-android) OUT="android-armeabi" ;;
    824          1.1  christos   *) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
    825          1.1  christos esac
    826          1.1  christos 
    827      1.1.1.7  christos # NB: This atalla support has been superseded by the ENGINE support
    828          1.1  christos # That contains its own header and definitions anyway. Support can
    829          1.1  christos # be enabled or disabled on any supported platform without external
    830          1.1  christos # headers, eg. by adding the "hw-atalla" switch to ./config or
    831          1.1  christos # perl Configure
    832          1.1  christos #
    833          1.1  christos # See whether we can compile Atalla support
    834          1.1  christos #if [ -f /usr/include/atasi.h ]
    835          1.1  christos #then
    836      1.1.1.8  christos #  __CNF_CPPFLAGS="$__CNF_CPPFLAGS -DATALLA"
    837          1.1  christos #fi
    838          1.1  christos 
    839      1.1.1.7  christos if [ -n "$CONFIG_OPTIONS" ]; then
    840      1.1.1.7  christos   options="$options $CONFIG_OPTIONS"
    841      1.1.1.7  christos fi
    842      1.1.1.7  christos 
    843          1.1  christos # gcc < 2.8 does not support -march=ultrasparc
    844          1.1  christos if [ "$OUT" = solaris-sparcv9-gcc -a $GCCVER -lt 28 ]
    845          1.1  christos then
    846          1.1  christos   echo "WARNING! Falling down to 'solaris-sparcv8-gcc'."
    847          1.1  christos   echo "         Upgrade to gcc-2.8 or later."
    848          1.1  christos   sleep 5
    849          1.1  christos   OUT=solaris-sparcv8-gcc
    850          1.1  christos fi
    851          1.1  christos if [ "$OUT" = "linux-sparcv9" -a $GCCVER -lt 28 ]
    852          1.1  christos then
    853          1.1  christos   echo "WARNING! Falling down to 'linux-sparcv8'."
    854          1.1  christos   echo "         Upgrade to gcc-2.8 or later."
    855          1.1  christos   sleep 5
    856          1.1  christos   OUT=linux-sparcv8
    857          1.1  christos fi
    858          1.1  christos 
    859          1.1  christos case "$GUESSOS" in
    860          1.1  christos   i386-*) options="$options 386" ;;
    861          1.1  christos esac
    862          1.1  christos 
    863      1.1.1.8  christos for i in aes aria bf camellia cast des dh dsa ec hmac idea md2 md5 mdc2 rc2 rc4 rc5 ripemd rsa seed sha sm2 sm3 sm4
    864          1.1  christos do
    865      1.1.1.7  christos   if [ ! -d $THERE/crypto/$i ]
    866          1.1  christos   then
    867          1.1  christos     options="$options no-$i"
    868          1.1  christos   fi
    869          1.1  christos done
    870          1.1  christos 
    871          1.1  christos if [ -z "$OUT" ]; then
    872          1.1  christos   OUT="$CC"
    873          1.1  christos fi
    874          1.1  christos 
    875          1.1  christos if [ ".$PERL" = . ] ; then
    876          1.1  christos 	for i in . `echo $PATH | sed 's/:/ /g'`; do
    877          1.1  christos 		if [ -f "$i/perl5$EXE" ] ; then
    878          1.1  christos 			PERL="$i/perl5$EXE"
    879          1.1  christos 			break;
    880          1.1  christos 		fi;
    881          1.1  christos 	done
    882          1.1  christos fi
    883          1.1  christos 
    884          1.1  christos if [ ".$PERL" = . ] ; then
    885          1.1  christos 	for i in . `echo $PATH | sed 's/:/ /g'`; do
    886          1.1  christos 		if [ -f "$i/perl$EXE" ] ; then
    887          1.1  christos 			if "$i/perl$EXE" -e 'exit($]<5.0)'; then
    888          1.1  christos 				PERL="$i/perl$EXE"
    889          1.1  christos 				break;
    890          1.1  christos 			fi;
    891          1.1  christos 		fi;
    892          1.1  christos 	done
    893          1.1  christos fi
    894          1.1  christos 
    895          1.1  christos if [ ".$PERL" = . ] ; then
    896          1.1  christos 	echo "You need Perl 5."
    897          1.1  christos 	exit 1
    898          1.1  christos fi
    899          1.1  christos 
    900      1.1.1.9  christos # run Configure to check to see if we need to specify the
    901          1.1  christos # compiler for the platform ... in which case we add it on
    902          1.1  christos # the end ... otherwise we leave it off
    903          1.1  christos 
    904      1.1.1.7  christos $PERL $THERE/Configure LIST | grep "$OUT-$CC" > /dev/null
    905          1.1  christos if [ $? = "0" ]; then
    906          1.1  christos   OUT="$OUT-$CC"
    907          1.1  christos fi
    908          1.1  christos 
    909      1.1.1.7  christos OUT="$OUT"
    910          1.1  christos 
    911      1.1.1.7  christos $PERL $THERE/Configure LIST | grep "$OUT" > /dev/null
    912          1.1  christos if [ $? = "0" ]; then
    913      1.1.1.7  christos   if [ "$VERBOSE" = "true" ]; then
    914      1.1.1.8  christos     echo /usr/bin/env \
    915      1.1.1.8  christos 	 __CNF_CPPDEFINES="'$__CNF_CPPDEFINES'" \
    916      1.1.1.8  christos 	 __CNF_CPPINCLUDES="'$__CNF_CPPINCLUDES'" \
    917      1.1.1.8  christos 	 __CNF_CPPFLAGS="'$__CNF_CPPFLAGS'" \
    918      1.1.1.8  christos 	 __CNF_CFLAGS="'$__CNF_CFLAGS'" \
    919      1.1.1.8  christos 	 __CNF_CXXFLAGS="'$__CNF_CXXFLAGS'" \
    920      1.1.1.8  christos 	 __CNF_LDFLAGS="'$__CNF_LDFLAGS'" \
    921      1.1.1.8  christos 	 __CNF_LDLIBS="'$__CNF_LDLIBS'" \
    922      1.1.1.8  christos 	 $PERL $THERE/Configure $OUT $options
    923      1.1.1.9  christos   fi
    924      1.1.1.7  christos   if [ "$DRYRUN" = "false" ]; then
    925      1.1.1.8  christos     # eval to make sure quoted options, possibly with spaces inside,
    926      1.1.1.8  christos     # are treated right
    927      1.1.1.8  christos     eval /usr/bin/env \
    928      1.1.1.8  christos 	 __CNF_CPPDEFINES="'$__CNF_CPPDEFINES'" \
    929      1.1.1.8  christos 	 __CNF_CPPINCLUDES="'$__CNF_CPPINCLUDES'" \
    930      1.1.1.8  christos 	 __CNF_CPPFLAGS="'$__CNF_CPPFLAGS'" \
    931      1.1.1.8  christos 	 __CNF_CFLAGS="'$__CNF_CFLAGS'" \
    932      1.1.1.8  christos 	 __CNF_CXXFLAGS="'$__CNF_CXXFLAGS'" \
    933      1.1.1.8  christos 	 __CNF_LDFLAGS="'$__CNF_LDFLAGS'" \
    934      1.1.1.8  christos 	 __CNF_LDLIBS="'$__CNF_LDLIBS'" \
    935      1.1.1.8  christos 	 $PERL $THERE/Configure $OUT $options
    936          1.1  christos   fi
    937          1.1  christos else
    938          1.1  christos   echo "This system ($OUT) is not supported. See file INSTALL for details."
    939      1.1.1.8  christos   exit 1
    940      1.1.1.8  christos fi
    941      1.1.1.8  christos 
    942      1.1.1.8  christos if [ "$OUT" = "darwin64-x86_64-cc" ]; then
    943      1.1.1.8  christos     echo "WARNING! If you wish to build 32-bit libraries, then you have to"
    944      1.1.1.8  christos     echo "         invoke 'KERNEL_BITS=32 $THERE/config $options'."
    945          1.1  christos fi
    946          1.1  christos )
    947