config 28 KB

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