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