config 29 KB

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