config 27 KB

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