config revision 111147
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" 26109998Smarkm 27109998Smarkm# pick up any command line args to config 28109998Smarkmfor i 29109998Smarkmdo 30109998Smarkmcase "$i" in 31109998Smarkm-d*) PREFIX="debug-";; 32109998Smarkm-t*) TEST="true";; 33109998Smarkm-h*) TEST="true"; cat <<EOF 34109998SmarkmUsage: config [options] 35109998Smarkm -d Add a debug- prefix to machine choice. 36109998Smarkm -t Test mode, do not run the Configure perl script. 37109998Smarkm -h This help. 38109998Smarkm 39109998SmarkmAny other text will be passed to the Configure perl script. 40109998SmarkmSee INSTALL for instructions. 41109998Smarkm 42109998SmarkmEOF 43109998Smarkm;; 44109998Smarkm*) options=$options" $i" ;; 45109998Smarkmesac 46109998Smarkmdone 47109998Smarkm 4855714Skris# First get uname entries that we use below 4955714Skris 5055714SkrisMACHINE=`(uname -m) 2>/dev/null` || MACHINE="unknown" 5155714SkrisRELEASE=`(uname -r) 2>/dev/null` || RELEASE="unknown" 5255714SkrisSYSTEM=`(uname -s) 2>/dev/null` || SYSTEM="unknown" 5355714SkrisVERSION=`(uname -v) 2>/dev/null` || VERSION="unknown" 5455714Skris 5559191Skris 5655714Skris# Now test for ISC and SCO, since it is has a braindamaged uname. 5755714Skris# 5855714Skris# We need to work around FreeBSD 1.1.5.1 5955714Skris( 6055714SkrisXREL=`uname -X 2>/dev/null | grep "^Release" | awk '{print $3}'` 6155714Skrisif [ "x$XREL" != "x" ]; then 6255714Skris if [ -f /etc/kconfig ]; then 6355714Skris case "$XREL" in 6455714Skris 4.0|4.1) 6555714Skris echo "${MACHINE}-whatever-isc4"; exit 0 6655714Skris ;; 6755714Skris esac 6855714Skris else 6955714Skris case "$XREL" in 7055714Skris 3.2v4.2) 7155714Skris echo "whatever-whatever-sco3"; exit 0 7255714Skris ;; 7355714Skris 3.2v5.0*) 7455714Skris echo "whatever-whatever-sco5"; exit 0 7555714Skris ;; 7655714Skris 4.2MP) 77111147Snectar case "x${VERSION}" in 78111147Snectar x2.0*) echo "whatever-whatever-unixware20"; exit 0 ;; 79111147Snectar x2.1*) echo "whatever-whatever-unixware21"; exit 0 ;; 80111147Snectar x2*) echo "whatever-whatever-unixware2"; exit 0 ;; 81111147Snectar esac 8255714Skris ;; 8355714Skris 4.2) 84111147Snectar echo "i386-whatever-unixware1"; exit 0 8555714Skris ;; 8659191Skris 5) 87111147Snectar case "x${VERSION}" in 88111147Snectar # We hardcode i586 in place of ${MACHINE} for the 89111147Snectar # following reason. The catch is that even though Pentium 90111147Snectar # is minimum requirement for platforms in question, 91111147Snectar # ${MACHINE} gets always assigned to i386. Now, problem 92111147Snectar # with i386 is that it makes ./config pass 386 to 93111147Snectar # ./Configure, which in turn makes make generate 94111147Snectar # inefficient SHA-1 (for this moment) code. 95111147Snectar x7*) echo "i586-sco-unixware7"; exit 0 ;; 96111147Snectar x8*) echo "i586-unkn-OpenUNIX${VERSION}"; 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 11376866Skris AIX:[3456789]:4:*) 11476866Skris echo "${MACHINE}-ibm-aix43"; exit 0 11576866Skris ;; 11676866Skris 11776866Skris AIX:*:[56789]:*) 11876866Skris echo "${MACHINE}-ibm-aix43"; exit 0 11976866Skris ;; 12076866Skris 12155714Skris AIX:*) 12255714Skris echo "${MACHINE}-ibm-aix"; 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 13755714Skris echo "${MACHINE}-hp-hpux10"; 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 29155714Skris *:4*:R4*:m88k) 29255714Skris echo "${MACHINE}-whatever-sysv4"; exit 0 29355714Skris ;; 29455714Skris 29555714Skris DYNIX/ptx:4*:*) 29655714Skris echo "${MACHINE}-whatever-sysv4"; exit 0 29755714Skris ;; 29855714Skris 29955714Skris *:4.0:3.0:3[34]?? | *:4.0:3.0:3[34]??,*) 30055714Skris echo "i486-ncr-sysv4"; exit 0 30155714Skris ;; 30255714Skris 30355714Skris ULTRIX:*) 30455714Skris echo "${MACHINE}-unknown-ultrix"; exit 0 30555714Skris ;; 30655714Skris 30755714Skris SINIX*|ReliantUNIX*) 30855714Skris echo "${MACHINE}-siemens-sysv4"; exit 0 30955714Skris ;; 31055714Skris 31155714Skris POSIX-BC*) 31255714Skris echo "${MACHINE}-siemens-sysv4"; exit 0 # Here, $MACHINE == "BS2000" 31355714Skris ;; 31455714Skris 31555714Skris machten:*) 31655714Skris echo "${MACHINE}-tenon-${SYSTEM}"; exit 0; 31755714Skris ;; 31855714Skris 31955714Skris library:*) 32055714Skris echo "${MACHINE}-ncr-sysv4"; exit 0 32155714Skris ;; 32255714Skris 32355714Skris ConvexOS:*:11.0:*) 32455714Skris echo "${MACHINE}-v11-${SYSTEM}"; exit 0; 32555714Skris ;; 32655714Skris 32768651Skris NEWS-OS:4.*) 32868651Skris echo "mips-sony-newsos4"; exit 0; 32968651Skris ;; 33068651Skris 33189837Skris CYGWIN*) 332100928Snectar case "$RELEASE" in 333100928Snectar [bB]*|1.0|1.[12].*) 334100928Snectar echo "${MACHINE}-whatever-cygwin_pre1.3" 335100928Snectar ;; 336100928Snectar *) 337100928Snectar echo "${MACHINE}-whatever-cygwin" 338100928Snectar ;; 339100928Snectar esac 340100928Snectar exit 0 34189837Skris ;; 34289837Skris 343100928Snectar *"CRAY T3E") 344100928Snectar echo "t3e-cray-unicosmk"; exit 0; 345100928Snectar ;; 346100928Snectar 347100928Snectar *CRAY*) 348100928Snectar echo "j90-cray-unicos"; exit 0; 349100928Snectar ;; 350109998Smarkm 351109998Smarkm NONSTOP_KERNEL*) 352109998Smarkm echo "nsr-tandem-nsk"; exit 0; 353109998Smarkm ;; 35455714Skrisesac 35555714Skris 35655714Skris# 35755714Skris# Ugg. These are all we can determine by what we know about 35855714Skris# the output of uname. Be more creative: 35955714Skris# 36055714Skris 36155714Skris# Do the Apollo stuff first. Here, we just simply assume 36255714Skris# that the existance of the /usr/apollo directory is proof 36355714Skris# enough 36455714Skrisif [ -d /usr/apollo ]; then 36555714Skris echo "whatever-apollo-whatever" 36655714Skris exit 0 36755714Skrisfi 36855714Skris 36955714Skris# Now NeXT 37055714SkrisISNEXT=`hostinfo 2>/dev/null` 37155714Skriscase "$ISNEXT" in 37255714Skris *'NeXT Mach 3.3'*) 37355714Skris echo "whatever-next-nextstep3.3"; exit 0 37455714Skris ;; 37555714Skris *NeXT*) 37655714Skris echo "whatever-next-nextstep"; exit 0 37755714Skris ;; 37855714Skrisesac 37955714Skris 38055714Skris# At this point we gone through all the one's 38155714Skris# we know of: Punt 38255714Skris 38355714Skrisecho "${MACHINE}-whatever-${SYSTEM}" 38455714Skrisexit 0 38555714Skris) 2>/dev/null | ( 38655714Skris 38755714Skris# --------------------------------------------------------------------------- 38855714Skris# this is where the translation occurs into SSLeay terms 38955714Skris# --------------------------------------------------------------------------- 39055714Skris 39155714Skris# figure out if gcc is available and if so we use it otherwise 39255714Skris# we fallback to whatever cc does on the system 393100936SnectarGCCVER=`(gcc -dumpversion) 2>/dev/null` 39455714Skrisif [ "$GCCVER" != "" ]; then 39555714Skris CC=gcc 396101618Snectar # then strip off whatever prefix egcs prepends the number with... 397101618Snectar # Hopefully, this will work for any future prefixes as well. 398101618Snectar GCCVER=`echo $GCCVER | sed 's/^[a-zA-Z]*\-//'` 399100936Snectar # Since gcc 3.1 gcc --version behaviour has changed. gcc -dumpversion 400100936Snectar # does give us what we want though, so we use that. We just just the 401100936Snectar # major and minor version numbers. 40255714Skris # peak single digit before and after first dot, e.g. 2.95.1 gives 29 40355714Skris GCCVER=`echo $GCCVER | sed 's/\([0-9]\)\.\([0-9]\).*/\1\2/'` 40455714Skriselse 40555714Skris CC=cc 40655714Skrisfi 407101613SnectarGCCVER=${GCCVER:-0} 408100936Snectarif [ "$SYSTEM" = "HP-UX" ];then 409100936Snectar # By default gcc is a ILP32 compiler (with long long == 64). 410100936Snectar GCC_BITS="32" 411100936Snectar if [ $GCCVER -ge 30 ]; then 412100936Snectar # PA64 support only came in with gcc 3.0.x. 413100936Snectar # We look for the preprocessor symbol __LP64__ indicating 414100936Snectar # 64bit bit long and pointer. sizeof(int) == 32 on HPUX64. 415100936Snectar if gcc -v -E -x c /dev/null 2>&1 | grep __LP64__ > /dev/null; then 416100936Snectar GCC_BITS="64" 417100936Snectar fi 418100936Snectar fi 419100936Snectarfi 42055714Skrisif [ "$SYSTEM" = "SunOS" ]; then 421109998Smarkm if [ $GCCVER -ge 30 ]; then 422109998Smarkm # 64-bit ABI isn't officially supported in gcc 3.0, but it appears 423109998Smarkm # to be working, at the very least 'make test' passes... 424109998Smarkm if gcc -v -E -x c /dev/null 2>&1 | grep __arch64__ > /dev/null; then 425109998Smarkm GCC_ARCH="-m64" 426109998Smarkm else 427109998Smarkm GCC_ARCH="-m32" 428109998Smarkm fi 429109998Smarkm fi 43059191Skris # check for WorkShop C, expected output is "cc: blah-blah C x.x" 43155714Skris CCVER=`(cc -V 2>&1) 2>/dev/null | \ 43255714Skris egrep -e '^cc: .* C [0-9]\.[0-9]' | \ 43355714Skris sed 's/.* C \([0-9]\)\.\([0-9]\).*/\1\2/'` 43455714Skris CCVER=${CCVER:-0} 43555714Skris if [ $CCVER -gt 40 ]; then 43655714Skris CC=cc # overrides gcc!!! 43755714Skris if [ $CCVER -eq 50 ]; then 43855714Skris echo "WARNING! Detected WorkShop C 5.0. Do make sure you have" 43955714Skris echo " patch #107357-01 or later applied." 44055714Skris sleep 5 44155714Skris fi 44255714Skris elif [ "$CC" = "cc" -a $CCVER -gt 0 ]; then 44355714Skris CC=sc3 44455714Skris fi 44555714Skrisfi 44655714Skris 44759191Skrisif [ "${SYSTEM}-${MACHINE}" = "Linux-alpha" ]; then 44859191Skris # check for Compaq C, expected output is "blah-blah C Vx.x" 44959191Skris CCCVER=`(ccc -V 2>&1) 2>/dev/null | \ 45059191Skris egrep -e '.* C V[0-9]\.[0-9]' | \ 45159191Skris sed 's/.* C V\([0-9]\)\.\([0-9]\).*/\1\2/'` 45259191Skris CCCVER=${CCCVER:-0} 45359191Skris if [ $CCCVER -gt 60 ]; then 45459191Skris CC=ccc # overrides gcc!!! well, ccc outperforms inoticeably 45559191Skris # only on hash routines and des, otherwise gcc (2.95) 45659191Skris # keeps along rather tight... 45759191Skris fi 45859191Skrisfi 45959191Skris 460111147Snectarif [ "${SYSTEM}" = "AIX" ]; then # favor vendor cc over gcc 461111147Snectar (cc) 2>&1 | grep -iv "command not found" > /dev/null && CC=cc 462111147Snectarfi 463111147Snectar 46455714SkrisCCVER=${CCVER:-0} 46555714Skris 46655714Skris# read the output of the embedded GuessOS 46755714Skrisread GUESSOS 46855714Skris 46955714Skrisecho Operating system: $GUESSOS 47055714Skris 47155714Skris# now map the output into SSLeay terms ... really should hack into the 47255714Skris# script above so we end up with values in vars but that would take 47355714Skris# more time that I want to waste at the moment 47455714Skriscase "$GUESSOS" in 47555714Skris mips2-sgi-irix) 47655714Skris CPU=`(hinv -t cpu) 2>/dev/null | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'` 47755714Skris CPU=${CPU:-0} 47855714Skris if [ $CPU -ge 4000 ]; then 47955714Skris options="$options -mips2" 48055714Skris fi 48155714Skris OUT="irix-$CC" 48255714Skris ;; 48355714Skris mips3-sgi-irix) 48455714Skris CPU=`(hinv -t cpu) 2>/dev/null | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'` 48555714Skris CPU=${CPU:-0} 48655714Skris if [ $CPU -ge 5000 ]; then 48755714Skris options="$options -mips4" 48855714Skris else 48955714Skris options="$options -mips3" 49055714Skris fi 49155714Skris OUT="irix-mips3-$CC" 49255714Skris ;; 49355714Skris mips4-sgi-irix64) 49455714Skris echo "WARNING! If you wish to build 64-bit library, then you have to" 49576866Skris echo " invoke './Configure irix64-mips4-$CC' *manually*." 496109998Smarkm if [ "$TEST" = "false" ]; then 497109998Smarkm echo " You have about 5 seconds to press Ctrl-C to abort." 498109998Smarkm (stty -icanon min 0 time 50; read waste) < /dev/tty 499109998Smarkm fi 50076866Skris CPU=`(hinv -t cpu) 2>/dev/null | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'` 50176866Skris CPU=${CPU:-0} 50276866Skris if [ $CPU -ge 5000 ]; then 50376866Skris options="$options -mips4" 50476866Skris else 50576866Skris options="$options -mips3" 50676866Skris fi 50755714Skris OUT="irix-mips3-$CC" 50855714Skris ;; 50959191Skris alpha-*-linux2) 51059191Skris ISA=`awk '/cpu model/{print$4}' /proc/cpuinfo` 51159191Skris case ${ISA:-generic} in 51259191Skris *[67]) OUT="linux-alpha+bwx-$CC" ;; 51359191Skris *) OUT="linux-alpha-$CC" ;; 51459191Skris esac 51559191Skris if [ "$CC" = "gcc" ]; then 51659191Skris case ${ISA:-generic} in 51759191Skris EV5|EV45) options="$options -mcpu=ev5";; 51859191Skris EV56|PCA56) options="$options -mcpu=ev56";; 51959191Skris EV6|EV67|PCA57) options="$options -mcpu=ev6";; 52059191Skris esac 52159191Skris fi 52259191Skris ;; 52389837Skris mips-*-linux?) 52489837Skris cat >dummy.c <<EOF 52589837Skris#include <stdio.h> /* for printf() prototype */ 52689837Skris int main (argc, argv) int argc; char *argv[]; { 52789837Skris#ifdef __MIPSEB__ 52889837Skris printf ("linux-%s\n", argv[1]); 52989837Skris#endif 53089837Skris#ifdef __MIPSEL__ 53189837Skris printf ("linux-%sel\n", argv[1]); 53289837Skris#endif 53389837Skris return 0; 53489837Skris} 53589837SkrisEOF 53689837Skris ${CC} -o dummy dummy.c && OUT=`./dummy ${MACHINE}` 53789837Skris rm dummy dummy.c 53889837Skris ;; 539100936Snectar ppc64-*-linux2) 540100936Snectar #Use the standard target for PPC architecture until we create a 541100936Snectar #special one for the 64bit architecture. 542100936Snectar OUT="linux-ppc" ;; 54359191Skris ppc-*-linux2) OUT="linux-ppc" ;; 54468651Skris m68k-*-linux*) OUT="linux-m68k" ;; 54559191Skris ia64-*-linux?) OUT="linux-ia64" ;; 54659191Skris ppc-apple-rhapsody) OUT="rhapsody-ppc-cc" ;; 547109998Smarkm ppc-apple-darwin*) OUT="darwin-ppc-cc" ;; 548109998Smarkm i386-apple-darwin*) OUT="darwin-i386-cc" ;; 54955714Skris sparc64-*-linux2) 550111147Snectar echo "WARNING! If you *know* that your GNU C supports 64-bit/V9 ABI" 551109998Smarkm echo " and wish to build 64-bit library, then you have to" 552109998Smarkm echo " invoke './Configure linux64-sparcv9' *manually*." 553109998Smarkm if [ "$TEST" = "false" ]; then 554109998Smarkm echo " You have about 5 seconds to press Ctrl-C to abort." 555109998Smarkm (stty -icanon min 0 time 50; read waste) < /dev/tty 556109998Smarkm fi 55755714Skris OUT="linux-sparcv9" ;; 55855714Skris sparc-*-linux2) 55972613Skris KARCH=`awk '/^type/{print$3}' /proc/cpuinfo` 56055714Skris case ${KARCH:-sun4} in 56155714Skris sun4u*) OUT="linux-sparcv9" ;; 56255714Skris sun4m) OUT="linux-sparcv8" ;; 56355714Skris sun4d) OUT="linux-sparcv8" ;; 56455714Skris *) OUT="linux-sparcv7" ;; 56555714Skris esac ;; 566100928Snectar parisc-*-linux2) 567100928Snectar CPUARCH=`awk '/cpu family/{print substr($5,1,3)}' /proc/cpuinfo` 568100928Snectar CPUSCHEDULE=`awk '/^cpu.[ ]: PA/{print substr($3,3)}' /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 581100928Snectar CPUSCHEDULE=`echo $CPUSCHEDULE|sed -e 's/7300LC/7100LC/' -e 's/8?00/8000/'` 582100928Snectar # Finish Model transformations 583100928Snectar 584100928Snectar options="$options -mschedule=$CPUSCHEDULE -march=$CPUARCH" 585100928Snectar OUT="linux-parisc" ;; 58668651Skris arm*-*-linux2) OUT="linux-elf-arm" ;; 58772613Skris s390-*-linux2) OUT="linux-s390" ;; 588100928Snectar s390x-*-linux?) OUT="linux-s390x" ;; 589109998Smarkm x86_64-*-linux?) OUT="linux-x86_64" ;; 590109998Smarkm *-*-linux2) OUT="linux-elf" 591109998Smarkm if [ "$GCCVER" -gt 28 ]; then 592109998Smarkm if grep '^model.*Pentium' /proc/cpuinfo >/dev/null ; then 593109998Smarkm OUT="linux-pentium" 594109998Smarkm fi 595109998Smarkm if grep '^model.*Pentium Pro' /proc/cpuinfo >/dev/null ; then 596109998Smarkm OUT="linux-ppro" 597109998Smarkm fi 598109998Smarkm if grep '^model.*K6' /proc/cpuinfo >/dev/null ; then 599109998Smarkm OUT="linux-k6" 600109998Smarkm fi 601109998Smarkm fi ;; 60255714Skris *-*-linux1) OUT="linux-aout" ;; 60368651Skris sun4u*-*-solaris2) 604109998Smarkm OUT="solaris-sparcv9-$CC" 60555714Skris ISA64=`(isalist) 2>/dev/null | grep sparcv9` 606109998Smarkm if [ "$ISA64" != "" ]; then 607109998Smarkm if [ "$CC" = "cc" -a $CCVER -ge 50 ]; then 60855714Skris echo "WARNING! If you wish to build 64-bit library, then you have to" 60955714Skris echo " invoke './Configure solaris64-sparcv9-cc' *manually*." 610109998Smarkm if [ "$TEST" = "false" ]; then 611109998Smarkm echo " You have about 5 seconds to press Ctrl-C to abort." 612109998Smarkm (stty -icanon min 0 time 50; read waste) < /dev/tty 613109998Smarkm fi 614109998Smarkm elif [ "$CC" = "gcc" -a "$GCC_ARCH" = "-m64" ]; then 615109998Smarkm # $GCC_ARCH denotes default ABI chosen by compiler driver 616109998Smarkm # (first one found on the $PATH). I assume that user 617109998Smarkm # expects certain consistency with the rest of his builds 618109998Smarkm # and therefore switch over to 64-bit. <appro> 619109998Smarkm OUT="solaris64-sparcv9-gcc" 620109998Smarkm echo "WARNING! If you wish to build 32-bit library, then you have to" 621109998Smarkm echo " invoke './Configure solaris-sparcv9-gcc' *manually*." 622109998Smarkm if [ "$TEST" = "false" ]; then 623109998Smarkm echo " You have about 5 seconds to press Ctrl-C to abort." 624109998Smarkm (stty -icanon min 0 time 50; read waste) < /dev/tty 625109998Smarkm fi 626109998Smarkm elif [ "$GCC_ARCH" = "-m32" ]; then 627109998Smarkm echo "NOTICE! If you *know* that your GNU C supports 64-bit/V9 ABI" 628109998Smarkm echo " and wish to build 64-bit library, then you have to" 629109998Smarkm echo " invoke './Configure solaris64-sparcv9-gcc' *manually*." 630109998Smarkm if [ "$TEST" = "false" ]; then 631109998Smarkm echo " You have about 5 seconds to press Ctrl-C to abort." 632109998Smarkm (stty -icanon min 0 time 50; read waste) < /dev/tty 633109998Smarkm fi 634109998Smarkm fi 63555714Skris fi 636109998Smarkm ;; 63768651Skris sun4m-*-solaris2) OUT="solaris-sparcv8-$CC" ;; 63868651Skris sun4d-*-solaris2) OUT="solaris-sparcv8-$CC" ;; 63968651Skris sun4*-*-solaris2) OUT="solaris-sparcv7-$CC" ;; 64068651Skris *86*-*-solaris2) OUT="solaris-x86-$CC" ;; 64155714Skris *-*-sunos4) OUT="sunos-$CC" ;; 64255714Skris alpha*-*-freebsd*) OUT="FreeBSD-alpha" ;; 643111147Snectar sparc64-*-freebsd*) OUT="FreeBSD-sparc64" ;; 644111147Snectar ia64-*-freebsd*) OUT="FreeBSD-ia64" ;; 64555714Skris *-freebsd[3-9]*) OUT="FreeBSD-elf" ;; 64655714Skris *-freebsd[1-2]*) OUT="FreeBSD" ;; 64755714Skris *86*-*-netbsd) OUT="NetBSD-x86" ;; 64855714Skris sun3*-*-netbsd) OUT="NetBSD-m68" ;; 64955714Skris *-*-netbsd) OUT="NetBSD-sparc" ;; 65055714Skris alpha*-*-openbsd) OUT="OpenBSD-alpha" ;; 651109998Smarkm *86*-*-openbsd) OUT="OpenBSD-i386" ;; 652109998Smarkm m68k*-*-openbsd) OUT="OpenBSD-m68k" ;; 653109998Smarkm m88k*-*-openbsd) OUT="OpenBSD-m88k" ;; 654109998Smarkm mips*-*-openbsd) OUT="OpenBSD-mips" ;; 65555714Skris pmax*-*-openbsd) OUT="OpenBSD-mips" ;; 656109998Smarkm powerpc*-*-openbsd) OUT="OpenBSD-powerpc" ;; 657109998Smarkm sparc64*-*-openbsd) OUT="OpenBSD-sparc64" ;; 658109998Smarkm sparc*-*-openbsd) OUT="OpenBSD-sparc" ;; 659109998Smarkm vax*-*-openbsd) OUT="OpenBSD-vax" ;; 660109998Smarkm hppa*-*-openbsd) OUT="OpenBSD-hppa" ;; 66155714Skris *-*-openbsd) OUT="OpenBSD" ;; 66255714Skris *86*-*-bsdi4) OUT="bsdi-elf-gcc" ;; 66389837Skris *-*-osf) OUT="alphaold-cc" ;; 66489837Skris *-*-tru64) OUT="alpha-cc" ;; 66589837Skris *-*-OpenUNIX*) 66689837Skris if [ "$CC" = "gcc" ]; then 66789837Skris OUT="OpenUNIX-8-gcc" 66889837Skris else 66989837Skris OUT="OpenUNIX-8" 67089837Skris fi 67189837Skris ;; 67259191Skris *-*-unixware7) OUT="unixware-7" ;; 67359191Skris *-*-UnixWare7) OUT="unixware-7" ;; 67459191Skris *-*-Unixware7) OUT="unixware-7" ;; 67576866Skris *-*-unixware20*) OUT="unixware-2.0" ;; 67676866Skris *-*-unixware21*) OUT="unixware-2.1" ;; 67776866Skris *-*-UnixWare20*) OUT="unixware-2.0" ;; 67876866Skris *-*-UnixWare21*) OUT="unixware-2.1" ;; 67976866Skris *-*-Unixware20*) OUT="unixware-2.0" ;; 68076866Skris *-*-Unixware21*) OUT="unixware-2.1" ;; 68155714Skris BS2000-siemens-sysv4) OUT="BS2000-OSD" ;; 68255714Skris RM*-siemens-sysv4) OUT="ReliantUNIX" ;; 68355714Skris *-siemens-sysv4) OUT="SINIX" ;; 684100936Snectar *-hpux1*) 685100936Snectar if [ $CC = "gcc" ]; 686100936Snectar then 687100936Snectar if [ $GCC_BITS = "64" ]; then 688100936Snectar OUT="hpux64-parisc-gcc" 689100936Snectar else 690100936Snectar OUT="hpux-parisc-gcc" 691100936Snectar fi 692100936Snectar else 693100936Snectar OUT="hpux-parisc-$CC" 694100936Snectar fi 695109998Smarkm KERNEL_BITS=`(getconf KERNEL_BITS) 2>/dev/null` 696109998Smarkm KERNEL_BITS=${KERNEL_BITS:-32} 697109998Smarkm CPU_VERSION=`(getconf CPU_VERSION) 2>/dev/null` 698109998Smarkm CPU_VERSION=${CPU_VERSION:-0} 699109998Smarkm # See <sys/unistd.h> for further info on CPU_VERSION. 700109998Smarkm if [ $CPU_VERSION -ge 768 ]; then # IA-64 CPU 701111147Snectar echo "WARNING! 64-bit ABI is the default configured ABI on HP-UXi." 702111147Snectar echo " If you wish to build 32-bit library, the you have to" 703111147Snectar echo " invoke './Configure hpux-ia32-cc' *manually*." 704109998Smarkm if [ "$TEST" = "false" ]; then 705111147Snectar echo " You have about 5 seconds to press Ctrl-C to abort." 706109998Smarkm (stty -icanon min 0 time 50; read waste) < /dev/tty 707109998Smarkm fi 708109998Smarkm OUT="hpux64-ia64-cc" 709109998Smarkm elif [ $CPU_VERSION -ge 532 ]; then # PA-RISC 2.x CPU 710109998Smarkm if [ "$CC" = "cc" ]; then 711109998Smarkm OUT="hpux-parisc2-cc" # can't we have hpux-parisc2-gcc? 712109998Smarkm fi 713109998Smarkm if [ $KERNEL_BITS -eq 64 -a "$CC" = "cc" ]; then 714109998Smarkm echo "WARNING! If you wish to build 64-bit library then you have to" 715109998Smarkm echo " invoke './Configure hpux64-parisc2-cc' *manually*." 716109998Smarkm if [ "$TEST" = "false" ]; then 717109998Smarkm echo " You have about 5 seconds to press Ctrl-C to abort." 718109998Smarkm (stty -icanon min 0 time 50; read waste) < /dev/tty 719109998Smarkm fi 720109998Smarkm fi 721109998Smarkm elif [ $CPU_VERSION -ge 528 ]; then # PA-RISC 1.1+ CPU 722109998Smarkm : 723109998Smarkm elif [ $CPU_VERSION -ge 523 ]; then # PA-RISC 1.0 CPU 724109998Smarkm : 725109998Smarkm else # Motorola(?) CPU 726109998Smarkm OUT="hpux-$CC" 727109998Smarkm fi 728100936Snectar options="$options -D_REENTRANT" ;; 72959191Skris *-hpux) OUT="hpux-parisc-$CC" ;; 73055714Skris # these are all covered by the catchall below 73155714Skris # *-aix) OUT="aix-$CC" ;; 73255714Skris # *-dgux) OUT="dgux" ;; 73368651Skris mips-sony-newsos4) OUT="newsos4-gcc" ;; 734100928Snectar *-*-cygwin_pre1.3) OUT="Cygwin-pre1.3" ;; 735100928Snectar *-*-cygwin) OUT="Cygwin" ;; 736100928Snectar t3e-cray-unicosmk) OUT="cray-t3e" ;; 737100928Snectar j90-cray-unicos) OUT="cray-j90" ;; 738109998Smarkm nsr-tandem-nsk) OUT="tandem-c89" ;; 73955714Skris *) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;; 74055714Skrisesac 74155714Skris 742109998Smarkm# NB: This atalla support has been superceded by the ENGINE support 743109998Smarkm# That contains its own header and definitions anyway. Support can 744109998Smarkm# be enabled or disabled on any supported platform without external 745109998Smarkm# headers, eg. by adding the "hw-atalla" switch to ./config or 746109998Smarkm# perl Configure 747109998Smarkm# 74859191Skris# See whether we can compile Atalla support 749109998Smarkm#if [ -f /usr/include/atasi.h ] 750109998Smarkm#then 751109998Smarkm# options="$options -DATALLA" 752109998Smarkm#fi 75359191Skris 75455714Skris# gcc < 2.8 does not support -mcpu=ultrasparc 75555714Skrisif [ "$OUT" = solaris-sparcv9-gcc -a $GCCVER -lt 28 ] 75655714Skristhen 75755714Skris echo "WARNING! Do consider upgrading to gcc-2.8 or later." 75855714Skris sleep 5 75955714Skris OUT=solaris-sparcv9-gcc27 76055714Skrisfi 76155714Skrisif [ "$OUT" = "linux-sparcv9" -a $GCCVER -lt 28 ] 76255714Skristhen 76355714Skris echo "WARNING! Falling down to 'linux-sparcv8'." 76455714Skris echo " Upgrade to gcc-2.8 or later." 76555714Skris sleep 5 76655714Skris OUT=linux-sparcv8 76755714Skrisfi 76855714Skris 76955714Skriscase "$GUESSOS" in 77055714Skris i386-*) options="$options 386" ;; 77155714Skrisesac 77255714Skris 773109998Smarkmfor i in bf cast des dh dsa ec hmac idea md2 md5 mdc2 rc2 rc4 rc5 aes ripemd rsa sha 77455714Skrisdo 77555714Skris if [ ! -d crypto/$i ] 77655714Skris then 77755714Skris options="$options no-$i" 77855714Skris fi 77955714Skrisdone 78055714Skris 781109998Smarkm# Discover Kerberos 5 (since it's still a prototype, we don't 782109998Smarkm# do any guesses yet, that's why this section is commented away. 783109998Smarkm#if [ -d /usr/kerberos ]; then 784109998Smarkm# krb5_dir=/usr/kerberos 785109998Smarkm# if [ \( -f $krb5_dir/lib/libgssapi_krb5.a -o -f $krb5_dir/lib/libgssapi_krb5.so* \)\ 786109998Smarkm# -a \( -f $krb5_dir/lib/libkrb5.a -o -f $krb5_dir/lib/libkrb5.so* \)\ 787109998Smarkm# -a \( -f $krb5_dir/lib/libcom_err.a -o -f $krb5_dir/lib/libcom_err.so* \)\ 788109998Smarkm# -a \( -f $krb5_dir/lib/libk5crypto.a -o -f $krb5_dir/lib/libk5crypto.so* \)\ 789109998Smarkm# -a \( -f $krb5_dir/include/krb5.h \) ]; then 790109998Smarkm# options="$options --with-krb5-flavor=MIT" 791109998Smarkm# fi 792109998Smarkm#elif [ -d /usr/heimdal ]; then 793109998Smarkm# krb5_dir=/usr/heimdal 794109998Smarkm# if [ \( -f $krb5_dir/lib/libgssapi.a -o -f $krb5_dir/lib/libgssapi.so* \)\ 795109998Smarkm# -a \( -f $krb5_dir/lib/libkrb5.a -o -f $krb5_dir/lib/libkrb5.so* \)\ 796109998Smarkm# -a \( -f $krb5_dir/lib/libcom_err.a -o -f $krb5_dir/lib/libcom_err.so* \)\ 797109998Smarkm# -a \( -f $krb5_dir/include/krb5.h \) ]; then 798109998Smarkm# options="$options --with-krb5-flavor=Heimdal" 799109998Smarkm# fi 800109998Smarkm#fi 801109998Smarkm 80255714Skrisif [ -z "$OUT" ]; then 80355714Skris OUT="$CC" 80455714Skrisfi 80555714Skris 80655714Skrisif [ ".$PERL" = . ] ; then 80755714Skris for i in . `echo $PATH | sed 's/:/ /g'`; do 80855714Skris if [ -f "$i/perl5" ] ; then 80955714Skris PERL="$i/perl5" 81055714Skris break; 81155714Skris fi; 81255714Skris done 81355714Skrisfi 81455714Skris 81555714Skrisif [ ".$PERL" = . ] ; then 81655714Skris for i in . `echo $PATH | sed 's/:/ /g'`; do 81755714Skris if [ -f "$i/perl" ] ; then 81855714Skris if "$i/perl" -e 'exit($]<5.0)'; then 81955714Skris PERL="$i/perl" 82055714Skris break; 82155714Skris fi; 82255714Skris fi; 82355714Skris done 82455714Skrisfi 82555714Skris 82655714Skrisif [ ".$PERL" = . ] ; then 82755714Skris echo "You need Perl 5." 82855714Skris exit 1 82955714Skrisfi 83055714Skris 83155714Skris# run Configure to check to see if we need to specify the 83255714Skris# compiler for the platform ... in which case we add it on 83355714Skris# the end ... otherwise we leave it off 83455714Skris 83559191Skris$PERL ./Configure LIST | grep "$OUT-$CC" > /dev/null 83655714Skrisif [ $? = "0" ]; then 83755714Skris OUT="$OUT-$CC" 83855714Skrisfi 83955714Skris 84055714SkrisOUT="$PREFIX$OUT" 84155714Skris 84259191Skris$PERL ./Configure LIST | grep "$OUT" > /dev/null 84355714Skrisif [ $? = "0" ]; then 84472613Skris echo Configuring for $OUT 84555714Skris 84655714Skris if [ "$TEST" = "true" ]; then 84755714Skris echo $PERL ./Configure $OUT $options 84855714Skris else 84955714Skris $PERL ./Configure $OUT $options 85055714Skris fi 85155714Skriselse 85255714Skris echo "This system ($OUT) is not supported. See file INSTALL for details." 85355714Skrisfi 85455714Skris) 855