Home | History | Annotate | Line # | Download | only in dist
config revision 1.1.1.2
      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  christos esac
    374      1.1  christos 
    375      1.1  christos #
    376      1.1  christos # Ugg. These are all we can determine by what we know about
    377      1.1  christos # the output of uname. Be more creative:
    378      1.1  christos #
    379      1.1  christos 
    380      1.1  christos # Do the Apollo stuff first. Here, we just simply assume
    381      1.1  christos # that the existance of the /usr/apollo directory is proof
    382      1.1  christos # enough
    383      1.1  christos if [ -d /usr/apollo ]; then
    384      1.1  christos     echo "whatever-apollo-whatever"
    385      1.1  christos     exit 0
    386      1.1  christos fi
    387      1.1  christos 
    388      1.1  christos # Now NeXT
    389      1.1  christos ISNEXT=`hostinfo 2>/dev/null`
    390      1.1  christos case "$ISNEXT" in
    391      1.1  christos     *'NeXT Mach 3.3'*)
    392      1.1  christos 	echo "whatever-next-nextstep3.3"; exit 0
    393      1.1  christos 	;;
    394      1.1  christos     *NeXT*)
    395      1.1  christos 	echo "whatever-next-nextstep"; exit 0
    396      1.1  christos 	;;
    397      1.1  christos esac
    398      1.1  christos 
    399      1.1  christos # At this point we gone through all the one's
    400      1.1  christos # we know of: Punt
    401      1.1  christos 
    402      1.1  christos echo "${MACHINE}-whatever-${SYSTEM}" 
    403      1.1  christos exit 0
    404      1.1  christos ) 2>/dev/null | (
    405      1.1  christos 
    406      1.1  christos # ---------------------------------------------------------------------------
    407      1.1  christos # this is where the translation occurs into SSLeay terms
    408      1.1  christos # ---------------------------------------------------------------------------
    409      1.1  christos 
    410      1.1  christos GCCVER=`(gcc -dumpversion) 2>/dev/null`
    411      1.1  christos if [ "$GCCVER" != "" ]; then
    412      1.1  christos   # then strip off whatever prefix egcs prepends the number with...
    413      1.1  christos   # Hopefully, this will work for any future prefixes as well.
    414      1.1  christos   GCCVER=`echo $GCCVER | LC_ALL=C sed 's/^[a-zA-Z]*\-//'`
    415      1.1  christos   # Since gcc 3.1 gcc --version behaviour has changed.  gcc -dumpversion
    416      1.1  christos   # does give us what we want though, so we use that.  We just just the
    417      1.1  christos   # major and minor version numbers.
    418      1.1  christos   # peak single digit before and after first dot, e.g. 2.95.1 gives 29
    419      1.1  christos   GCCVER=`echo $GCCVER | sed 's/\([0-9]\)\.\([0-9]\).*/\1\2/'`
    420      1.1  christos fi
    421      1.1  christos 
    422      1.1  christos # Only set CC if not supplied already
    423      1.1  christos if [ -z "$CC" ]; then
    424      1.1  christos # figure out if gcc is available and if so we use it otherwise
    425      1.1  christos # we fallback to whatever cc does on the system
    426      1.1  christos   if [ "$GCCVER" != "" ]; then
    427      1.1  christos     CC=gcc
    428      1.1  christos   else
    429      1.1  christos     CC=cc
    430      1.1  christos   fi
    431      1.1  christos fi
    432      1.1  christos GCCVER=${GCCVER:-0}
    433      1.1  christos if [ "$SYSTEM" = "HP-UX" ];then
    434      1.1  christos   # By default gcc is a ILP32 compiler (with long long == 64).
    435      1.1  christos   GCC_BITS="32"
    436      1.1  christos   if [ $GCCVER -ge 30 ]; then
    437      1.1  christos     # PA64 support only came in with gcc 3.0.x.
    438      1.1  christos     # We check if the preprocessor symbol __LP64__ is defined...
    439      1.1  christos     if echo "__LP64__" | gcc -v -E -x c - 2>/dev/null | grep "^__LP64__" 2>&1 > /dev/null; then
    440      1.1  christos       : # __LP64__ has slipped through, it therefore is not defined
    441      1.1  christos     else
    442      1.1  christos       GCC_BITS="64"
    443      1.1  christos     fi
    444      1.1  christos   fi
    445      1.1  christos fi
    446      1.1  christos if [ "$SYSTEM" = "SunOS" ]; then
    447      1.1  christos   if [ $GCCVER -ge 30 ]; then
    448      1.1  christos     # 64-bit ABI isn't officially supported in gcc 3.0, but it appears
    449      1.1  christos     # to be working, at the very least 'make test' passes...
    450      1.1  christos     if gcc -v -E -x c /dev/null 2>&1 | grep __arch64__ > /dev/null; then
    451      1.1  christos       GCC_ARCH="-m64"
    452      1.1  christos     else
    453      1.1  christos       GCC_ARCH="-m32"
    454      1.1  christos     fi
    455      1.1  christos   fi
    456      1.1  christos   # check for WorkShop C, expected output is "cc: blah-blah C x.x"
    457      1.1  christos   CCVER=`(cc -V 2>&1) 2>/dev/null | \
    458      1.1  christos   	egrep -e '^cc: .* C [0-9]\.[0-9]' | \
    459      1.1  christos 	sed 's/.* C \([0-9]\)\.\([0-9]\).*/\1\2/'`
    460      1.1  christos   CCVER=${CCVER:-0}
    461      1.1  christos   if [ $MACHINE != i86pc -a $CCVER -gt 40 ]; then
    462      1.1  christos     CC=cc	# overrides gcc!!!
    463      1.1  christos     if [ $CCVER -eq 50 ]; then
    464      1.1  christos       echo "WARNING! Detected WorkShop C 5.0. Do make sure you have"
    465      1.1  christos       echo "         patch #107357-01 or later applied."
    466      1.1  christos       sleep 5
    467      1.1  christos     fi
    468      1.1  christos   fi
    469      1.1  christos fi
    470      1.1  christos 
    471      1.1  christos if [ "${SYSTEM}-${MACHINE}" = "Linux-alpha" ]; then
    472      1.1  christos   # check for Compaq C, expected output is "blah-blah C Vx.x"
    473      1.1  christos   CCCVER=`(ccc -V 2>&1) 2>/dev/null | \
    474      1.1  christos 	egrep -e '.* C V[0-9]\.[0-9]' | \
    475      1.1  christos 	sed 's/.* C V\([0-9]\)\.\([0-9]\).*/\1\2/'`
    476      1.1  christos   CCCVER=${CCCVER:-0}
    477      1.1  christos   if [ $CCCVER -gt 60 ]; then
    478      1.1  christos     CC=ccc	# overrides gcc!!! well, ccc outperforms inoticeably
    479      1.1  christos 		# only on hash routines and des, otherwise gcc (2.95)
    480      1.1  christos 		# keeps along rather tight...
    481      1.1  christos   fi
    482      1.1  christos fi
    483      1.1  christos 
    484      1.1  christos if [ "${SYSTEM}" = "AIX" ]; then	# favor vendor cc over gcc
    485      1.1  christos     (cc) 2>&1 | grep -iv "not found" > /dev/null && CC=cc
    486      1.1  christos fi
    487      1.1  christos 
    488      1.1  christos CCVER=${CCVER:-0}
    489      1.1  christos 
    490      1.1  christos # read the output of the embedded GuessOS 
    491      1.1  christos read GUESSOS
    492      1.1  christos 
    493      1.1  christos echo Operating system: $GUESSOS
    494      1.1  christos 
    495      1.1  christos # now map the output into SSLeay terms ... really should hack into the
    496      1.1  christos # script above so we end up with values in vars but that would take
    497      1.1  christos # more time that I want to waste at the moment
    498      1.1  christos case "$GUESSOS" in
    499      1.1  christos   uClinux*64*)
    500      1.1  christos     OUT=uClinux-dist64
    501      1.1  christos 	;;
    502      1.1  christos   uClinux*)
    503      1.1  christos     OUT=uClinux-dist
    504      1.1  christos 	;;
    505      1.1  christos   mips2-sgi-irix)
    506      1.1  christos 	CPU=`(hinv -t cpu) 2>/dev/null | head -1 | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'`
    507      1.1  christos 	CPU=${CPU:-0}
    508      1.1  christos 	if [ $CPU -ge 4000 ]; then
    509      1.1  christos 		options="$options -mips2"
    510      1.1  christos 	fi
    511      1.1  christos 	OUT="irix-$CC"
    512      1.1  christos 	;;
    513      1.1  christos   mips3-sgi-irix)
    514      1.1  christos 	#CPU=`(hinv -t cpu) 2>/dev/null | head -1 | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'`
    515      1.1  christos 	#CPU=${CPU:-0}
    516      1.1  christos 	#if [ $CPU -ge 5000 ]; then
    517      1.1  christos 	#	options="$options -mips4"
    518      1.1  christos 	#else
    519      1.1  christos 	#	options="$options -mips3"
    520      1.1  christos 	#fi
    521      1.1  christos 	OUT="irix-mips3-$CC"
    522      1.1  christos 	;;
    523      1.1  christos   mips4-sgi-irix64)
    524      1.1  christos 	echo "WARNING! If you wish to build 64-bit library, then you have to"
    525      1.1  christos 	echo "         invoke './Configure irix64-mips4-$CC' *manually*."
    526      1.1  christos 	if [ "$TEST" = "false" -a -t 1 ]; then
    527      1.1  christos 	  echo "         You have about 5 seconds to press Ctrl-C to abort."
    528      1.1  christos 	  (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1
    529      1.1  christos 	fi
    530      1.1  christos         #CPU=`(hinv -t cpu) 2>/dev/null | head -1 | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'`
    531      1.1  christos         #CPU=${CPU:-0}
    532      1.1  christos         #if [ $CPU -ge 5000 ]; then
    533      1.1  christos         #        options="$options -mips4"
    534      1.1  christos         #else
    535      1.1  christos         #        options="$options -mips3"
    536      1.1  christos         #fi
    537      1.1  christos 	OUT="irix-mips3-$CC"
    538      1.1  christos 	;;
    539      1.1  christos   ppc-apple-rhapsody) OUT="rhapsody-ppc-cc" ;;
    540      1.1  christos   ppc-apple-darwin*)
    541      1.1  christos 	ISA64=`(sysctl -n hw.optional.64bitops) 2>/dev/null`
    542      1.1  christos 	if [ "$ISA64" = "1" ]; then
    543      1.1  christos 	    echo "WARNING! If you wish to build 64-bit library, then you have to"
    544      1.1  christos 	    echo "         invoke './Configure darwin64-ppc-cc' *manually*."
    545      1.1  christos 	    if [ "$TEST" = "false" -a -t 1 ]; then
    546      1.1  christos 	      echo "         You have about 5 seconds to press Ctrl-C to abort."
    547      1.1  christos 	      (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1
    548      1.1  christos 	    fi
    549      1.1  christos 	fi
    550      1.1  christos 	OUT="darwin-ppc-cc" ;;
    551      1.1  christos   i?86-apple-darwin*)
    552      1.1  christos 	ISA64=`(sysctl -n hw.optional.x86_64) 2>/dev/null`
    553      1.1  christos 	if [ "$ISA64" = "1" ]; then
    554      1.1  christos 	    echo "WARNING! If you wish to build 64-bit library, then you have to"
    555      1.1  christos 	    echo "         invoke './Configure darwin64-x86_64-cc' *manually*."
    556      1.1  christos 	    if [ "$TEST" = "false" -a -t 1 ]; then
    557      1.1  christos 	      echo "         You have about 5 seconds to press Ctrl-C to abort."
    558      1.1  christos 	      (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1
    559      1.1  christos 	    fi
    560      1.1  christos 	fi
    561      1.1  christos 	OUT="darwin-i386-cc" ;;
    562      1.1  christos   alpha-*-linux2)
    563      1.1  christos         ISA=`awk '/cpu model/{print$4;exit(0);}' /proc/cpuinfo`
    564      1.1  christos 	case ${ISA:-generic} in
    565      1.1  christos 	*[678])	OUT="linux-alpha+bwx-$CC" ;;
    566      1.1  christos 	*)	OUT="linux-alpha-$CC" ;;
    567      1.1  christos 	esac
    568      1.1  christos 	if [ "$CC" = "gcc" ]; then
    569      1.1  christos 	    case ${ISA:-generic} in
    570      1.1  christos 	    EV5|EV45)		options="$options -mcpu=ev5";;
    571      1.1  christos 	    EV56|PCA56)		options="$options -mcpu=ev56";;
    572      1.1  christos 	    *)			options="$options -mcpu=ev6";;
    573      1.1  christos 	    esac
    574      1.1  christos 	fi
    575      1.1  christos 	;;
    576      1.1  christos   ppc64-*-linux2)
    577      1.1  christos 	echo "WARNING! If you wish to build 64-bit library, then you have to"
    578      1.1  christos 	echo "         invoke './Configure linux-ppc64' *manually*."
    579      1.1  christos 	if [ "$TEST" = "false" -a -t 1 ]; then
    580      1.1  christos 	    echo "         You have about 5 seconds to press Ctrl-C to abort."
    581      1.1  christos 	    (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1
    582      1.1  christos 	fi
    583      1.1  christos 	OUT="linux-ppc"
    584      1.1  christos 	;;
    585      1.1  christos   ppc-*-linux2) OUT="linux-ppc" ;;
    586      1.1  christos   ia64-*-linux?) OUT="linux-ia64" ;;
    587      1.1  christos   sparc64-*-linux2)
    588      1.1  christos 	echo "WARNING! If you *know* that your GNU C supports 64-bit/V9 ABI"
    589      1.1  christos 	echo "         and wish to build 64-bit library, then you have to"
    590      1.1  christos 	echo "         invoke './Configure linux64-sparcv9' *manually*."
    591      1.1  christos 	if [ "$TEST" = "false" -a -t 1 ]; then
    592      1.1  christos 	  echo "          You have about 5 seconds to press Ctrl-C to abort."
    593      1.1  christos 	  (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1
    594      1.1  christos 	fi
    595      1.1  christos 	OUT="linux-sparcv9" ;;
    596      1.1  christos   sparc-*-linux2)
    597      1.1  christos 	KARCH=`awk '/^type/{print$3;exit(0);}' /proc/cpuinfo`
    598      1.1  christos 	case ${KARCH:-sun4} in
    599      1.1  christos 	sun4u*)	OUT="linux-sparcv9" ;;
    600      1.1  christos 	sun4m)	OUT="linux-sparcv8" ;;
    601      1.1  christos 	sun4d)	OUT="linux-sparcv8" ;;
    602      1.1  christos 	*)	OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
    603      1.1  christos 	esac ;;
    604      1.1  christos   parisc*-*-linux2)
    605      1.1  christos 	# 64-bit builds under parisc64 linux are not supported and
    606      1.1  christos 	# compiler is expected to generate 32-bit objects...
    607      1.1  christos 	CPUARCH=`awk '/cpu family/{print substr($5,1,3); exit(0);}' /proc/cpuinfo`
    608      1.1  christos 	CPUSCHEDULE=`awk '/^cpu.[ 	]*: PA/{print substr($3,3); exit(0);}' /proc/cpuinfo`
    609      1.1  christos 
    610      1.1  christos 	# ??TODO ??  Model transformations
    611      1.1  christos 	# 0. CPU Architecture for the 1.1 processor has letter suffixes. We strip that off
    612      1.1  christos 	#    assuming no further arch. identification will ever be used by GCC.
    613      1.1  christos 	# 1. I'm most concerned about whether is a 7300LC is closer to a 7100 versus a 7100LC.
    614      1.1  christos 	# 2. The variant 64-bit processors cause concern should GCC support explicit schedulers
    615      1.1  christos 	#    for these chips in the future.
    616      1.1  christos 	#         PA7300LC -> 7100LC (1.1)
    617      1.1  christos 	#         PA8200   -> 8000   (2.0)
    618      1.1  christos 	#         PA8500   -> 8000   (2.0)
    619      1.1  christos 	#         PA8600   -> 8000   (2.0)
    620      1.1  christos 
    621      1.1  christos 	CPUSCHEDULE=`echo $CPUSCHEDULE|sed -e 's/7300LC/7100LC/' -e 's/8.00/8000/'`
    622      1.1  christos 	# Finish Model transformations
    623      1.1  christos 
    624      1.1  christos 	options="$options -DB_ENDIAN -mschedule=$CPUSCHEDULE -march=$CPUARCH"
    625      1.1  christos 	OUT="linux-generic32" ;;
    626      1.1  christos   armv[1-3]*-*-linux2) OUT="linux-generic32" ;;
    627      1.1  christos   arm*-*-linux2) OUT="linux-armv4" ;;
    628      1.1  christos   sh*b-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
    629      1.1  christos   sh*-*-linux2)  OUT="linux-generic32"; options="$options -DL_ENDIAN" ;;
    630      1.1  christos   m68k*-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
    631      1.1  christos   s390-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
    632      1.1  christos   s390x-*-linux2) OUT="linux-s390x" ;;
    633      1.1  christos   x86_64-*-linux?) OUT="linux-x86_64" ;;
    634      1.1  christos   *86-*-linux2) OUT="linux-elf"
    635      1.1  christos 	if [ "$GCCVER" -gt 28 ]; then
    636      1.1  christos           if grep '^model.*Pentium' /proc/cpuinfo >/dev/null ; then
    637      1.1  christos 	    options="$options -march=pentium"
    638      1.1  christos           fi
    639      1.1  christos           if grep '^model.*Pentium Pro' /proc/cpuinfo >/dev/null ; then
    640      1.1  christos 	    options="$options -march=pentiumpro"
    641      1.1  christos           fi
    642      1.1  christos           if grep '^model.*K6' /proc/cpuinfo >/dev/null ; then
    643      1.1  christos 	    options="$options -march=k6"
    644      1.1  christos           fi
    645      1.1  christos         fi ;;
    646      1.1  christos   *-*-linux1) OUT="linux-aout" ;;
    647      1.1  christos   *-*-linux2) OUT="linux-generic32" ;;
    648      1.1  christos   sun4[uv]*-*-solaris2)
    649      1.1  christos 	OUT="solaris-sparcv9-$CC"
    650      1.1  christos 	ISA64=`(isalist) 2>/dev/null | grep sparcv9`
    651      1.1  christos 	if [ "$ISA64" != "" ]; 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  christos 		echo "         invoke './Configure solaris64-sparcv9-cc' *manually*."
    655      1.1  christos 		if [ "$TEST" = "false" -a -t 1 ]; then
    656      1.1  christos 		  echo "         You have about 5 seconds to press Ctrl-C to abort."
    657      1.1  christos 		  (trap "stty `stty -g`" 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  christos 		echo "         invoke './Configure solaris-sparcv9-gcc' *manually*."
    667      1.1  christos 		if [ "$TEST" = "false" -a -t 1 ]; then
    668      1.1  christos 		  echo "         You have about 5 seconds to press Ctrl-C to abort."
    669      1.1  christos 		  (trap "stty `stty -g`" 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  christos 		echo "        invoke './Configure solaris64-sparcv9-gcc' *manually*."
    675      1.1  christos 		if [ "$TEST" = "false" -a -t 1 ]; then
    676      1.1  christos 		  echo "         You have about 5 seconds to press Ctrl-C to abort."
    677      1.1  christos 		  (trap "stty `stty -g`" 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 	;;
    682      1.1  christos   sun4m-*-solaris2)	OUT="solaris-sparcv8-$CC" ;;
    683      1.1  christos   sun4d-*-solaris2)	OUT="solaris-sparcv8-$CC" ;;
    684      1.1  christos   sun4*-*-solaris2)	OUT="solaris-sparcv7-$CC" ;;
    685      1.1  christos   *86*-*-solaris2)
    686      1.1  christos 	ISA64=`(isalist) 2>/dev/null | grep amd64`
    687      1.1  christos 	if [ "$ISA64" != "" ]; then
    688      1.1  christos 	    OUT="solaris64-x86_64-$CC"
    689      1.1  christos 	else
    690      1.1  christos 	    OUT="solaris-x86-$CC"
    691      1.1  christos 	    if [ `uname -r | sed -e 's/5\.//'` -lt 10 ]; then
    692      1.1  christos 		options="$options no-sse2"
    693      1.1  christos 	    fi
    694      1.1  christos 	fi
    695      1.1  christos 	;;
    696      1.1  christos   *-*-sunos4)		OUT="sunos-$CC" ;;
    697      1.1  christos 
    698      1.1  christos   *86*-*-bsdi4)		OUT="BSD-x86-elf"; options="$options no-sse2 -ldl" ;;
    699      1.1  christos   alpha*-*-*bsd*)	OUT="BSD-generic64"; options="$options -DL_ENDIAN" ;;
    700      1.1  christos   powerpc64-*-*bsd*)	OUT="BSD-generic64"; options="$options -DB_ENDIAN" ;;
    701      1.1  christos   sparc64-*-*bsd*)	OUT="BSD-sparc64" ;;
    702      1.1  christos   ia64-*-*bsd*)		OUT="BSD-ia64" ;;
    703      1.1  christos   amd64-*-*bsd*)	OUT="BSD-x86_64" ;;
    704      1.1  christos   *86*-*-*bsd*)		# mimic ld behaviour when it's looking for libc...
    705      1.1  christos 			if [ -L /usr/lib/libc.so ]; then	# [Free|Net]BSD
    706      1.1  christos 			    libc=/usr/lib/libc.so
    707      1.1  christos 			else					# OpenBSD
    708      1.1  christos 			    # ld searches for highest libc.so.* and so do we
    709      1.1  christos 			    libc=`(ls /usr/lib/libc.so.* | tail -1) 2>/dev/null`
    710      1.1  christos 			fi
    711      1.1  christos 			case "`(file -L $libc) 2>/dev/null`" in
    712      1.1  christos 			*ELF*)	OUT="BSD-x86-elf" ;;
    713      1.1  christos 			*)	OUT="BSD-x86"; options="$options no-sse2" ;;
    714      1.1  christos 			esac ;;
    715      1.1  christos   *-*-*bsd*)		OUT="BSD-generic32" ;;
    716      1.1  christos 
    717      1.1  christos   *-*-osf)		OUT="osf1-alpha-cc" ;;
    718      1.1  christos   *-*-tru64)		OUT="tru64-alpha-cc" ;;
    719      1.1  christos   *-*-[Uu]nix[Ww]are7)
    720      1.1  christos 	if [ "$CC" = "gcc" ]; then
    721      1.1  christos 	  OUT="unixware-7-gcc" ; options="$options no-sse2"
    722      1.1  christos 	else    
    723      1.1  christos 	  OUT="unixware-7" ; options="$options no-sse2 -D__i386__"
    724      1.1  christos 	fi
    725      1.1  christos 	;;
    726      1.1  christos   *-*-[Uu]nix[Ww]are20*) OUT="unixware-2.0"; options="$options no-sse2 no-sha512" ;;
    727      1.1  christos   *-*-[Uu]nix[Ww]are21*) OUT="unixware-2.1"; options="$options no-sse2 no-sha512" ;;
    728      1.1  christos   *-*-vos)
    729      1.1  christos 	options="$options no-threads no-shared no-asm no-dso"
    730      1.1  christos 	EXE=".pm"
    731      1.1  christos 	OUT="vos-$CC" ;;
    732      1.1  christos   BS2000-siemens-sysv4) OUT="BS2000-OSD" ;;
    733      1.1  christos   RM*-siemens-sysv4) OUT="ReliantUNIX" ;;
    734      1.1  christos   *-siemens-sysv4) OUT="SINIX" ;;
    735      1.1  christos   *-hpux1*)
    736      1.1  christos 	if [ $CC = "gcc" -a $GCC_BITS = "64" ]; then
    737      1.1  christos 	    OUT="hpux64-parisc2-gcc"
    738      1.1  christos 	fi
    739      1.1  christos 	KERNEL_BITS=`(getconf KERNEL_BITS) 2>/dev/null`
    740      1.1  christos 	KERNEL_BITS=${KERNEL_BITS:-32}
    741      1.1  christos 	CPU_VERSION=`(getconf CPU_VERSION) 2>/dev/null`
    742      1.1  christos 	CPU_VERSION=${CPU_VERSION:-0}
    743      1.1  christos 	# See <sys/unistd.h> for further info on CPU_VERSION.
    744      1.1  christos 	if   [ $CPU_VERSION -ge 768 ]; then	# IA-64 CPU
    745      1.1  christos 	     echo "WARNING! 64-bit ABI is the default configured ABI on HP-UXi."
    746      1.1  christos 	     echo "         If you wish to build 32-bit library, the you have to"
    747      1.1  christos 	     echo "         invoke './Configure hpux-ia64-cc' *manually*."
    748      1.1  christos 	     if [ "$TEST" = "false" -a -t 1 ]; then
    749      1.1  christos 		echo "         You have about 5 seconds to press Ctrl-C to abort."
    750      1.1  christos 		(trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1
    751      1.1  christos 	     fi
    752      1.1  christos 	     OUT="hpux64-ia64-cc"
    753      1.1  christos 	elif [ $CPU_VERSION -ge 532 ]; then	# PA-RISC 2.x CPU
    754      1.1  christos 	     OUT=${OUT:-"hpux-parisc2-${CC}"}
    755      1.1  christos 	     if [ $KERNEL_BITS -eq 64 -a "$CC" = "cc" ]; then
    756      1.1  christos 		echo "WARNING! If you wish to build 64-bit library then you have to"
    757      1.1  christos 		echo "         invoke './Configure hpux64-parisc2-cc' *manually*."
    758      1.1  christos 		if [ "$TEST" = "false" -a -t 1 ]; then
    759      1.1  christos 		  echo "         You have about 5 seconds to press Ctrl-C to abort."
    760      1.1  christos 		  (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1
    761      1.1  christos 		fi
    762      1.1  christos 	     fi
    763      1.1  christos 	elif [ $CPU_VERSION -ge 528 ]; then	# PA-RISC 1.1+ CPU
    764      1.1  christos 	     OUT="hpux-parisc-${CC}"
    765      1.1  christos 	elif [ $CPU_VERSION -ge 523 ]; then	# PA-RISC 1.0 CPU
    766      1.1  christos 	     OUT="hpux-parisc-${CC}"
    767      1.1  christos 	else					# Motorola(?) CPU
    768      1.1  christos 	     OUT="hpux-$CC"
    769      1.1  christos 	fi
    770      1.1  christos 	options="$options -D_REENTRANT" ;;
    771      1.1  christos   *-hpux)	OUT="hpux-parisc-$CC" ;;
    772      1.1  christos   *-aix)
    773      1.1  christos 	KERNEL_BITS=`(getconf KERNEL_BITMODE) 2>/dev/null`
    774      1.1  christos 	KERNEL_BITS=${KERNEL_BITS:-32}
    775      1.1  christos 	OBJECT_MODE=${OBJECT_MODE:-32}
    776      1.1  christos 	if [ "$CC" = "gcc" ]; then
    777      1.1  christos 	    OUT="aix-gcc"
    778      1.1  christos 	elif [ $OBJECT_MODE -eq 64 ]; then
    779      1.1  christos 	    echo 'Your $OBJECT_MODE was found to be set to 64' 
    780      1.1  christos 	    OUT="aix64-cc"
    781      1.1  christos 	else
    782      1.1  christos 	    OUT="aix-cc"
    783      1.1  christos 	    if [ $KERNEL_BITS -eq 64 ]; then
    784      1.1  christos 		echo "WARNING! If you wish to build 64-bit kit, then you have to"
    785      1.1  christos 		echo "         invoke './Configure aix64-cc' *manually*."
    786      1.1  christos 		if [ "$TEST" = "false" -a -t 1 ]; then
    787      1.1  christos 		    echo "         You have ~5 seconds to press Ctrl-C to abort."
    788      1.1  christos 		    (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1
    789      1.1  christos 		fi
    790      1.1  christos 	    fi
    791      1.1  christos 	fi
    792      1.1  christos 	if (lsattr -E -O -l `lsdev -c processor|awk '{print$1;exit}'` | grep -i powerpc) >/dev/null 2>&1; then
    793      1.1  christos 	    :	# this applies even to Power3 and later, as they return PowerPC_POWER[345]
    794      1.1  christos 	else
    795      1.1  christos 	    options="$options no-asm"
    796      1.1  christos 	fi
    797      1.1  christos 	;;
    798      1.1  christos   # these are all covered by the catchall below
    799      1.1  christos   # *-dgux) OUT="dgux" ;;
    800      1.1  christos   mips-sony-newsos4) OUT="newsos4-gcc" ;;
    801      1.1  christos   *-*-cygwin_pre1.3) OUT="Cygwin-pre1.3" ;;
    802      1.1  christos   *-*-cygwin) OUT="Cygwin" ;;
    803      1.1  christos   t3e-cray-unicosmk) OUT="cray-t3e" ;;
    804      1.1  christos   j90-cray-unicos) OUT="cray-j90" ;;
    805      1.1  christos   nsr-tandem-nsk) OUT="tandem-c89" ;;
    806      1.1  christos   beos-*) OUT="$GUESSOS" ;;
    807      1.1  christos   x86pc-*-qnx6) OUT="QNX6-i386" ;;
    808      1.1  christos   *-*-qnx6) OUT="QNX6" ;;
    809      1.1  christos   *) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
    810      1.1  christos esac
    811      1.1  christos 
    812      1.1  christos # NB: This atalla support has been superceded by the ENGINE support
    813      1.1  christos # That contains its own header and definitions anyway. Support can
    814      1.1  christos # be enabled or disabled on any supported platform without external
    815      1.1  christos # headers, eg. by adding the "hw-atalla" switch to ./config or
    816      1.1  christos # perl Configure
    817      1.1  christos #
    818      1.1  christos # See whether we can compile Atalla support
    819      1.1  christos #if [ -f /usr/include/atasi.h ]
    820      1.1  christos #then
    821      1.1  christos #  options="$options -DATALLA"
    822      1.1  christos #fi
    823      1.1  christos 
    824      1.1  christos # gcc < 2.8 does not support -march=ultrasparc
    825      1.1  christos if [ "$OUT" = solaris-sparcv9-gcc -a $GCCVER -lt 28 ]
    826      1.1  christos then
    827      1.1  christos   echo "WARNING! Falling down to 'solaris-sparcv8-gcc'."
    828      1.1  christos   echo "         Upgrade to gcc-2.8 or later."
    829      1.1  christos   sleep 5
    830      1.1  christos   OUT=solaris-sparcv8-gcc
    831      1.1  christos fi
    832      1.1  christos if [ "$OUT" = "linux-sparcv9" -a $GCCVER -lt 28 ]
    833      1.1  christos then
    834      1.1  christos   echo "WARNING! Falling down to 'linux-sparcv8'."
    835      1.1  christos   echo "         Upgrade to gcc-2.8 or later."
    836      1.1  christos   sleep 5
    837      1.1  christos   OUT=linux-sparcv8
    838      1.1  christos fi
    839      1.1  christos 
    840      1.1  christos case "$GUESSOS" in
    841      1.1  christos   i386-*) options="$options 386" ;;
    842      1.1  christos esac
    843      1.1  christos 
    844      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
    845      1.1  christos do
    846      1.1  christos   if [ ! -d crypto/$i ]
    847      1.1  christos   then
    848      1.1  christos     options="$options no-$i"
    849      1.1  christos   fi
    850      1.1  christos done
    851      1.1  christos 
    852      1.1  christos # Discover Kerberos 5 (since it's still a prototype, we don't
    853      1.1  christos # do any guesses yet, that's why this section is commented away.
    854      1.1  christos #if [ -d /usr/kerberos ]; then
    855      1.1  christos #    krb5_dir=/usr/kerberos
    856      1.1  christos #    if [ \( -f $krb5_dir/lib/libgssapi_krb5.a -o -f $krb5_dir/lib/libgssapi_krb5.so* \)\
    857      1.1  christos #	-a \( -f $krb5_dir/lib/libkrb5.a -o -f $krb5_dir/lib/libkrb5.so* \)\
    858      1.1  christos #	-a \( -f $krb5_dir/lib/libcom_err.a -o -f $krb5_dir/lib/libcom_err.so* \)\
    859      1.1  christos #	-a \( -f $krb5_dir/lib/libk5crypto.a -o -f $krb5_dir/lib/libk5crypto.so* \)\
    860      1.1  christos #	-a \( -f $krb5_dir/include/krb5.h \) ]; then
    861      1.1  christos #	options="$options --with-krb5-flavor=MIT"
    862      1.1  christos #    fi
    863      1.1  christos #elif [ -d /usr/heimdal ]; then
    864      1.1  christos #    krb5_dir=/usr/heimdal
    865      1.1  christos #    if [ \( -f $krb5_dir/lib/libgssapi.a -o -f $krb5_dir/lib/libgssapi.so* \)\
    866      1.1  christos #	-a \( -f $krb5_dir/lib/libkrb5.a -o -f $krb5_dir/lib/libkrb5.so* \)\
    867      1.1  christos #	-a \( -f $krb5_dir/lib/libcom_err.a -o -f $krb5_dir/lib/libcom_err.so* \)\
    868      1.1  christos #	-a \( -f $krb5_dir/include/krb5.h \) ]; then
    869      1.1  christos #	options="$options --with-krb5-flavor=Heimdal"
    870      1.1  christos #    fi
    871      1.1  christos #fi
    872      1.1  christos 
    873      1.1  christos if [ -z "$OUT" ]; then
    874      1.1  christos   OUT="$CC"
    875      1.1  christos fi
    876      1.1  christos 
    877      1.1  christos if [ ".$PERL" = . ] ; then
    878      1.1  christos 	for i in . `echo $PATH | sed 's/:/ /g'`; do
    879      1.1  christos 		if [ -f "$i/perl5$EXE" ] ; then
    880      1.1  christos 			PERL="$i/perl5$EXE"
    881      1.1  christos 			break;
    882      1.1  christos 		fi;
    883      1.1  christos 	done
    884      1.1  christos fi
    885      1.1  christos 
    886      1.1  christos if [ ".$PERL" = . ] ; then
    887      1.1  christos 	for i in . `echo $PATH | sed 's/:/ /g'`; do
    888      1.1  christos 		if [ -f "$i/perl$EXE" ] ; then
    889      1.1  christos 			if "$i/perl$EXE" -e 'exit($]<5.0)'; then
    890      1.1  christos 				PERL="$i/perl$EXE"
    891      1.1  christos 				break;
    892      1.1  christos 			fi;
    893      1.1  christos 		fi;
    894      1.1  christos 	done
    895      1.1  christos fi
    896      1.1  christos 
    897      1.1  christos if [ ".$PERL" = . ] ; then
    898      1.1  christos 	echo "You need Perl 5."
    899      1.1  christos 	exit 1
    900      1.1  christos fi
    901      1.1  christos 
    902      1.1  christos # run Configure to check to see if we need to specify the 
    903      1.1  christos # compiler for the platform ... in which case we add it on
    904      1.1  christos # the end ... otherwise we leave it off
    905      1.1  christos 
    906      1.1  christos $PERL ./Configure LIST | grep "$OUT-$CC" > /dev/null
    907      1.1  christos if [ $? = "0" ]; then
    908      1.1  christos   OUT="$OUT-$CC"
    909      1.1  christos fi
    910      1.1  christos 
    911      1.1  christos OUT="$PREFIX$OUT"
    912      1.1  christos 
    913      1.1  christos $PERL ./Configure LIST | grep "$OUT" > /dev/null
    914      1.1  christos if [ $? = "0" ]; then
    915      1.1  christos   echo Configuring for $OUT
    916      1.1  christos 
    917      1.1  christos   if [ "$TEST" = "true" ]; then
    918      1.1  christos     echo $PERL ./Configure $OUT $options
    919      1.1  christos   else
    920      1.1  christos     $PERL ./Configure $OUT $options
    921      1.1  christos   fi
    922      1.1  christos else
    923      1.1  christos   echo "This system ($OUT) is not supported. See file INSTALL for details."
    924      1.1  christos fi
    925      1.1  christos )
    926