config 25 KB

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