2
0

config 29 KB

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