config 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855
  1. #!/bin/sh
  2. #
  3. # OpenSSL config: determine the operating system and run ./Configure
  4. #
  5. # "config -h" for usage information.
  6. #
  7. # this is a merge of minarch and GuessOS from the Apache Group.
  8. # Originally written by Tim Hudson <tjh@cryptsoft.com>.
  9. # Original Apache Group comments on GuessOS
  10. # Simple OS/Platform guesser. Similar to config.guess but
  11. # much, much smaller. Since it was developed for use with
  12. # Apache, it follows under Apache's regular licensing
  13. # with one specific addition: Any changes or additions
  14. # to this script should be Emailed to the Apache
  15. # group (apache@apache.org) in general and to
  16. # Jim Jagielski (jim@jaguNET.com) in specific.
  17. #
  18. # Be as similar to the output of config.guess/config.sub
  19. # as possible.
  20. PREFIX=""
  21. SUFFIX=""
  22. TEST="false"
  23. # pick up any command line args to config
  24. for i
  25. do
  26. case "$i" in
  27. -d*) PREFIX="debug-";;
  28. -t*) TEST="true";;
  29. -h*) TEST="true"; cat <<EOF
  30. Usage: config [options]
  31. -d Add a debug- prefix to machine choice.
  32. -t Test mode, do not run the Configure perl script.
  33. -h This help.
  34. Any other text will be passed to the Configure perl script.
  35. See INSTALL for instructions.
  36. EOF
  37. ;;
  38. *) options=$options" $i" ;;
  39. esac
  40. done
  41. # First get uname entries that we use below
  42. MACHINE=`(uname -m) 2>/dev/null` || MACHINE="unknown"
  43. RELEASE=`(uname -r) 2>/dev/null` || RELEASE="unknown"
  44. SYSTEM=`(uname -s) 2>/dev/null` || SYSTEM="unknown"
  45. VERSION=`(uname -v) 2>/dev/null` || VERSION="unknown"
  46. # Now test for ISC and SCO, since it is has a braindamaged uname.
  47. #
  48. # We need to work around FreeBSD 1.1.5.1
  49. (
  50. XREL=`uname -X 2>/dev/null | grep "^Release" | awk '{print $3}'`
  51. if [ "x$XREL" != "x" ]; then
  52. if [ -f /etc/kconfig ]; then
  53. case "$XREL" in
  54. 4.0|4.1)
  55. echo "${MACHINE}-whatever-isc4"; exit 0
  56. ;;
  57. esac
  58. else
  59. case "$XREL" in
  60. 3.2v4.2)
  61. echo "whatever-whatever-sco3"; exit 0
  62. ;;
  63. 3.2v5.0*)
  64. echo "whatever-whatever-sco5"; exit 0
  65. ;;
  66. 4.2MP)
  67. case "x${VERSION}" in
  68. x2.0*) echo "whatever-whatever-unixware20"; exit 0 ;;
  69. x2.1*) echo "whatever-whatever-unixware21"; exit 0 ;;
  70. x2*) echo "whatever-whatever-unixware2"; exit 0 ;;
  71. esac
  72. ;;
  73. 4.2)
  74. echo "i386-whatever-unixware1"; exit 0
  75. ;;
  76. 5)
  77. case "x${VERSION}" in
  78. # We hardcode i586 in place of ${MACHINE} for the
  79. # following reason. The catch is that even though Pentium
  80. # is minimum requirement for platforms in question,
  81. # ${MACHINE} gets always assigned to i386. Now, problem
  82. # with i386 is that it makes ./config pass 386 to
  83. # ./Configure, which in turn makes make generate
  84. # inefficient SHA-1 (for this moment) code.
  85. x7*) echo "i586-sco-unixware7"; exit 0 ;;
  86. x8*) echo "i586-unkn-OpenUNIX${VERSION}"; exit 0 ;;
  87. esac
  88. ;;
  89. esac
  90. fi
  91. fi
  92. # Now we simply scan though... In most cases, the SYSTEM info is enough
  93. #
  94. case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
  95. MPE/iX:*)
  96. MACHINE=`echo "$MACHINE" | sed -e 's/-/_/g'`
  97. echo "parisc-hp-MPE/iX"; exit 0
  98. ;;
  99. A/UX:*)
  100. echo "m68k-apple-aux3"; exit 0
  101. ;;
  102. AIX:[3456789]:4:*)
  103. echo "${MACHINE}-ibm-aix43"; exit 0
  104. ;;
  105. AIX:*:[56789]:*)
  106. echo "${MACHINE}-ibm-aix43"; exit 0
  107. ;;
  108. AIX:*)
  109. echo "${MACHINE}-ibm-aix"; exit 0
  110. ;;
  111. dgux:*)
  112. echo "${MACHINE}-dg-dgux"; exit 0
  113. ;;
  114. HI-UX:*)
  115. echo "${MACHINE}-hi-hiux"; exit 0
  116. ;;
  117. HP-UX:*)
  118. HPUXVER=`echo ${RELEASE}|sed -e 's/[^.]*.[0B]*//'`
  119. case "$HPUXVER" in
  120. 1[0-9].*) # HPUX 10 and 11 targets are unified
  121. echo "${MACHINE}-hp-hpux1x"; exit 0
  122. ;;
  123. *)
  124. echo "${MACHINE}-hp-hpux"; exit 0
  125. ;;
  126. esac
  127. ;;
  128. IRIX:5.*)
  129. echo "mips2-sgi-irix"; exit 0
  130. ;;
  131. IRIX:6.*)
  132. echo "mips3-sgi-irix"; exit 0
  133. ;;
  134. IRIX64:*)
  135. echo "mips4-sgi-irix64"; exit 0
  136. ;;
  137. Linux:[2-9].*)
  138. echo "${MACHINE}-whatever-linux2"; exit 0
  139. ;;
  140. Linux:1.*)
  141. echo "${MACHINE}-whatever-linux1"; exit 0
  142. ;;
  143. GNU*)
  144. echo "hurd-x86"; exit 0;
  145. ;;
  146. LynxOS:*)
  147. echo "${MACHINE}-lynx-lynxos"; exit 0
  148. ;;
  149. BSD/OS:4.*) # BSD/OS always says 386
  150. echo "i486-whatever-bsdi4"; exit 0
  151. ;;
  152. BSD/386:*:*:*486*|BSD/OS:*:*:*:*486*)
  153. case `/sbin/sysctl -n hw.model` in
  154. Pentium*)
  155. echo "i586-whatever-bsdi"; exit 0
  156. ;;
  157. *)
  158. echo "i386-whatever-bsdi"; exit 0
  159. ;;
  160. esac;
  161. ;;
  162. BSD/386:*|BSD/OS:*)
  163. echo "${MACHINE}-whatever-bsdi"; exit 0
  164. ;;
  165. FreeBSD:*:*:*386*)
  166. VERS=`echo ${RELEASE} | sed -e 's/[-(].*//'`
  167. MACH=`sysctl -n hw.model`
  168. ARCH='whatever'
  169. case ${MACH} in
  170. *386* ) MACH="i386" ;;
  171. *486* ) MACH="i486" ;;
  172. Pentium\ II*) MACH="i686" ;;
  173. Pentium* ) MACH="i586" ;;
  174. * ) MACH="$MACHINE" ;;
  175. esac
  176. case ${MACH} in
  177. i[0-9]86 ) ARCH="pc" ;;
  178. esac
  179. echo "${MACH}-${ARCH}-freebsd${VERS}"; exit 0
  180. ;;
  181. FreeBSD:*)
  182. echo "${MACHINE}-whatever-freebsd"; exit 0
  183. ;;
  184. NetBSD:*:*:*386*)
  185. echo "`(/usr/sbin/sysctl -n hw.model || /sbin/sysctl -n hw.model) | sed 's,.*\(.\)86-class.*,i\186,'`-whatever-netbsd"; exit 0
  186. ;;
  187. NetBSD:*)
  188. echo "${MACHINE}-whatever-netbsd"; exit 0
  189. ;;
  190. OpenBSD:*)
  191. echo "${MACHINE}-whatever-openbsd"; exit 0
  192. ;;
  193. OpenUNIX:*)
  194. echo "${MACHINE}-unknown-OpenUNIX${VERSION}"; exit 0
  195. ;;
  196. OSF1:*:*:*alpha*)
  197. OSFMAJOR=`echo ${RELEASE}| sed -e 's/^V\([0-9]*\)\..*$/\1/'`
  198. case "$OSFMAJOR" in
  199. 4|5)
  200. echo "${MACHINE}-dec-tru64"; exit 0
  201. ;;
  202. 1|2|3)
  203. echo "${MACHINE}-dec-osf"; exit 0
  204. ;;
  205. *)
  206. echo "${MACHINE}-dec-osf"; exit 0
  207. ;;
  208. esac
  209. ;;
  210. QNX:*)
  211. case "$RELEASE" in
  212. 4*)
  213. echo "${MACHINE}-whatever-qnx4"
  214. ;;
  215. 6*)
  216. echo "${MACHINE}-whatever-qnx6"
  217. ;;
  218. *)
  219. echo "${MACHINE}-whatever-qnx"
  220. ;;
  221. esac
  222. exit 0
  223. ;;
  224. Paragon*:*:*:*)
  225. echo "i860-intel-osf1"; exit 0
  226. ;;
  227. Rhapsody:*)
  228. echo "ppc-apple-rhapsody"; exit 0
  229. ;;
  230. Darwin:*)
  231. case "$MACHINE" in
  232. Power*)
  233. echo "ppc-apple-darwin${VERSION}"
  234. ;;
  235. *)
  236. echo "i386-apple-darwin${VERSION}"
  237. ;;
  238. esac
  239. exit 0
  240. ;;
  241. SunOS:5.*)
  242. echo "${MACHINE}-whatever-solaris2"; exit 0
  243. ;;
  244. SunOS:*)
  245. echo "${MACHINE}-sun-sunos4"; exit 0
  246. ;;
  247. UNIX_System_V:4.*:*)
  248. echo "${MACHINE}-whatever-sysv4"; exit 0
  249. ;;
  250. *:4*:R4*:m88k)
  251. echo "${MACHINE}-whatever-sysv4"; exit 0
  252. ;;
  253. DYNIX/ptx:4*:*)
  254. echo "${MACHINE}-whatever-sysv4"; exit 0
  255. ;;
  256. *:4.0:3.0:3[34]?? | *:4.0:3.0:3[34]??,*)
  257. echo "i486-ncr-sysv4"; exit 0
  258. ;;
  259. ULTRIX:*)
  260. echo "${MACHINE}-unknown-ultrix"; exit 0
  261. ;;
  262. SINIX*|ReliantUNIX*)
  263. echo "${MACHINE}-siemens-sysv4"; exit 0
  264. ;;
  265. POSIX-BC*)
  266. echo "${MACHINE}-siemens-sysv4"; exit 0 # Here, $MACHINE == "BS2000"
  267. ;;
  268. machten:*)
  269. echo "${MACHINE}-tenon-${SYSTEM}"; exit 0;
  270. ;;
  271. library:*)
  272. echo "${MACHINE}-ncr-sysv4"; exit 0
  273. ;;
  274. ConvexOS:*:11.0:*)
  275. echo "${MACHINE}-v11-${SYSTEM}"; exit 0;
  276. ;;
  277. NEWS-OS:4.*)
  278. echo "mips-sony-newsos4"; exit 0;
  279. ;;
  280. CYGWIN*)
  281. case "$RELEASE" in
  282. [bB]*|1.0|1.[12].*)
  283. echo "${MACHINE}-whatever-cygwin_pre1.3"
  284. ;;
  285. *)
  286. echo "${MACHINE}-whatever-cygwin"
  287. ;;
  288. esac
  289. exit 0
  290. ;;
  291. *"CRAY T3E")
  292. echo "t3e-cray-unicosmk"; exit 0;
  293. ;;
  294. *CRAY*)
  295. echo "j90-cray-unicos"; exit 0;
  296. ;;
  297. NONSTOP_KERNEL*)
  298. echo "nsr-tandem-nsk"; exit 0;
  299. ;;
  300. esac
  301. #
  302. # Ugg. These are all we can determine by what we know about
  303. # the output of uname. Be more creative:
  304. #
  305. # Do the Apollo stuff first. Here, we just simply assume
  306. # that the existance of the /usr/apollo directory is proof
  307. # enough
  308. if [ -d /usr/apollo ]; then
  309. echo "whatever-apollo-whatever"
  310. exit 0
  311. fi
  312. # Now NeXT
  313. ISNEXT=`hostinfo 2>/dev/null`
  314. case "$ISNEXT" in
  315. *'NeXT Mach 3.3'*)
  316. echo "whatever-next-nextstep3.3"; exit 0
  317. ;;
  318. *NeXT*)
  319. echo "whatever-next-nextstep"; exit 0
  320. ;;
  321. esac
  322. # At this point we gone through all the one's
  323. # we know of: Punt
  324. echo "${MACHINE}-whatever-${SYSTEM}"
  325. exit 0
  326. ) 2>/dev/null | (
  327. # ---------------------------------------------------------------------------
  328. # this is where the translation occurs into SSLeay terms
  329. # ---------------------------------------------------------------------------
  330. # figure out if gcc is available and if so we use it otherwise
  331. # we fallback to whatever cc does on the system
  332. GCCVER=`(gcc -dumpversion) 2>/dev/null`
  333. if [ "$GCCVER" != "" ]; then
  334. CC=gcc
  335. # then strip off whatever prefix egcs prepends the number with...
  336. # Hopefully, this will work for any future prefixes as well.
  337. GCCVER=`echo $GCCVER | sed 's/^[a-zA-Z]*\-//'`
  338. # Since gcc 3.1 gcc --version behaviour has changed. gcc -dumpversion
  339. # does give us what we want though, so we use that. We just just the
  340. # major and minor version numbers.
  341. # peak single digit before and after first dot, e.g. 2.95.1 gives 29
  342. GCCVER=`echo $GCCVER | sed 's/\([0-9]\)\.\([0-9]\).*/\1\2/'`
  343. else
  344. CC=cc
  345. fi
  346. GCCVER=${GCCVER:-0}
  347. if [ "$SYSTEM" = "HP-UX" ];then
  348. # By default gcc is a ILP32 compiler (with long long == 64).
  349. GCC_BITS="32"
  350. if [ $GCCVER -ge 30 ]; then
  351. # PA64 support only came in with gcc 3.0.x.
  352. # We check if the preprocessor symbol __LP64__ is defined...
  353. if echo "__LP64__" | gcc -v -E -x c - 2>/dev/null | grep "^__LP64__" 2>&1 > /dev/null; then
  354. : # __LP64__ has slipped through, it therefore is not defined
  355. else
  356. GCC_BITS="64"
  357. fi
  358. fi
  359. fi
  360. if [ "$SYSTEM" = "SunOS" ]; then
  361. if [ $GCCVER -ge 30 ]; then
  362. # 64-bit ABI isn't officially supported in gcc 3.0, but it appears
  363. # to be working, at the very least 'make test' passes...
  364. if gcc -v -E -x c /dev/null 2>&1 | grep __arch64__ > /dev/null; then
  365. GCC_ARCH="-m64"
  366. else
  367. GCC_ARCH="-m32"
  368. fi
  369. fi
  370. # check for WorkShop C, expected output is "cc: blah-blah C x.x"
  371. CCVER=`(cc -V 2>&1) 2>/dev/null | \
  372. egrep -e '^cc: .* C [0-9]\.[0-9]' | \
  373. sed 's/.* C \([0-9]\)\.\([0-9]\).*/\1\2/'`
  374. CCVER=${CCVER:-0}
  375. if [ $CCVER -gt 40 ]; then
  376. CC=cc # overrides gcc!!!
  377. if [ $CCVER -eq 50 ]; then
  378. echo "WARNING! Detected WorkShop C 5.0. Do make sure you have"
  379. echo " patch #107357-01 or later applied."
  380. sleep 5
  381. fi
  382. elif [ "$CC" = "cc" -a $CCVER -gt 0 ]; then
  383. CC=sc3
  384. fi
  385. fi
  386. if [ "${SYSTEM}-${MACHINE}" = "Linux-alpha" ]; then
  387. # check for Compaq C, expected output is "blah-blah C Vx.x"
  388. CCCVER=`(ccc -V 2>&1) 2>/dev/null | \
  389. egrep -e '.* C V[0-9]\.[0-9]' | \
  390. sed 's/.* C V\([0-9]\)\.\([0-9]\).*/\1\2/'`
  391. CCCVER=${CCCVER:-0}
  392. if [ $CCCVER -gt 60 ]; then
  393. CC=ccc # overrides gcc!!! well, ccc outperforms inoticeably
  394. # only on hash routines and des, otherwise gcc (2.95)
  395. # keeps along rather tight...
  396. fi
  397. fi
  398. if [ "${SYSTEM}" = "AIX" ]; then # favor vendor cc over gcc
  399. (cc) 2>&1 | grep -iv "not found" > /dev/null && CC=cc
  400. fi
  401. CCVER=${CCVER:-0}
  402. # read the output of the embedded GuessOS
  403. read GUESSOS
  404. echo Operating system: $GUESSOS
  405. # now map the output into SSLeay terms ... really should hack into the
  406. # script above so we end up with values in vars but that would take
  407. # more time that I want to waste at the moment
  408. case "$GUESSOS" in
  409. mips2-sgi-irix)
  410. CPU=`(hinv -t cpu) 2>/dev/null | head -1 | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'`
  411. CPU=${CPU:-0}
  412. if [ $CPU -ge 4000 ]; then
  413. options="$options -mips2"
  414. fi
  415. OUT="irix-$CC"
  416. ;;
  417. mips3-sgi-irix)
  418. CPU=`(hinv -t cpu) 2>/dev/null | head -1 | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'`
  419. CPU=${CPU:-0}
  420. if [ $CPU -ge 5000 ]; then
  421. options="$options -mips4"
  422. else
  423. options="$options -mips3"
  424. fi
  425. OUT="irix-mips3-$CC"
  426. ;;
  427. mips4-sgi-irix64)
  428. echo "WARNING! If you wish to build 64-bit library, then you have to"
  429. echo " invoke './Configure irix64-mips4-$CC' *manually*."
  430. if [ "$TEST" = "false" ]; then
  431. echo " You have about 5 seconds to press Ctrl-C to abort."
  432. (stty -icanon min 0 time 50; read waste) < /dev/tty
  433. fi
  434. CPU=`(hinv -t cpu) 2>/dev/null | head -1 | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'`
  435. CPU=${CPU:-0}
  436. if [ $CPU -ge 5000 ]; then
  437. options="$options -mips4"
  438. else
  439. options="$options -mips3"
  440. fi
  441. OUT="irix-mips3-$CC"
  442. ;;
  443. alpha-*-linux2)
  444. ISA=`awk '/cpu model/{print$4}' /proc/cpuinfo`
  445. case ${ISA:-generic} in
  446. *[67]) OUT="linux-alpha+bwx-$CC" ;;
  447. *) OUT="linux-alpha-$CC" ;;
  448. esac
  449. if [ "$CC" = "gcc" ]; then
  450. case ${ISA:-generic} in
  451. EV5|EV45) options="$options -mcpu=ev5";;
  452. EV56|PCA56) options="$options -mcpu=ev56";;
  453. EV6|EV67|PCA57) options="$options -mcpu=ev6";;
  454. esac
  455. fi
  456. ;;
  457. mips-*-linux?)
  458. cat >dummy.c <<EOF
  459. #include <stdio.h> /* for printf() prototype */
  460. int main (argc, argv) int argc; char *argv[]; {
  461. #ifdef __MIPSEB__
  462. printf ("linux-%s\n", argv[1]);
  463. #endif
  464. #ifdef __MIPSEL__
  465. printf ("linux-%sel\n", argv[1]);
  466. #endif
  467. return 0;
  468. }
  469. EOF
  470. ${CC} -o dummy dummy.c && OUT=`./dummy ${MACHINE}`
  471. rm dummy dummy.c
  472. ;;
  473. ppc64-*-linux2)
  474. #Use the standard target for PPC architecture until we create a
  475. #special one for the 64bit architecture.
  476. OUT="linux-ppc" ;;
  477. ppc-*-linux2) OUT="linux-ppc" ;;
  478. m68k-*-linux*) OUT="linux-m68k" ;;
  479. ia64-*-linux?) OUT="linux-ia64" ;;
  480. ppc-apple-rhapsody) OUT="rhapsody-ppc-cc" ;;
  481. ppc-apple-darwin*) OUT="darwin-ppc-cc" ;;
  482. i386-apple-darwin*) OUT="darwin-i386-cc" ;;
  483. sparc64-*-linux2)
  484. echo "WARNING! If you *know* that your GNU C supports 64-bit/V9 ABI"
  485. echo " and wish to build 64-bit library, then you have to"
  486. echo " invoke './Configure linux64-sparcv9' *manually*."
  487. if [ "$TEST" = "false" ]; then
  488. echo " You have about 5 seconds to press Ctrl-C to abort."
  489. (stty -icanon min 0 time 50; read waste) < /dev/tty
  490. fi
  491. OUT="linux-sparcv9" ;;
  492. sparc-*-linux2)
  493. KARCH=`awk '/^type/{print$3}' /proc/cpuinfo`
  494. case ${KARCH:-sun4} in
  495. sun4u*) OUT="linux-sparcv9" ;;
  496. sun4m) OUT="linux-sparcv8" ;;
  497. sun4d) OUT="linux-sparcv8" ;;
  498. *) OUT="linux-sparcv7" ;;
  499. esac ;;
  500. parisc-*-linux2)
  501. CPUARCH=`awk '/cpu family/{print substr($5,1,3)}' /proc/cpuinfo`
  502. CPUSCHEDULE=`awk '/^cpu.[ ]: PA/{print substr($3,3)}' /proc/cpuinfo`
  503. # ??TODO ?? Model transformations
  504. # 0. CPU Architecture for the 1.1 processor has letter suffixes. We strip that off
  505. # assuming no further arch. identification will ever be used by GCC.
  506. # 1. I'm most concerned about whether is a 7300LC is closer to a 7100 versus a 7100LC.
  507. # 2. The variant 64-bit processors cause concern should GCC support explicit schedulers
  508. # for these chips in the future.
  509. # PA7300LC -> 7100LC (1.1)
  510. # PA8200 -> 8000 (2.0)
  511. # PA8500 -> 8000 (2.0)
  512. # PA8600 -> 8000 (2.0)
  513. CPUSCHEDULE=`echo $CPUSCHEDULE|sed -e 's/7300LC/7100LC/' -e 's/8?00/8000/'`
  514. # Finish Model transformations
  515. options="$options -mschedule=$CPUSCHEDULE -march=$CPUARCH"
  516. OUT="linux-parisc" ;;
  517. arm*-*-linux2) OUT="linux-elf-arm" ;;
  518. s390-*-linux2) OUT="linux-s390" ;;
  519. s390x-*-linux?) OUT="linux-s390x" ;;
  520. x86_64-*-linux?) OUT="linux-x86_64" ;;
  521. *-*-linux2) OUT="linux-elf"
  522. if [ "$GCCVER" -gt 28 ]; then
  523. if grep '^model.*Pentium' /proc/cpuinfo >/dev/null ; then
  524. OUT="linux-pentium"
  525. fi
  526. if grep '^model.*Pentium Pro' /proc/cpuinfo >/dev/null ; then
  527. OUT="linux-ppro"
  528. fi
  529. if grep '^model.*K6' /proc/cpuinfo >/dev/null ; then
  530. OUT="linux-k6"
  531. fi
  532. fi ;;
  533. *-*-linux1) OUT="linux-aout" ;;
  534. sun4u*-*-solaris2)
  535. OUT="solaris-sparcv9-$CC"
  536. ISA64=`(isalist) 2>/dev/null | grep sparcv9`
  537. if [ "$ISA64" != "" ]; then
  538. if [ "$CC" = "cc" -a $CCVER -ge 50 ]; then
  539. echo "WARNING! If you wish to build 64-bit library, then you have to"
  540. echo " invoke './Configure solaris64-sparcv9-cc' *manually*."
  541. if [ "$TEST" = "false" ]; then
  542. echo " You have about 5 seconds to press Ctrl-C to abort."
  543. (stty -icanon min 0 time 50; read waste) < /dev/tty
  544. fi
  545. elif [ "$CC" = "gcc" -a "$GCC_ARCH" = "-m64" ]; then
  546. # $GCC_ARCH denotes default ABI chosen by compiler driver
  547. # (first one found on the $PATH). I assume that user
  548. # expects certain consistency with the rest of his builds
  549. # and therefore switch over to 64-bit. <appro>
  550. OUT="solaris64-sparcv9-gcc"
  551. echo "WARNING! If you wish to build 32-bit library, then you have to"
  552. echo " invoke './Configure solaris-sparcv9-gcc' *manually*."
  553. if [ "$TEST" = "false" ]; then
  554. echo " You have about 5 seconds to press Ctrl-C to abort."
  555. (stty -icanon min 0 time 50; read waste) < /dev/tty
  556. fi
  557. elif [ "$GCC_ARCH" = "-m32" ]; then
  558. echo "NOTICE! If you *know* that your GNU C supports 64-bit/V9 ABI"
  559. echo " and wish to build 64-bit library, then you have to"
  560. echo " invoke './Configure solaris64-sparcv9-gcc' *manually*."
  561. if [ "$TEST" = "false" ]; then
  562. echo " You have about 5 seconds to press Ctrl-C to abort."
  563. (stty -icanon min 0 time 50; read waste) < /dev/tty
  564. fi
  565. fi
  566. fi
  567. ;;
  568. sun4m-*-solaris2) OUT="solaris-sparcv8-$CC" ;;
  569. sun4d-*-solaris2) OUT="solaris-sparcv8-$CC" ;;
  570. sun4*-*-solaris2) OUT="solaris-sparcv7-$CC" ;;
  571. *86*-*-solaris2) OUT="solaris-x86-$CC" ;;
  572. *-*-sunos4) OUT="sunos-$CC" ;;
  573. alpha*-*-freebsd*) OUT="FreeBSD-alpha" ;;
  574. sparc64-*-freebsd*) OUT="FreeBSD-sparc64" ;;
  575. ia64-*-freebsd*) OUT="FreeBSD-ia64" ;;
  576. *-freebsd[3-9]*) OUT="FreeBSD-elf" ;;
  577. *-freebsd[1-2]*) OUT="FreeBSD" ;;
  578. *86*-*-netbsd) OUT="NetBSD-x86" ;;
  579. sun3*-*-netbsd) OUT="NetBSD-m68" ;;
  580. *-*-netbsd) OUT="NetBSD-sparc" ;;
  581. alpha*-*-openbsd) OUT="OpenBSD-alpha" ;;
  582. *86*-*-openbsd) OUT="OpenBSD-i386" ;;
  583. m68k*-*-openbsd) OUT="OpenBSD-m68k" ;;
  584. m88k*-*-openbsd) OUT="OpenBSD-m88k" ;;
  585. mips*-*-openbsd) OUT="OpenBSD-mips" ;;
  586. pmax*-*-openbsd) OUT="OpenBSD-mips" ;;
  587. powerpc*-*-openbsd) OUT="OpenBSD-powerpc" ;;
  588. sparc64*-*-openbsd) OUT="OpenBSD-sparc64" ;;
  589. sparc*-*-openbsd) OUT="OpenBSD-sparc" ;;
  590. vax*-*-openbsd) OUT="OpenBSD-vax" ;;
  591. hppa*-*-openbsd) OUT="OpenBSD-hppa" ;;
  592. *-*-openbsd) OUT="OpenBSD" ;;
  593. *86*-*-bsdi4) OUT="bsdi-elf-gcc" ;;
  594. *-*-osf) OUT="alphaold-cc" ;;
  595. *-*-tru64) OUT="alpha-cc" ;;
  596. *-*-OpenUNIX*)
  597. if [ "$CC" = "gcc" ]; then
  598. OUT="OpenUNIX-8-gcc"
  599. else
  600. OUT="OpenUNIX-8"
  601. fi
  602. ;;
  603. *-*-unixware7) OUT="unixware-7" ;;
  604. *-*-UnixWare7) OUT="unixware-7" ;;
  605. *-*-Unixware7) OUT="unixware-7" ;;
  606. *-*-unixware20*) OUT="unixware-2.0" ;;
  607. *-*-unixware21*) OUT="unixware-2.1" ;;
  608. *-*-UnixWare20*) OUT="unixware-2.0" ;;
  609. *-*-UnixWare21*) OUT="unixware-2.1" ;;
  610. *-*-Unixware20*) OUT="unixware-2.0" ;;
  611. *-*-Unixware21*) OUT="unixware-2.1" ;;
  612. BS2000-siemens-sysv4) OUT="BS2000-OSD" ;;
  613. RM*-siemens-sysv4) OUT="ReliantUNIX" ;;
  614. *-siemens-sysv4) OUT="SINIX" ;;
  615. *-hpux1*)
  616. if [ $CC = "gcc" ];
  617. then
  618. if [ $GCC_BITS = "64" ]; then
  619. OUT="hpux64-parisc2-gcc"
  620. else
  621. OUT="hpux-parisc-gcc"
  622. fi
  623. else
  624. OUT="hpux-parisc-$CC"
  625. fi
  626. KERNEL_BITS=`(getconf KERNEL_BITS) 2>/dev/null`
  627. KERNEL_BITS=${KERNEL_BITS:-32}
  628. CPU_VERSION=`(getconf CPU_VERSION) 2>/dev/null`
  629. CPU_VERSION=${CPU_VERSION:-0}
  630. # See <sys/unistd.h> for further info on CPU_VERSION.
  631. if [ $CPU_VERSION -ge 768 ]; then # IA-64 CPU
  632. echo "WARNING! 64-bit ABI is the default configured ABI on HP-UXi."
  633. echo " If you wish to build 32-bit library, the you have to"
  634. echo " invoke './Configure hpux-ia64-cc' *manually*."
  635. if [ "$TEST" = "false" ]; then
  636. echo " You have about 5 seconds to press Ctrl-C to abort."
  637. (stty -icanon min 0 time 50; read waste) < /dev/tty
  638. fi
  639. OUT="hpux64-ia64-cc"
  640. elif [ $CPU_VERSION -ge 532 ]; then # PA-RISC 2.x CPU
  641. if [ "$CC" = "cc" ]; then
  642. OUT="hpux-parisc2-cc" # can't we have hpux-parisc2-gcc?
  643. fi
  644. if [ $KERNEL_BITS -eq 64 -a "$CC" = "cc" ]; then
  645. echo "WARNING! If you wish to build 64-bit library then you have to"
  646. echo " invoke './Configure hpux64-parisc2-cc' *manually*."
  647. if [ "$TEST" = "false" ]; then
  648. echo " You have about 5 seconds to press Ctrl-C to abort."
  649. (stty -icanon min 0 time 50; read waste) < /dev/tty
  650. fi
  651. fi
  652. elif [ $CPU_VERSION -ge 528 ]; then # PA-RISC 1.1+ CPU
  653. :
  654. elif [ $CPU_VERSION -ge 523 ]; then # PA-RISC 1.0 CPU
  655. :
  656. else # Motorola(?) CPU
  657. OUT="hpux-$CC"
  658. fi
  659. options="$options -D_REENTRANT" ;;
  660. *-hpux) OUT="hpux-parisc-$CC" ;;
  661. # these are all covered by the catchall below
  662. # *-aix) OUT="aix-$CC" ;;
  663. # *-dgux) OUT="dgux" ;;
  664. mips-sony-newsos4) OUT="newsos4-gcc" ;;
  665. *-*-cygwin_pre1.3) OUT="Cygwin-pre1.3" ;;
  666. *-*-cygwin) OUT="Cygwin" ;;
  667. t3e-cray-unicosmk) OUT="cray-t3e" ;;
  668. j90-cray-unicos) OUT="cray-j90" ;;
  669. nsr-tandem-nsk) OUT="tandem-c89" ;;
  670. *) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
  671. esac
  672. # NB: This atalla support has been superceded by the ENGINE support
  673. # That contains its own header and definitions anyway. Support can
  674. # be enabled or disabled on any supported platform without external
  675. # headers, eg. by adding the "hw-atalla" switch to ./config or
  676. # perl Configure
  677. #
  678. # See whether we can compile Atalla support
  679. #if [ -f /usr/include/atasi.h ]
  680. #then
  681. # options="$options -DATALLA"
  682. #fi
  683. # gcc < 2.8 does not support -mcpu=ultrasparc
  684. if [ "$OUT" = solaris-sparcv9-gcc -a $GCCVER -lt 28 ]
  685. then
  686. echo "WARNING! Do consider upgrading to gcc-2.8 or later."
  687. sleep 5
  688. OUT=solaris-sparcv9-gcc27
  689. fi
  690. if [ "$OUT" = "linux-sparcv9" -a $GCCVER -lt 28 ]
  691. then
  692. echo "WARNING! Falling down to 'linux-sparcv8'."
  693. echo " Upgrade to gcc-2.8 or later."
  694. sleep 5
  695. OUT=linux-sparcv8
  696. fi
  697. case "$GUESSOS" in
  698. i386-*) options="$options 386" ;;
  699. esac
  700. for i in bf cast des dh dsa ec hmac idea md2 md5 mdc2 rc2 rc4 rc5 aes ripemd rsa sha
  701. do
  702. if [ ! -d crypto/$i ]
  703. then
  704. options="$options no-$i"
  705. fi
  706. done
  707. # Discover Kerberos 5 (since it's still a prototype, we don't
  708. # do any guesses yet, that's why this section is commented away.
  709. #if [ -d /usr/kerberos ]; then
  710. # krb5_dir=/usr/kerberos
  711. # if [ \( -f $krb5_dir/lib/libgssapi_krb5.a -o -f $krb5_dir/lib/libgssapi_krb5.so* \)\
  712. # -a \( -f $krb5_dir/lib/libkrb5.a -o -f $krb5_dir/lib/libkrb5.so* \)\
  713. # -a \( -f $krb5_dir/lib/libcom_err.a -o -f $krb5_dir/lib/libcom_err.so* \)\
  714. # -a \( -f $krb5_dir/lib/libk5crypto.a -o -f $krb5_dir/lib/libk5crypto.so* \)\
  715. # -a \( -f $krb5_dir/include/krb5.h \) ]; then
  716. # options="$options --with-krb5-flavor=MIT"
  717. # fi
  718. #elif [ -d /usr/heimdal ]; then
  719. # krb5_dir=/usr/heimdal
  720. # if [ \( -f $krb5_dir/lib/libgssapi.a -o -f $krb5_dir/lib/libgssapi.so* \)\
  721. # -a \( -f $krb5_dir/lib/libkrb5.a -o -f $krb5_dir/lib/libkrb5.so* \)\
  722. # -a \( -f $krb5_dir/lib/libcom_err.a -o -f $krb5_dir/lib/libcom_err.so* \)\
  723. # -a \( -f $krb5_dir/include/krb5.h \) ]; then
  724. # options="$options --with-krb5-flavor=Heimdal"
  725. # fi
  726. #fi
  727. if [ -z "$OUT" ]; then
  728. OUT="$CC"
  729. fi
  730. if [ ".$PERL" = . ] ; then
  731. for i in . `echo $PATH | sed 's/:/ /g'`; do
  732. if [ -f "$i/perl5" ] ; then
  733. PERL="$i/perl5"
  734. break;
  735. fi;
  736. done
  737. fi
  738. if [ ".$PERL" = . ] ; then
  739. for i in . `echo $PATH | sed 's/:/ /g'`; do
  740. if [ -f "$i/perl" ] ; then
  741. if "$i/perl" -e 'exit($]<5.0)'; then
  742. PERL="$i/perl"
  743. break;
  744. fi;
  745. fi;
  746. done
  747. fi
  748. if [ ".$PERL" = . ] ; then
  749. echo "You need Perl 5."
  750. exit 1
  751. fi
  752. # run Configure to check to see if we need to specify the
  753. # compiler for the platform ... in which case we add it on
  754. # the end ... otherwise we leave it off
  755. $PERL ./Configure LIST | grep "$OUT-$CC" > /dev/null
  756. if [ $? = "0" ]; then
  757. OUT="$OUT-$CC"
  758. fi
  759. OUT="$PREFIX$OUT"
  760. $PERL ./Configure LIST | grep "$OUT" > /dev/null
  761. if [ $? = "0" ]; then
  762. echo Configuring for $OUT
  763. if [ "$TEST" = "true" ]; then
  764. echo $PERL ./Configure $OUT $options
  765. else
  766. $PERL ./Configure $OUT $options
  767. fi
  768. else
  769. echo "This system ($OUT) is not supported. See file INSTALL for details."
  770. fi
  771. )