config 27 KB

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