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