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