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