config revision 167612
155714Skris#!/bin/sh 255714Skris# 355714Skris# OpenSSL config: determine the operating system and run ./Configure 455714Skris# 555714Skris# "config -h" for usage information. 655714Skris# 755714Skris# this is a merge of minarch and GuessOS from the Apache Group. 855714Skris# Originally written by Tim Hudson <tjh@cryptsoft.com>. 955714Skris 1055714Skris# Original Apache Group comments on GuessOS 1155714Skris 1255714Skris# Simple OS/Platform guesser. Similar to config.guess but 1355714Skris# much, much smaller. Since it was developed for use with 1455714Skris# Apache, it follows under Apache's regular licensing 1555714Skris# with one specific addition: Any changes or additions 1655714Skris# to this script should be Emailed to the Apache 1755714Skris# group (apache@apache.org) in general and to 1855714Skris# Jim Jagielski (jim@jaguNET.com) in specific. 1955714Skris# 2055714Skris# Be as similar to the output of config.guess/config.sub 2155714Skris# as possible. 2255714Skris 23109998SmarkmPREFIX="" 24109998SmarkmSUFFIX="" 25109998SmarkmTEST="false" 26142425SnectarEXE="" 27109998Smarkm 28109998Smarkm# pick up any command line args to config 29109998Smarkmfor i 30109998Smarkmdo 31109998Smarkmcase "$i" in 32109998Smarkm-d*) PREFIX="debug-";; 33109998Smarkm-t*) TEST="true";; 34109998Smarkm-h*) TEST="true"; cat <<EOF 35109998SmarkmUsage: config [options] 36109998Smarkm -d Add a debug- prefix to machine choice. 37109998Smarkm -t Test mode, do not run the Configure perl script. 38109998Smarkm -h This help. 39109998Smarkm 40109998SmarkmAny other text will be passed to the Configure perl script. 41109998SmarkmSee INSTALL for instructions. 42109998Smarkm 43109998SmarkmEOF 44109998Smarkm;; 45109998Smarkm*) options=$options" $i" ;; 46109998Smarkmesac 47109998Smarkmdone 48109998Smarkm 4955714Skris# First get uname entries that we use below 5055714Skris 5155714SkrisMACHINE=`(uname -m) 2>/dev/null` || MACHINE="unknown" 5255714SkrisRELEASE=`(uname -r) 2>/dev/null` || RELEASE="unknown" 5355714SkrisSYSTEM=`(uname -s) 2>/dev/null` || SYSTEM="unknown" 5455714SkrisVERSION=`(uname -v) 2>/dev/null` || VERSION="unknown" 5555714Skris 5659191Skris 5755714Skris# Now test for ISC and SCO, since it is has a braindamaged uname. 5855714Skris# 5955714Skris# We need to work around FreeBSD 1.1.5.1 6055714Skris( 6155714SkrisXREL=`uname -X 2>/dev/null | grep "^Release" | awk '{print $3}'` 6255714Skrisif [ "x$XREL" != "x" ]; then 6355714Skris if [ -f /etc/kconfig ]; then 6455714Skris case "$XREL" in 6555714Skris 4.0|4.1) 6655714Skris echo "${MACHINE}-whatever-isc4"; exit 0 6755714Skris ;; 6855714Skris esac 6955714Skris else 7055714Skris case "$XREL" in 7155714Skris 3.2v4.2) 7255714Skris echo "whatever-whatever-sco3"; exit 0 7355714Skris ;; 7455714Skris 3.2v5.0*) 7555714Skris echo "whatever-whatever-sco5"; exit 0 7655714Skris ;; 7755714Skris 4.2MP) 78111147Snectar case "x${VERSION}" in 79111147Snectar x2.0*) echo "whatever-whatever-unixware20"; exit 0 ;; 80111147Snectar x2.1*) echo "whatever-whatever-unixware21"; exit 0 ;; 81111147Snectar x2*) echo "whatever-whatever-unixware2"; exit 0 ;; 82111147Snectar esac 8355714Skris ;; 8455714Skris 4.2) 85160814Ssimon echo "whatever-whatever-unixware1"; exit 0 8655714Skris ;; 87160814Ssimon 5*) 88111147Snectar case "x${VERSION}" in 89111147Snectar # We hardcode i586 in place of ${MACHINE} for the 90111147Snectar # following reason. The catch is that even though Pentium 91111147Snectar # is minimum requirement for platforms in question, 92111147Snectar # ${MACHINE} gets always assigned to i386. Now, problem 93111147Snectar # with i386 is that it makes ./config pass 386 to 94111147Snectar # ./Configure, which in turn makes make generate 95111147Snectar # inefficient SHA-1 (for this moment) code. 96160814Ssimon x[678]*) echo "i586-sco-unixware7"; exit 0 ;; 97111147Snectar esac 9859191Skris ;; 9955714Skris esac 10055714Skris fi 10155714Skrisfi 10255714Skris# Now we simply scan though... In most cases, the SYSTEM info is enough 10355714Skris# 10455714Skriscase "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in 10568651Skris MPE/iX:*) 10668651Skris MACHINE=`echo "$MACHINE" | sed -e 's/-/_/g'` 10768651Skris echo "parisc-hp-MPE/iX"; exit 0 10868651Skris ;; 10955714Skris A/UX:*) 11055714Skris echo "m68k-apple-aux3"; exit 0 11155714Skris ;; 11255714Skris 113160814Ssimon AIX:[3-9]:4:*) 114160814Ssimon echo "${MACHINE}-ibm-aix"; exit 0 11576866Skris ;; 11676866Skris 117160814Ssimon AIX:*:[5-9]:*) 118160814Ssimon echo "${MACHINE}-ibm-aix"; exit 0 11976866Skris ;; 12076866Skris 12155714Skris AIX:*) 122160814Ssimon echo "${MACHINE}-ibm-aix3"; exit 0 12355714Skris ;; 12455714Skris 12555714Skris dgux:*) 12655714Skris echo "${MACHINE}-dg-dgux"; exit 0 12755714Skris ;; 12855714Skris 12955714Skris HI-UX:*) 13055714Skris echo "${MACHINE}-hi-hiux"; exit 0 13155714Skris ;; 13255714Skris 13355714Skris HP-UX:*) 13455714Skris HPUXVER=`echo ${RELEASE}|sed -e 's/[^.]*.[0B]*//'` 13555714Skris case "$HPUXVER" in 136109998Smarkm 1[0-9].*) # HPUX 10 and 11 targets are unified 137127128Snectar echo "${MACHINE}-hp-hpux1x"; exit 0 13855714Skris ;; 13955714Skris *) 14055714Skris echo "${MACHINE}-hp-hpux"; exit 0 14155714Skris ;; 14255714Skris esac 14355714Skris ;; 14455714Skris 14555714Skris IRIX:5.*) 14655714Skris echo "mips2-sgi-irix"; exit 0 14755714Skris ;; 14855714Skris 14955714Skris IRIX:6.*) 15055714Skris echo "mips3-sgi-irix"; exit 0 15155714Skris ;; 15255714Skris 15355714Skris IRIX64:*) 15455714Skris echo "mips4-sgi-irix64"; exit 0 15555714Skris ;; 15655714Skris 15755714Skris Linux:[2-9].*) 15855714Skris echo "${MACHINE}-whatever-linux2"; exit 0 15955714Skris ;; 16055714Skris 16155714Skris Linux:1.*) 16255714Skris echo "${MACHINE}-whatever-linux1"; exit 0 16355714Skris ;; 16455714Skris 165109998Smarkm GNU*) 166109998Smarkm echo "hurd-x86"; exit 0; 167109998Smarkm ;; 168109998Smarkm 16955714Skris LynxOS:*) 17055714Skris echo "${MACHINE}-lynx-lynxos"; exit 0 17155714Skris ;; 17255714Skris 17355714Skris BSD/OS:4.*) # BSD/OS always says 386 17455714Skris echo "i486-whatever-bsdi4"; exit 0 17555714Skris ;; 17655714Skris 17755714Skris BSD/386:*:*:*486*|BSD/OS:*:*:*:*486*) 17855714Skris case `/sbin/sysctl -n hw.model` in 17955714Skris Pentium*) 18055714Skris echo "i586-whatever-bsdi"; exit 0 18155714Skris ;; 18255714Skris *) 18355714Skris echo "i386-whatever-bsdi"; exit 0 18455714Skris ;; 18555714Skris esac; 18655714Skris ;; 18755714Skris 18855714Skris BSD/386:*|BSD/OS:*) 18955714Skris echo "${MACHINE}-whatever-bsdi"; exit 0 19055714Skris ;; 19155714Skris 192111147Snectar FreeBSD:*:*:*386*) 19355714Skris VERS=`echo ${RELEASE} | sed -e 's/[-(].*//'` 19455714Skris MACH=`sysctl -n hw.model` 19555714Skris ARCH='whatever' 19655714Skris case ${MACH} in 19755714Skris *386* ) MACH="i386" ;; 19855714Skris *486* ) MACH="i486" ;; 19955714Skris Pentium\ II*) MACH="i686" ;; 20055714Skris Pentium* ) MACH="i586" ;; 20155714Skris * ) MACH="$MACHINE" ;; 20255714Skris esac 20355714Skris case ${MACH} in 20455714Skris i[0-9]86 ) ARCH="pc" ;; 20555714Skris esac 20655714Skris echo "${MACH}-${ARCH}-freebsd${VERS}"; exit 0 20755714Skris ;; 20855714Skris 209111147Snectar FreeBSD:*) 210111147Snectar echo "${MACHINE}-whatever-freebsd"; exit 0 211111147Snectar ;; 212111147Snectar 21355714Skris NetBSD:*:*:*386*) 21472613Skris echo "`(/usr/sbin/sysctl -n hw.model || /sbin/sysctl -n hw.model) | sed 's,.*\(.\)86-class.*,i\186,'`-whatever-netbsd"; exit 0 21555714Skris ;; 21655714Skris 21755714Skris NetBSD:*) 21855714Skris echo "${MACHINE}-whatever-netbsd"; exit 0 21955714Skris ;; 22055714Skris 22155714Skris OpenBSD:*) 22255714Skris echo "${MACHINE}-whatever-openbsd"; exit 0 22355714Skris ;; 22455714Skris 22589837Skris OpenUNIX:*) 22689837Skris echo "${MACHINE}-unknown-OpenUNIX${VERSION}"; exit 0 22789837Skris ;; 22889837Skris 22955714Skris OSF1:*:*:*alpha*) 23089837Skris OSFMAJOR=`echo ${RELEASE}| sed -e 's/^V\([0-9]*\)\..*$/\1/'` 23189837Skris case "$OSFMAJOR" in 23289837Skris 4|5) 23389837Skris echo "${MACHINE}-dec-tru64"; exit 0 23489837Skris ;; 23589837Skris 1|2|3) 23689837Skris echo "${MACHINE}-dec-osf"; exit 0 23789837Skris ;; 23889837Skris *) 23989837Skris echo "${MACHINE}-dec-osf"; exit 0 24089837Skris ;; 24189837Skris esac 24255714Skris ;; 24355714Skris 24455714Skris QNX:*) 24589837Skris case "$RELEASE" in 24668651Skris 4*) 24768651Skris echo "${MACHINE}-whatever-qnx4" 24855714Skris ;; 24989837Skris 6*) 25089837Skris echo "${MACHINE}-whatever-qnx6" 25189837Skris ;; 25255714Skris *) 25368651Skris echo "${MACHINE}-whatever-qnx" 25455714Skris ;; 25555714Skris esac 25655714Skris exit 0 25755714Skris ;; 25855714Skris 25955714Skris Paragon*:*:*:*) 26055714Skris echo "i860-intel-osf1"; exit 0 26155714Skris ;; 26255714Skris 26359191Skris Rhapsody:*) 26459191Skris echo "ppc-apple-rhapsody"; exit 0 26559191Skris ;; 26659191Skris 26789837Skris Darwin:*) 268109998Smarkm case "$MACHINE" in 269109998Smarkm Power*) 270109998Smarkm echo "ppc-apple-darwin${VERSION}" 271109998Smarkm ;; 272109998Smarkm *) 273109998Smarkm echo "i386-apple-darwin${VERSION}" 274109998Smarkm ;; 275109998Smarkm esac 276109998Smarkm exit 0 27789837Skris ;; 27889837Skris 27955714Skris SunOS:5.*) 28068651Skris echo "${MACHINE}-whatever-solaris2"; exit 0 28155714Skris ;; 28255714Skris 28355714Skris SunOS:*) 28455714Skris echo "${MACHINE}-sun-sunos4"; exit 0 28555714Skris ;; 28655714Skris 28755714Skris UNIX_System_V:4.*:*) 28855714Skris echo "${MACHINE}-whatever-sysv4"; exit 0 28955714Skris ;; 29055714Skris 291142425Snectar VOS:*:*:i786) 292142425Snectar echo "i386-stratus-vos"; exit 0 293142425Snectar ;; 294142425Snectar 295142425Snectar VOS:*:*:*) 296142425Snectar echo "hppa1.1-stratus-vos"; exit 0 297142425Snectar ;; 298142425Snectar 29955714Skris *:4*:R4*:m88k) 30055714Skris echo "${MACHINE}-whatever-sysv4"; exit 0 30155714Skris ;; 30255714Skris 30355714Skris DYNIX/ptx:4*:*) 30455714Skris echo "${MACHINE}-whatever-sysv4"; exit 0 30555714Skris ;; 30655714Skris 30755714Skris *:4.0:3.0:3[34]?? | *:4.0:3.0:3[34]??,*) 30855714Skris echo "i486-ncr-sysv4"; exit 0 30955714Skris ;; 31055714Skris 31155714Skris ULTRIX:*) 31255714Skris echo "${MACHINE}-unknown-ultrix"; exit 0 31355714Skris ;; 31455714Skris 31555714Skris SINIX*|ReliantUNIX*) 31655714Skris echo "${MACHINE}-siemens-sysv4"; exit 0 31755714Skris ;; 31855714Skris 31955714Skris POSIX-BC*) 32055714Skris echo "${MACHINE}-siemens-sysv4"; exit 0 # Here, $MACHINE == "BS2000" 32155714Skris ;; 32255714Skris 32355714Skris machten:*) 32455714Skris echo "${MACHINE}-tenon-${SYSTEM}"; exit 0; 32555714Skris ;; 32655714Skris 32755714Skris library:*) 32855714Skris echo "${MACHINE}-ncr-sysv4"; exit 0 32955714Skris ;; 33055714Skris 33155714Skris ConvexOS:*:11.0:*) 33255714Skris echo "${MACHINE}-v11-${SYSTEM}"; exit 0; 33355714Skris ;; 33455714Skris 33568651Skris NEWS-OS:4.*) 33668651Skris echo "mips-sony-newsos4"; exit 0; 33768651Skris ;; 33868651Skris 339160814Ssimon MINGW*) 340160814Ssimon echo "${MACHINE}-whatever-mingw"; exit 0; 341160814Ssimon ;; 34289837Skris CYGWIN*) 343100928Snectar case "$RELEASE" in 344100928Snectar [bB]*|1.0|1.[12].*) 345100928Snectar echo "${MACHINE}-whatever-cygwin_pre1.3" 346100928Snectar ;; 347100928Snectar *) 348100928Snectar echo "${MACHINE}-whatever-cygwin" 349100928Snectar ;; 350100928Snectar esac 351100928Snectar exit 0 35289837Skris ;; 35389837Skris 354100928Snectar *"CRAY T3E") 355100928Snectar echo "t3e-cray-unicosmk"; exit 0; 356100928Snectar ;; 357100928Snectar 358100928Snectar *CRAY*) 359100928Snectar echo "j90-cray-unicos"; exit 0; 360100928Snectar ;; 361109998Smarkm 362109998Smarkm NONSTOP_KERNEL*) 363109998Smarkm echo "nsr-tandem-nsk"; exit 0; 364109998Smarkm ;; 36555714Skrisesac 36655714Skris 36755714Skris# 36855714Skris# Ugg. These are all we can determine by what we know about 36955714Skris# the output of uname. Be more creative: 37055714Skris# 37155714Skris 37255714Skris# Do the Apollo stuff first. Here, we just simply assume 37355714Skris# that the existance of the /usr/apollo directory is proof 37455714Skris# enough 37555714Skrisif [ -d /usr/apollo ]; then 37655714Skris echo "whatever-apollo-whatever" 37755714Skris exit 0 37855714Skrisfi 37955714Skris 38055714Skris# Now NeXT 38155714SkrisISNEXT=`hostinfo 2>/dev/null` 38255714Skriscase "$ISNEXT" in 38355714Skris *'NeXT Mach 3.3'*) 38455714Skris echo "whatever-next-nextstep3.3"; exit 0 38555714Skris ;; 38655714Skris *NeXT*) 38755714Skris echo "whatever-next-nextstep"; exit 0 38855714Skris ;; 38955714Skrisesac 39055714Skris 39155714Skris# At this point we gone through all the one's 39255714Skris# we know of: Punt 39355714Skris 39455714Skrisecho "${MACHINE}-whatever-${SYSTEM}" 39555714Skrisexit 0 39655714Skris) 2>/dev/null | ( 39755714Skris 39855714Skris# --------------------------------------------------------------------------- 39955714Skris# this is where the translation occurs into SSLeay terms 40055714Skris# --------------------------------------------------------------------------- 40155714Skris 40255714Skris# figure out if gcc is available and if so we use it otherwise 40355714Skris# we fallback to whatever cc does on the system 404100936SnectarGCCVER=`(gcc -dumpversion) 2>/dev/null` 40555714Skrisif [ "$GCCVER" != "" ]; then 40655714Skris CC=gcc 407101618Snectar # then strip off whatever prefix egcs prepends the number with... 408101618Snectar # Hopefully, this will work for any future prefixes as well. 409160814Ssimon GCCVER=`echo $GCCVER | LC_ALL=C sed 's/^[a-zA-Z]*\-//'` 410100936Snectar # Since gcc 3.1 gcc --version behaviour has changed. gcc -dumpversion 411100936Snectar # does give us what we want though, so we use that. We just just the 412100936Snectar # major and minor version numbers. 41355714Skris # peak single digit before and after first dot, e.g. 2.95.1 gives 29 41455714Skris GCCVER=`echo $GCCVER | sed 's/\([0-9]\)\.\([0-9]\).*/\1\2/'` 41555714Skriselse 41655714Skris CC=cc 41755714Skrisfi 418101613SnectarGCCVER=${GCCVER:-0} 419100936Snectarif [ "$SYSTEM" = "HP-UX" ];then 420100936Snectar # By default gcc is a ILP32 compiler (with long long == 64). 421100936Snectar GCC_BITS="32" 422100936Snectar if [ $GCCVER -ge 30 ]; then 423100936Snectar # PA64 support only came in with gcc 3.0.x. 424127128Snectar # We check if the preprocessor symbol __LP64__ is defined... 425127128Snectar if echo "__LP64__" | gcc -v -E -x c - 2>/dev/null | grep "^__LP64__" 2>&1 > /dev/null; then 426127128Snectar : # __LP64__ has slipped through, it therefore is not defined 427127128Snectar else 428100936Snectar GCC_BITS="64" 429100936Snectar fi 430100936Snectar fi 431100936Snectarfi 43255714Skrisif [ "$SYSTEM" = "SunOS" ]; then 433109998Smarkm if [ $GCCVER -ge 30 ]; then 434109998Smarkm # 64-bit ABI isn't officially supported in gcc 3.0, but it appears 435109998Smarkm # to be working, at the very least 'make test' passes... 436109998Smarkm if gcc -v -E -x c /dev/null 2>&1 | grep __arch64__ > /dev/null; then 437109998Smarkm GCC_ARCH="-m64" 438109998Smarkm else 439109998Smarkm GCC_ARCH="-m32" 440109998Smarkm fi 441109998Smarkm fi 44259191Skris # check for WorkShop C, expected output is "cc: blah-blah C x.x" 44355714Skris CCVER=`(cc -V 2>&1) 2>/dev/null | \ 44455714Skris egrep -e '^cc: .* C [0-9]\.[0-9]' | \ 44555714Skris sed 's/.* C \([0-9]\)\.\([0-9]\).*/\1\2/'` 44655714Skris CCVER=${CCVER:-0} 447160814Ssimon if [ $MACHINE != i86pc -a $CCVER -gt 40 ]; then 44855714Skris CC=cc # overrides gcc!!! 44955714Skris if [ $CCVER -eq 50 ]; then 45055714Skris echo "WARNING! Detected WorkShop C 5.0. Do make sure you have" 45155714Skris echo " patch #107357-01 or later applied." 45255714Skris sleep 5 45355714Skris fi 45455714Skris fi 45555714Skrisfi 45655714Skris 45759191Skrisif [ "${SYSTEM}-${MACHINE}" = "Linux-alpha" ]; then 45859191Skris # check for Compaq C, expected output is "blah-blah C Vx.x" 45959191Skris CCCVER=`(ccc -V 2>&1) 2>/dev/null | \ 46059191Skris egrep -e '.* C V[0-9]\.[0-9]' | \ 46159191Skris sed 's/.* C V\([0-9]\)\.\([0-9]\).*/\1\2/'` 46259191Skris CCCVER=${CCCVER:-0} 46359191Skris if [ $CCCVER -gt 60 ]; then 46459191Skris CC=ccc # overrides gcc!!! well, ccc outperforms inoticeably 46559191Skris # only on hash routines and des, otherwise gcc (2.95) 46659191Skris # keeps along rather tight... 46759191Skris fi 46859191Skrisfi 46959191Skris 470111147Snectarif [ "${SYSTEM}" = "AIX" ]; then # favor vendor cc over gcc 471120631Snectar (cc) 2>&1 | grep -iv "not found" > /dev/null && CC=cc 472111147Snectarfi 473111147Snectar 47455714SkrisCCVER=${CCVER:-0} 47555714Skris 47655714Skris# read the output of the embedded GuessOS 47755714Skrisread GUESSOS 47855714Skris 47955714Skrisecho Operating system: $GUESSOS 48055714Skris 48155714Skris# now map the output into SSLeay terms ... really should hack into the 48255714Skris# script above so we end up with values in vars but that would take 48355714Skris# more time that I want to waste at the moment 48455714Skriscase "$GUESSOS" in 48555714Skris mips2-sgi-irix) 486120631Snectar CPU=`(hinv -t cpu) 2>/dev/null | head -1 | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'` 48755714Skris CPU=${CPU:-0} 48855714Skris if [ $CPU -ge 4000 ]; then 48955714Skris options="$options -mips2" 49055714Skris fi 49155714Skris OUT="irix-$CC" 49255714Skris ;; 49355714Skris mips3-sgi-irix) 494160814Ssimon #CPU=`(hinv -t cpu) 2>/dev/null | head -1 | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'` 495160814Ssimon #CPU=${CPU:-0} 496160814Ssimon #if [ $CPU -ge 5000 ]; then 497160814Ssimon # options="$options -mips4" 498160814Ssimon #else 499160814Ssimon # options="$options -mips3" 500160814Ssimon #fi 50155714Skris OUT="irix-mips3-$CC" 50255714Skris ;; 50355714Skris mips4-sgi-irix64) 50455714Skris echo "WARNING! If you wish to build 64-bit library, then you have to" 50576866Skris echo " invoke './Configure irix64-mips4-$CC' *manually*." 506160814Ssimon if [ "$TEST" = "false" -a -t 1 ]; then 507109998Smarkm echo " You have about 5 seconds to press Ctrl-C to abort." 508160814Ssimon (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1 509109998Smarkm fi 510160814Ssimon #CPU=`(hinv -t cpu) 2>/dev/null | head -1 | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'` 511160814Ssimon #CPU=${CPU:-0} 512160814Ssimon #if [ $CPU -ge 5000 ]; then 513160814Ssimon # options="$options -mips4" 514160814Ssimon #else 515160814Ssimon # options="$options -mips3" 516160814Ssimon #fi 51755714Skris OUT="irix-mips3-$CC" 51855714Skris ;; 519160814Ssimon ppc-apple-rhapsody) OUT="rhapsody-ppc-cc" ;; 520160814Ssimon ppc-apple-darwin*) OUT="darwin-ppc-cc" ;; 521160814Ssimon i386-apple-darwin*) OUT="darwin-i386-cc" ;; 52259191Skris alpha-*-linux2) 523160814Ssimon ISA=`awk '/cpu model/{print$4;exit(0);}' /proc/cpuinfo` 52459191Skris case ${ISA:-generic} in 525160814Ssimon *[678]) OUT="linux-alpha+bwx-$CC" ;; 52659191Skris *) OUT="linux-alpha-$CC" ;; 52759191Skris esac 52859191Skris if [ "$CC" = "gcc" ]; then 52959191Skris case ${ISA:-generic} in 530167612Ssimon EV5|EV45) options="$options -march=ev5";; 531167612Ssimon EV56|PCA56) options="$options -march=ev56";; 532167612Ssimon *) options="$options -march=ev6";; 53359191Skris esac 53459191Skris fi 53559191Skris ;; 536160814Ssimon ppc64-*-linux2) 537160814Ssimon echo "WARNING! If you wish to build 64-bit library, then you have to" 538160814Ssimon echo " invoke './Configure linux-ppc64' *manually*." 539160814Ssimon if [ "$TEST" = "false" -a -t 1 ]; then 540160814Ssimon echo " You have about 5 seconds to press Ctrl-C to abort." 541160814Ssimon (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1 542160814Ssimon fi 543160814Ssimon OUT="linux-ppc" 54489837Skris ;; 54559191Skris ppc-*-linux2) OUT="linux-ppc" ;; 54659191Skris ia64-*-linux?) OUT="linux-ia64" ;; 54755714Skris sparc64-*-linux2) 548111147Snectar echo "WARNING! If you *know* that your GNU C supports 64-bit/V9 ABI" 549109998Smarkm echo " and wish to build 64-bit library, then you have to" 550109998Smarkm echo " invoke './Configure linux64-sparcv9' *manually*." 551160814Ssimon if [ "$TEST" = "false" -a -t 1 ]; then 552109998Smarkm echo " You have about 5 seconds to press Ctrl-C to abort." 553160814Ssimon (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1 554109998Smarkm fi 55555714Skris OUT="linux-sparcv9" ;; 55655714Skris sparc-*-linux2) 557160814Ssimon KARCH=`awk '/^type/{print$3;exit(0);}' /proc/cpuinfo` 55855714Skris case ${KARCH:-sun4} in 55955714Skris sun4u*) OUT="linux-sparcv9" ;; 56055714Skris sun4m) OUT="linux-sparcv8" ;; 56155714Skris sun4d) OUT="linux-sparcv8" ;; 562160814Ssimon *) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;; 56355714Skris esac ;; 564160814Ssimon parisc*-*-linux2) 565160814Ssimon # 64-bit builds under parisc64 linux are not supported and 566160814Ssimon # compiler is expected to generate 32-bit objects... 567160814Ssimon CPUARCH=`awk '/cpu family/{print substr($5,1,3); exit(0);}' /proc/cpuinfo` 568160814Ssimon CPUSCHEDULE=`awk '/^cpu.[ ]*: PA/{print substr($3,3); exit(0);}' /proc/cpuinfo` 569100928Snectar 570100928Snectar # ??TODO ?? Model transformations 571100928Snectar # 0. CPU Architecture for the 1.1 processor has letter suffixes. We strip that off 572100928Snectar # assuming no further arch. identification will ever be used by GCC. 573100928Snectar # 1. I'm most concerned about whether is a 7300LC is closer to a 7100 versus a 7100LC. 574100928Snectar # 2. The variant 64-bit processors cause concern should GCC support explicit schedulers 575100928Snectar # for these chips in the future. 576100928Snectar # PA7300LC -> 7100LC (1.1) 577100928Snectar # PA8200 -> 8000 (2.0) 578100928Snectar # PA8500 -> 8000 (2.0) 579100928Snectar # PA8600 -> 8000 (2.0) 580100928Snectar 581160814Ssimon CPUSCHEDULE=`echo $CPUSCHEDULE|sed -e 's/7300LC/7100LC/' -e 's/8.00/8000/'` 582100928Snectar # Finish Model transformations 583100928Snectar 584160814Ssimon options="$options -DB_ENDIAN -mschedule=$CPUSCHEDULE -march=$CPUARCH" 585160814Ssimon OUT="linux-generic32" ;; 586160814Ssimon arm*b-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;; 587160814Ssimon arm*l-*-linux2) OUT="linux-generic32"; options="$options -DL_ENDIAN" ;; 588167612Ssimon sh*b-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;; 589167612Ssimon sh*-*-linux2) OUT="linux-generic32"; options="$options -DL_ENDIAN" ;; 590167612Ssimon m68k*-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;; 591160814Ssimon s390*-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN -DNO_ASM" ;; 592109998Smarkm x86_64-*-linux?) OUT="linux-x86_64" ;; 593160814Ssimon *86-*-linux2) OUT="linux-elf" 594109998Smarkm if [ "$GCCVER" -gt 28 ]; then 595109998Smarkm if grep '^model.*Pentium' /proc/cpuinfo >/dev/null ; then 596167612Ssimon options="$options -march=pentium" 597109998Smarkm fi 598109998Smarkm if grep '^model.*Pentium Pro' /proc/cpuinfo >/dev/null ; then 599167612Ssimon options="$options -march=pentiumpro" 600109998Smarkm fi 601109998Smarkm if grep '^model.*K6' /proc/cpuinfo >/dev/null ; then 602167612Ssimon options="$options -march=k6" 603109998Smarkm fi 604109998Smarkm fi ;; 60555714Skris *-*-linux1) OUT="linux-aout" ;; 606160814Ssimon *-*-linux2) OUT="linux-generic32" ;; 60768651Skris sun4u*-*-solaris2) 608109998Smarkm OUT="solaris-sparcv9-$CC" 60955714Skris ISA64=`(isalist) 2>/dev/null | grep sparcv9` 610109998Smarkm if [ "$ISA64" != "" ]; then 611109998Smarkm if [ "$CC" = "cc" -a $CCVER -ge 50 ]; then 61255714Skris echo "WARNING! If you wish to build 64-bit library, then you have to" 61355714Skris echo " invoke './Configure solaris64-sparcv9-cc' *manually*." 614160814Ssimon if [ "$TEST" = "false" -a -t 1 ]; then 615109998Smarkm echo " You have about 5 seconds to press Ctrl-C to abort." 616160814Ssimon (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1 617109998Smarkm fi 618109998Smarkm elif [ "$CC" = "gcc" -a "$GCC_ARCH" = "-m64" ]; then 619109998Smarkm # $GCC_ARCH denotes default ABI chosen by compiler driver 620109998Smarkm # (first one found on the $PATH). I assume that user 621109998Smarkm # expects certain consistency with the rest of his builds 622109998Smarkm # and therefore switch over to 64-bit. <appro> 623109998Smarkm OUT="solaris64-sparcv9-gcc" 624109998Smarkm echo "WARNING! If you wish to build 32-bit library, then you have to" 625109998Smarkm echo " invoke './Configure solaris-sparcv9-gcc' *manually*." 626160814Ssimon if [ "$TEST" = "false" -a -t 1 ]; then 627109998Smarkm echo " You have about 5 seconds to press Ctrl-C to abort." 628160814Ssimon (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1 629109998Smarkm fi 630109998Smarkm elif [ "$GCC_ARCH" = "-m32" ]; then 631109998Smarkm echo "NOTICE! If you *know* that your GNU C supports 64-bit/V9 ABI" 632109998Smarkm echo " and wish to build 64-bit library, then you have to" 633109998Smarkm echo " invoke './Configure solaris64-sparcv9-gcc' *manually*." 634160814Ssimon if [ "$TEST" = "false" -a -t 1 ]; then 635109998Smarkm echo " You have about 5 seconds to press Ctrl-C to abort." 636160814Ssimon (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1 637109998Smarkm fi 638109998Smarkm fi 63955714Skris fi 640109998Smarkm ;; 64168651Skris sun4m-*-solaris2) OUT="solaris-sparcv8-$CC" ;; 64268651Skris sun4d-*-solaris2) OUT="solaris-sparcv8-$CC" ;; 64368651Skris sun4*-*-solaris2) OUT="solaris-sparcv7-$CC" ;; 644160814Ssimon *86*-*-solaris2) 645160814Ssimon ISA64=`(isalist) 2>/dev/null | grep amd64` 646160814Ssimon if [ "$ISA64" != "" ]; then 647160814Ssimon OUT="solaris64-x86_64-$CC" 648160814Ssimon else 649160814Ssimon OUT="solaris-x86-$CC" 650160814Ssimon if [ `uname -r | sed -e 's/5\.//'` -lt 10 ]; then 651160814Ssimon options="$options no-sse2" 652160814Ssimon fi 653160814Ssimon fi 654160814Ssimon ;; 655160814Ssimon *-*-sunos4) OUT="sunos-$CC" ;; 656160814Ssimon 657160814Ssimon *86*-*-bsdi4) OUT="BSD-x86-elf"; options="$options no-sse2 -ldl" ;; 658160814Ssimon alpha*-*-*bsd*) OUT="BSD-generic64; options="$options -DL_ENDIAN" ;; 659160814Ssimon powerpc64-*-*bsd*) OUT="BSD-generic64; options="$options -DB_ENDIAN" ;; 660160814Ssimon sparc64-*-*bsd*) OUT="BSD-sparc64" ;; 661160814Ssimon ia64-*-*bsd*) OUT="BSD-ia64" ;; 662160814Ssimon amd64-*-*bsd*) OUT="BSD-x86_64" ;; 663160814Ssimon *86*-*-*bsd*) # mimic ld behaviour when it's looking for libc... 664160814Ssimon if [ -L /usr/lib/libc.so ]; then # [Free|Net]BSD 665160814Ssimon libc=/usr/lib/libc.so 666160814Ssimon else # OpenBSD 667160814Ssimon # ld searches for highest libc.so.* and so do we 668160814Ssimon libc=`(ls /usr/lib/libc.so.* | tail -1) 2>/dev/null` 669160814Ssimon fi 670160814Ssimon case "`(file -L $libc) 2>/dev/null`" in 671160814Ssimon *ELF*) OUT="BSD-x86-elf" ;; 672160814Ssimon *) OUT="BSD-x86"; options="$options no-sse2" ;; 673160814Ssimon esac ;; 674160814Ssimon *-*-*bsd*) OUT="BSD-generic32" ;; 675160814Ssimon 676160814Ssimon *-*-osf) OUT="osf1-alpha-cc" ;; 677160814Ssimon *-*-tru64) OUT="tru64-alpha-cc" ;; 678160814Ssimon *-*-[Uu]nix[Ww]are7) 67989837Skris if [ "$CC" = "gcc" ]; then 680160814Ssimon OUT="unixware-7-gcc" ; options="$options no-sse2" 68189837Skris else 682160814Ssimon OUT="unixware-7" ; options="$options no-sse2 -D__i386__" 68389837Skris fi 68489837Skris ;; 685160814Ssimon *-*-[Uu]nix[Ww]are20*) OUT="unixware-2.0"; options="$options no-sse2 no-sha512" ;; 686160814Ssimon *-*-[Uu]nix[Ww]are21*) OUT="unixware-2.1"; options="$options no-sse2 no-sha512" ;; 687142425Snectar *-*-vos) 688142425Snectar options="$options no-threads no-shared no-asm no-dso" 689142425Snectar EXE=".pm" 690142425Snectar OUT="vos-$CC" ;; 69155714Skris BS2000-siemens-sysv4) OUT="BS2000-OSD" ;; 69255714Skris RM*-siemens-sysv4) OUT="ReliantUNIX" ;; 69355714Skris *-siemens-sysv4) OUT="SINIX" ;; 694100936Snectar *-hpux1*) 695160814Ssimon if [ $CC = "gcc" -a $GCC_BITS = "64" ]; then 696127128Snectar OUT="hpux64-parisc2-gcc" 697100936Snectar fi 698109998Smarkm KERNEL_BITS=`(getconf KERNEL_BITS) 2>/dev/null` 699109998Smarkm KERNEL_BITS=${KERNEL_BITS:-32} 700109998Smarkm CPU_VERSION=`(getconf CPU_VERSION) 2>/dev/null` 701109998Smarkm CPU_VERSION=${CPU_VERSION:-0} 702109998Smarkm # See <sys/unistd.h> for further info on CPU_VERSION. 703109998Smarkm if [ $CPU_VERSION -ge 768 ]; then # IA-64 CPU 704111147Snectar echo "WARNING! 64-bit ABI is the default configured ABI on HP-UXi." 705111147Snectar echo " If you wish to build 32-bit library, the you have to" 706127128Snectar echo " invoke './Configure hpux-ia64-cc' *manually*." 707160814Ssimon if [ "$TEST" = "false" -a -t 1 ]; then 708111147Snectar echo " You have about 5 seconds to press Ctrl-C to abort." 709160814Ssimon (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1 710109998Smarkm fi 711109998Smarkm OUT="hpux64-ia64-cc" 712109998Smarkm elif [ $CPU_VERSION -ge 532 ]; then # PA-RISC 2.x CPU 713160814Ssimon OUT=${OUT:-"hpux-parisc2-${CC}"} 714109998Smarkm if [ $KERNEL_BITS -eq 64 -a "$CC" = "cc" ]; then 715109998Smarkm echo "WARNING! If you wish to build 64-bit library then you have to" 716109998Smarkm echo " invoke './Configure hpux64-parisc2-cc' *manually*." 717160814Ssimon if [ "$TEST" = "false" -a -t 1 ]; then 718109998Smarkm echo " You have about 5 seconds to press Ctrl-C to abort." 719160814Ssimon (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1 720109998Smarkm fi 721109998Smarkm fi 722109998Smarkm elif [ $CPU_VERSION -ge 528 ]; then # PA-RISC 1.1+ CPU 723162911Ssimon OUT="hpux-parisc-${CC}" 724109998Smarkm elif [ $CPU_VERSION -ge 523 ]; then # PA-RISC 1.0 CPU 725162911Ssimon OUT="hpux-parisc-${CC}" 726109998Smarkm else # Motorola(?) CPU 727109998Smarkm OUT="hpux-$CC" 728109998Smarkm fi 729100936Snectar options="$options -D_REENTRANT" ;; 73059191Skris *-hpux) OUT="hpux-parisc-$CC" ;; 731160814Ssimon *-aix) 732160814Ssimon KERNEL_BITS=`(getconf KERNEL_BITMODE) 2>/dev/null` 733160814Ssimon KERNEL_BITS=${KERNEL_BITS:-32} 734160814Ssimon OBJECT_MODE=${OBJECT_MODE:-32} 735160814Ssimon if [ "$CC" = "gcc" ]; then 736160814Ssimon OUT="aix-gcc" 737160814Ssimon elif [ $OBJECT_MODE -eq 64 ]; then 738160814Ssimon echo 'Your $OBJECT_MODE was found to be set to 64' 739160814Ssimon OUT="aix64-cc" 740160814Ssimon else 741160814Ssimon OUT="aix-cc" 742160814Ssimon if [ $KERNEL_BITS -eq 64 ]; then 743160814Ssimon echo "WARNING! If you wish to build 64-bit kit, then you have to" 744160814Ssimon echo " invoke './Configure aix64-cc' *manually*." 745160814Ssimon if [ "$TEST" = "false" -a -t 1 ]; then 746160814Ssimon echo " You have ~5 seconds to press Ctrl-C to abort." 747160814Ssimon (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1 748160814Ssimon fi 749160814Ssimon fi 750160814Ssimon fi 751160814Ssimon if (lsattr -E -O -l proc0 | grep -i powerpc) >/dev/null 2>&1; then 752160814Ssimon : # this applies even to Power3 and later, as they return PowerPC_POWER[345] 753160814Ssimon else 754160814Ssimon options="$options no-asm" 755160814Ssimon fi 756160814Ssimon ;; 75755714Skris # these are all covered by the catchall below 75855714Skris # *-dgux) OUT="dgux" ;; 75968651Skris mips-sony-newsos4) OUT="newsos4-gcc" ;; 760100928Snectar *-*-cygwin_pre1.3) OUT="Cygwin-pre1.3" ;; 761100928Snectar *-*-cygwin) OUT="Cygwin" ;; 762100928Snectar t3e-cray-unicosmk) OUT="cray-t3e" ;; 763100928Snectar j90-cray-unicos) OUT="cray-j90" ;; 764109998Smarkm nsr-tandem-nsk) OUT="tandem-c89" ;; 76555714Skris *) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;; 76655714Skrisesac 76755714Skris 768109998Smarkm# NB: This atalla support has been superceded by the ENGINE support 769109998Smarkm# That contains its own header and definitions anyway. Support can 770109998Smarkm# be enabled or disabled on any supported platform without external 771109998Smarkm# headers, eg. by adding the "hw-atalla" switch to ./config or 772109998Smarkm# perl Configure 773109998Smarkm# 77459191Skris# See whether we can compile Atalla support 775109998Smarkm#if [ -f /usr/include/atasi.h ] 776109998Smarkm#then 777109998Smarkm# options="$options -DATALLA" 778109998Smarkm#fi 77959191Skris 780167612Ssimon# gcc < 2.8 does not support -march=ultrasparc 78155714Skrisif [ "$OUT" = solaris-sparcv9-gcc -a $GCCVER -lt 28 ] 78255714Skristhen 783160814Ssimon echo "WARNING! Falling down to 'solaris-sparcv8-gcc'." 784160814Ssimon echo " Upgrade to gcc-2.8 or later." 78555714Skris sleep 5 786160814Ssimon OUT=solaris-sparcv8-gcc 78755714Skrisfi 78855714Skrisif [ "$OUT" = "linux-sparcv9" -a $GCCVER -lt 28 ] 78955714Skristhen 79055714Skris echo "WARNING! Falling down to 'linux-sparcv8'." 79155714Skris echo " Upgrade to gcc-2.8 or later." 79255714Skris sleep 5 79355714Skris OUT=linux-sparcv8 79455714Skrisfi 79555714Skris 79655714Skriscase "$GUESSOS" in 79755714Skris i386-*) options="$options 386" ;; 79855714Skrisesac 79955714Skris 800162911Ssimonfor i in aes bf camellia cast des dh dsa ec hmac idea md2 md5 mdc2 rc2 rc4 rc5 ripemd rsa sha 80155714Skrisdo 80255714Skris if [ ! -d crypto/$i ] 80355714Skris then 80455714Skris options="$options no-$i" 80555714Skris fi 80655714Skrisdone 80755714Skris 808109998Smarkm# Discover Kerberos 5 (since it's still a prototype, we don't 809109998Smarkm# do any guesses yet, that's why this section is commented away. 810109998Smarkm#if [ -d /usr/kerberos ]; then 811109998Smarkm# krb5_dir=/usr/kerberos 812109998Smarkm# if [ \( -f $krb5_dir/lib/libgssapi_krb5.a -o -f $krb5_dir/lib/libgssapi_krb5.so* \)\ 813109998Smarkm# -a \( -f $krb5_dir/lib/libkrb5.a -o -f $krb5_dir/lib/libkrb5.so* \)\ 814109998Smarkm# -a \( -f $krb5_dir/lib/libcom_err.a -o -f $krb5_dir/lib/libcom_err.so* \)\ 815109998Smarkm# -a \( -f $krb5_dir/lib/libk5crypto.a -o -f $krb5_dir/lib/libk5crypto.so* \)\ 816109998Smarkm# -a \( -f $krb5_dir/include/krb5.h \) ]; then 817109998Smarkm# options="$options --with-krb5-flavor=MIT" 818109998Smarkm# fi 819109998Smarkm#elif [ -d /usr/heimdal ]; then 820109998Smarkm# krb5_dir=/usr/heimdal 821109998Smarkm# if [ \( -f $krb5_dir/lib/libgssapi.a -o -f $krb5_dir/lib/libgssapi.so* \)\ 822109998Smarkm# -a \( -f $krb5_dir/lib/libkrb5.a -o -f $krb5_dir/lib/libkrb5.so* \)\ 823109998Smarkm# -a \( -f $krb5_dir/lib/libcom_err.a -o -f $krb5_dir/lib/libcom_err.so* \)\ 824109998Smarkm# -a \( -f $krb5_dir/include/krb5.h \) ]; then 825109998Smarkm# options="$options --with-krb5-flavor=Heimdal" 826109998Smarkm# fi 827109998Smarkm#fi 828109998Smarkm 82955714Skrisif [ -z "$OUT" ]; then 83055714Skris OUT="$CC" 83155714Skrisfi 83255714Skris 83355714Skrisif [ ".$PERL" = . ] ; then 83455714Skris for i in . `echo $PATH | sed 's/:/ /g'`; do 835142425Snectar if [ -f "$i/perl5$EXE" ] ; then 836142425Snectar PERL="$i/perl5$EXE" 83755714Skris break; 83855714Skris fi; 83955714Skris done 84055714Skrisfi 84155714Skris 84255714Skrisif [ ".$PERL" = . ] ; then 84355714Skris for i in . `echo $PATH | sed 's/:/ /g'`; do 844142425Snectar if [ -f "$i/perl$EXE" ] ; then 845142425Snectar if "$i/perl$EXE" -e 'exit($]<5.0)'; then 846142425Snectar PERL="$i/perl$EXE" 84755714Skris break; 84855714Skris fi; 84955714Skris fi; 85055714Skris done 85155714Skrisfi 85255714Skris 85355714Skrisif [ ".$PERL" = . ] ; then 85455714Skris echo "You need Perl 5." 85555714Skris exit 1 85655714Skrisfi 85755714Skris 85855714Skris# run Configure to check to see if we need to specify the 85955714Skris# compiler for the platform ... in which case we add it on 86055714Skris# the end ... otherwise we leave it off 86155714Skris 86259191Skris$PERL ./Configure LIST | grep "$OUT-$CC" > /dev/null 86355714Skrisif [ $? = "0" ]; then 86455714Skris OUT="$OUT-$CC" 86555714Skrisfi 86655714Skris 86755714SkrisOUT="$PREFIX$OUT" 86855714Skris 86959191Skris$PERL ./Configure LIST | grep "$OUT" > /dev/null 87055714Skrisif [ $? = "0" ]; then 87172613Skris echo Configuring for $OUT 87255714Skris 87355714Skris if [ "$TEST" = "true" ]; then 87455714Skris echo $PERL ./Configure $OUT $options 87555714Skris else 87655714Skris $PERL ./Configure $OUT $options 87755714Skris fi 87855714Skriselse 87955714Skris echo "This system ($OUT) is not supported. See file INSTALL for details." 88055714Skrisfi 88155714Skris) 882