blob: 641d8f509ef9add69871c6b1ccdd58eb82d538bc [file] [log] [blame]
Ralf S. Engelschall58964a41998-12-21 10:56:39 +00001#!/bin/sh
Rich Salz44c8a5e2016-06-01 11:26:40 -04002# Copyright 1998-2016 The OpenSSL Project Authors. All Rights Reserved.
Ralf S. Engelschall58964a41998-12-21 10:56:39 +00003#
Rich Salz44c8a5e2016-06-01 11:26:40 -04004# 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
Ulf Möller5d3bb221999-04-22 19:23:56 +00009# OpenSSL config: determine the operating system and run ./Configure
Rich Salz44c8a5e2016-06-01 11:26:40 -040010# Derived from minarch and GuessOS from Apache.
Ralf S. Engelschall58964a41998-12-21 10:56:39 +000011#
Rich Salz44c8a5e2016-06-01 11:26:40 -040012# Do "config -h" for usage information.
Ulf Möller06a2b072001-02-27 21:10:21 +000013SUFFIX=""
Richard Levitteffb261f2016-08-15 18:46:39 +020014DRYRUN="false"
15VERBOSE="false"
Richard Levitte28a80032004-06-28 22:01:37 +000016EXE=""
Richard Levitte9fe2bb72016-01-29 19:45:51 +010017THERE=`dirname $0`
Ulf Möller06a2b072001-02-27 21:10:21 +000018
19# pick up any command line args to config
20for i
21do
22case "$i" in
Richard Levitte9e43c6b2015-03-17 16:30:54 +010023-d*) options=$options" --debug";;
Richard Levitteffb261f2016-08-15 18:46:39 +020024-t*) DRYRUN="true" VERBOSE="true";;
25-v*) VERBOSE="true";;
26-h*) DRYRUN="true"; cat <<EOF
Ulf Möller06a2b072001-02-27 21:10:21 +000027Usage: config [options]
Richard Levitteb33c5ff2016-03-10 14:20:50 +010028 -d Build with debugging when possible.
Ulf Möller06a2b072001-02-27 21:10:21 +000029 -t Test mode, do not run the Configure perl script.
Richard Levitteffb261f2016-08-15 18:46:39 +020030 -v Verbose mode, show the exact Configure call that is being made.
Ulf Möller06a2b072001-02-27 21:10:21 +000031 -h This help.
32
33Any other text will be passed to the Configure perl script.
34See INSTALL for instructions.
35
36EOF
37;;
38*) options=$options" $i" ;;
39esac
40done
41
Ralf S. Engelschall58964a41998-12-21 10:56:39 +000042# First get uname entries that we use below
43
Dr. Stephen Henson19a01922009-10-07 16:44:03 +000044[ "$MACHINE" ] || MACHINE=`(uname -m) 2>/dev/null` || MACHINE="unknown"
45[ "$RELEASE" ] || RELEASE=`(uname -r) 2>/dev/null` || RELEASE="unknown"
46[ "$SYSTEM" ] || SYSTEM=`(uname -s) 2>/dev/null` || SYSTEM="unknown"
47[ "$BUILD" ] || VERSION=`(uname -v) 2>/dev/null` || VERSION="unknown"
Ralf S. Engelschall58964a41998-12-21 10:56:39 +000048
Richard Levitte8f6dc9c2000-02-27 17:17:43 +000049
Ralf S. Engelschall58964a41998-12-21 10:56:39 +000050# Now test for ISC and SCO, since it is has a braindamaged uname.
51#
52# We need to work around FreeBSD 1.1.5.1
53(
54XREL=`uname -X 2>/dev/null | grep "^Release" | awk '{print $3}'`
55if [ "x$XREL" != "x" ]; then
56 if [ -f /etc/kconfig ]; then
57 case "$XREL" in
58 4.0|4.1)
59 echo "${MACHINE}-whatever-isc4"; exit 0
60 ;;
61 esac
62 else
63 case "$XREL" in
64 3.2v4.2)
65 echo "whatever-whatever-sco3"; exit 0
66 ;;
67 3.2v5.0*)
68 echo "whatever-whatever-sco5"; exit 0
69 ;;
70 4.2MP)
Andy Polyakov7c4e24a2003-01-18 15:17:26 +000071 case "x${VERSION}" in
Andy Polyakov9abff962003-01-19 21:47:06 +000072 x2.0*) echo "whatever-whatever-unixware20"; exit 0 ;;
73 x2.1*) echo "whatever-whatever-unixware21"; exit 0 ;;
74 x2*) echo "whatever-whatever-unixware2"; exit 0 ;;
Andy Polyakov7c4e24a2003-01-18 15:17:26 +000075 esac
Ralf S. Engelschall58964a41998-12-21 10:56:39 +000076 ;;
77 4.2)
78 echo "whatever-whatever-unixware1"; exit 0
79 ;;
Andy Polyakov14cc0aa2005-06-26 18:06:38 +000080 5*)
Andy Polyakov7c4e24a2003-01-18 15:17:26 +000081 case "x${VERSION}" in
82 # We hardcode i586 in place of ${MACHINE} for the
83 # following reason. The catch is that even though Pentium
84 # is minimum requirement for platforms in question,
85 # ${MACHINE} gets always assigned to i386. Now, problem
86 # with i386 is that it makes ./config pass 386 to
87 # ./Configure, which in turn makes make generate
88 # inefficient SHA-1 (for this moment) code.
Andy Polyakov14cc0aa2005-06-26 18:06:38 +000089 x[678]*) echo "i586-sco-unixware7"; exit 0 ;;
Andy Polyakov7c4e24a2003-01-18 15:17:26 +000090 esac
Richard Levitte9a5a7402000-02-26 03:51:55 +000091 ;;
Ralf S. Engelschall58964a41998-12-21 10:56:39 +000092 esac
93 fi
94fi
95# Now we simply scan though... In most cases, the SYSTEM info is enough
96#
97case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
98 A/UX:*)
99 echo "m68k-apple-aux3"; exit 0
100 ;;
101
Andy Polyakov76ef6ac2004-12-20 13:44:34 +0000102 AIX:[3-9]:4:*)
103 echo "${MACHINE}-ibm-aix"; exit 0
104 ;;
105
Andy Polyakovdd558802004-04-27 22:05:50 +0000106 AIX:*:[5-9]:*)
Andy Polyakov76ef6ac2004-12-20 13:44:34 +0000107 echo "${MACHINE}-ibm-aix"; exit 0
Richard Levitte36810172001-03-15 20:23:22 +0000108 ;;
109
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000110 AIX:*)
Andy Polyakov76ef6ac2004-12-20 13:44:34 +0000111 echo "${MACHINE}-ibm-aix3"; exit 0
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000112 ;;
113
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000114 HI-UX:*)
115 echo "${MACHINE}-hi-hiux"; exit 0
116 ;;
117
118 HP-UX:*)
119 HPUXVER=`echo ${RELEASE}|sed -e 's/[^.]*.[0B]*//'`
120 case "$HPUXVER" in
Andy Polyakov6d03b732001-07-30 16:42:15 +0000121 1[0-9].*) # HPUX 10 and 11 targets are unified
Andy Polyakov0a4c8ba2003-11-20 18:33:20 +0000122 echo "${MACHINE}-hp-hpux1x"; exit 0
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000123 ;;
124 *)
125 echo "${MACHINE}-hp-hpux"; exit 0
126 ;;
127 esac
128 ;;
129
Andy Polyakov1656ef21999-07-25 22:25:12 +0000130 IRIX:6.*)
Andy Polyakovda8fa721999-07-25 20:40:58 +0000131 echo "mips3-sgi-irix"; exit 0
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000132 ;;
133
134 IRIX64:*)
Andy Polyakovda8fa721999-07-25 20:40:58 +0000135 echo "mips4-sgi-irix64"; exit 0
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000136 ;;
137
138 Linux:[2-9].*)
139 echo "${MACHINE}-whatever-linux2"; exit 0
140 ;;
141
142 Linux:1.*)
143 echo "${MACHINE}-whatever-linux1"; exit 0
144 ;;
145
Richard Levitte10a29752001-01-11 12:58:37 +0000146 GNU*)
147 echo "hurd-x86"; exit 0;
148 ;;
149
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000150 LynxOS:*)
151 echo "${MACHINE}-lynx-lynxos"; exit 0
152 ;;
153
Bodo Möllera9ffce01999-06-11 11:45:22 +0000154 BSD/OS:4.*) # BSD/OS always says 386
155 echo "i486-whatever-bsdi4"; exit 0
Bodo Möller0cceb1c1999-05-30 23:54:52 +0000156 ;;
157
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000158 BSD/386:*:*:*486*|BSD/OS:*:*:*:*486*)
Ulf Möller9c789ad1999-06-16 20:26:46 +0000159 case `/sbin/sysctl -n hw.model` in
160 Pentium*)
Ulf Möller8050bc71999-06-16 23:49:39 +0000161 echo "i586-whatever-bsdi"; exit 0
Ulf Möller9c789ad1999-06-16 20:26:46 +0000162 ;;
163 *)
Ulf Möller8050bc71999-06-16 23:49:39 +0000164 echo "i386-whatever-bsdi"; exit 0
Ulf Möller9c789ad1999-06-16 20:26:46 +0000165 ;;
166 esac;
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000167 ;;
168
169 BSD/386:*|BSD/OS:*)
170 echo "${MACHINE}-whatever-bsdi"; exit 0
171 ;;
172
Richard Levitteafd41c92003-01-12 04:43:44 +0000173 FreeBSD:*:*:*386*)
Ralf S. Engelschall44717471999-08-09 10:16:51 +0000174 VERS=`echo ${RELEASE} | sed -e 's/[-(].*//'`
175 MACH=`sysctl -n hw.model`
176 ARCH='whatever'
177 case ${MACH} in
178 *386* ) MACH="i386" ;;
179 *486* ) MACH="i486" ;;
180 Pentium\ II*) MACH="i686" ;;
181 Pentium* ) MACH="i586" ;;
Ralf S. Engelschall44717471999-08-09 10:16:51 +0000182 * ) MACH="$MACHINE" ;;
183 esac
184 case ${MACH} in
185 i[0-9]86 ) ARCH="pc" ;;
186 esac
187 echo "${MACH}-${ARCH}-freebsd${VERS}"; exit 0
188 ;;
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000189
jrmarino2df7f112016-10-21 08:48:31 -0500190 DragonFly:*)
191 echo "${MACHINE}-whatever-dragonfly"; exit 0
192 ;;
193
Richard Levitteafd41c92003-01-12 04:43:44 +0000194 FreeBSD:*)
195 echo "${MACHINE}-whatever-freebsd"; exit 0
196 ;;
197
Jérôme Duval6e08e9e2016-02-23 22:49:01 +0100198 Haiku:*)
199 echo "${MACHINE}-whatever-haiku"; exit 0
200 ;;
201
Ulf Möllerc6fdd7d1999-04-23 16:32:04 +0000202 NetBSD:*:*:*386*)
Richard Levitte48d89b52000-10-21 22:18:52 +0000203 echo "`(/usr/sbin/sysctl -n hw.model || /sbin/sysctl -n hw.model) | sed 's,.*\(.\)86-class.*,i\186,'`-whatever-netbsd"; exit 0
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000204 ;;
205
206 NetBSD:*)
207 echo "${MACHINE}-whatever-netbsd"; exit 0
208 ;;
209
210 OpenBSD:*)
211 echo "${MACHINE}-whatever-openbsd"; exit 0
212 ;;
213
Lutz Jänicke6c36f7a2001-09-06 12:39:00 +0000214 OpenUNIX:*)
215 echo "${MACHINE}-unknown-OpenUNIX${VERSION}"; exit 0
216 ;;
217
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000218 OSF1:*:*:*alpha*)
Richard Levitte6bc847e2001-08-10 15:26:21 +0000219 OSFMAJOR=`echo ${RELEASE}| sed -e 's/^V\([0-9]*\)\..*$/\1/'`
220 case "$OSFMAJOR" in
221 4|5)
222 echo "${MACHINE}-dec-tru64"; exit 0
223 ;;
224 1|2|3)
225 echo "${MACHINE}-dec-osf"; exit 0
226 ;;
227 *)
228 echo "${MACHINE}-dec-osf"; exit 0
229 ;;
230 esac
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000231 ;;
232
233 QNX:*)
Lutz Jänicke6a9af682001-11-30 09:38:57 +0000234 case "$RELEASE" in
Bodo Möller36124b12000-09-06 12:25:58 +0000235 4*)
236 echo "${MACHINE}-whatever-qnx4"
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000237 ;;
Lutz Jänicke6a9af682001-11-30 09:38:57 +0000238 6*)
239 echo "${MACHINE}-whatever-qnx6"
240 ;;
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000241 *)
Bodo Möller36124b12000-09-06 12:25:58 +0000242 echo "${MACHINE}-whatever-qnx"
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000243 ;;
244 esac
245 exit 0
246 ;;
247
248 Paragon*:*:*:*)
249 echo "i860-intel-osf1"; exit 0
250 ;;
251
Andy Polyakov0fad6cb2000-02-06 11:15:20 +0000252 Rhapsody:*)
253 echo "ppc-apple-rhapsody"; exit 0
254 ;;
255
Richard Levitte9b7a5522000-12-01 01:11:54 +0000256 Darwin:*)
Richard Levitte70d70a32001-03-07 10:04:00 +0000257 case "$MACHINE" in
258 Power*)
259 echo "ppc-apple-darwin${VERSION}"
260 ;;
Richard Levitte3dfcb6a2016-05-10 23:22:29 +0200261 x86_64)
262 echo "x86_64-apple-darwin${VERSION}"
263 ;;
Richard Levitte70d70a32001-03-07 10:04:00 +0000264 *)
Andy Polyakovca640562007-12-18 17:33:49 +0000265 echo "i686-apple-darwin${VERSION}"
Richard Levitte70d70a32001-03-07 10:04:00 +0000266 ;;
267 esac
268 exit 0
Richard Levitte9b7a5522000-12-01 01:11:54 +0000269 ;;
270
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000271 SunOS:5.*)
Bodo Möller72289202000-09-06 17:09:58 +0000272 echo "${MACHINE}-whatever-solaris2"; exit 0
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000273 ;;
274
275 SunOS:*)
276 echo "${MACHINE}-sun-sunos4"; exit 0
277 ;;
278
279 UNIX_System_V:4.*:*)
280 echo "${MACHINE}-whatever-sysv4"; exit 0
281 ;;
282
Richard Levitte28a80032004-06-28 22:01:37 +0000283 VOS:*:*:i786)
284 echo "i386-stratus-vos"; exit 0
285 ;;
286
287 VOS:*:*:*)
288 echo "hppa1.1-stratus-vos"; exit 0
289 ;;
290
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000291 *:4*:R4*:m88k)
292 echo "${MACHINE}-whatever-sysv4"; exit 0
293 ;;
294
295 DYNIX/ptx:4*:*)
296 echo "${MACHINE}-whatever-sysv4"; exit 0
297 ;;
298
299 *:4.0:3.0:3[34]?? | *:4.0:3.0:3[34]??,*)
300 echo "i486-ncr-sysv4"; exit 0
301 ;;
302
303 ULTRIX:*)
304 echo "${MACHINE}-unknown-ultrix"; exit 0
305 ;;
306
Ulf Möller9231f471999-06-04 21:32:31 +0000307 POSIX-BC*)
308 echo "${MACHINE}-siemens-sysv4"; exit 0 # Here, $MACHINE == "BS2000"
309 ;;
310
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000311 machten:*)
312 echo "${MACHINE}-tenon-${SYSTEM}"; exit 0;
313 ;;
314
315 library:*)
316 echo "${MACHINE}-ncr-sysv4"; exit 0
317 ;;
318
319 ConvexOS:*:11.0:*)
320 echo "${MACHINE}-v11-${SYSTEM}"; exit 0;
321 ;;
322
Andy Polyakov4848cbf2005-04-07 20:24:29 +0000323 MINGW*)
324 echo "${MACHINE}-whatever-mingw"; exit 0;
325 ;;
Ulf Möllerd78e5292001-12-19 19:37:31 +0000326 CYGWIN*)
Corinna Vinschena717c112016-01-17 16:42:38 +0100327 echo "${MACHINE}-pc-cygwin"; exit 0
Ulf Möllerd78e5292001-12-19 19:37:31 +0000328 ;;
329
Dr. Stephen Henson2f6efd62011-05-01 15:36:54 +0000330 vxworks*)
331 echo "${MACHINE}-whatever-vxworks"; exit 0;
332 ;;
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000333esac
334
335#
336# Ugg. These are all we can determine by what we know about
337# the output of uname. Be more creative:
338#
339
340# Do the Apollo stuff first. Here, we just simply assume
Veres Lajos478b50c2013-06-13 00:22:32 +0100341# that the existence of the /usr/apollo directory is proof
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000342# enough
343if [ -d /usr/apollo ]; then
344 echo "whatever-apollo-whatever"
345 exit 0
346fi
347
348# Now NeXT
349ISNEXT=`hostinfo 2>/dev/null`
350case "$ISNEXT" in
Bodo Möller8e9eae01999-06-11 10:54:42 +0000351 *'NeXT Mach 3.3'*)
Bodo Möller74a6c7f1999-06-10 18:05:58 +0000352 echo "whatever-next-nextstep3.3"; exit 0
353 ;;
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000354 *NeXT*)
355 echo "whatever-next-nextstep"; exit 0
356 ;;
357esac
358
359# At this point we gone through all the one's
360# we know of: Punt
361
Ulf Möllerb1fe6b41999-04-30 18:22:59 +0000362echo "${MACHINE}-whatever-${SYSTEM}"
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000363exit 0
364) 2>/dev/null | (
365
366# ---------------------------------------------------------------------------
367# this is where the translation occurs into SSLeay terms
368# ---------------------------------------------------------------------------
369
Ben Laurie7f625322009-01-18 12:06:37 +0000370# Only set CC if not supplied already
Andy Polyakov8b8d2dc2011-10-23 15:12:37 +0000371if [ -z "$CROSS_COMPILE$CC" ]; then
372 GCCVER=`sh -c "gcc -dumpversion" 2>/dev/null`
Ben Laurie7f625322009-01-18 12:06:37 +0000373 if [ "$GCCVER" != "" ]; then
Andy Polyakov8b8d2dc2011-10-23 15:12:37 +0000374 # then strip off whatever prefix egcs prepends the number with...
375 # Hopefully, this will work for any future prefixes as well.
376 GCCVER=`echo $GCCVER | LC_ALL=C sed 's/^[a-zA-Z]*\-//'`
377 # Since gcc 3.1 gcc --version behaviour has changed. gcc -dumpversion
378 # does give us what we want though, so we use that. We just just the
379 # major and minor version numbers.
380 # peak single digit before and after first dot, e.g. 2.95.1 gives 29
381 GCCVER=`echo $GCCVER | sed 's/\([0-9]\)\.\([0-9]\).*/\1\2/'`
Ben Laurie7f625322009-01-18 12:06:37 +0000382 CC=gcc
383 else
384 CC=cc
385 fi
Andy Polyakov1656ef21999-07-25 22:25:12 +0000386fi
Andy Polyakovac7b4262001-07-25 15:58:57 +0000387GCCVER=${GCCVER:-0}
Lutz Jänicke1d4547a2002-06-14 20:15:18 +0000388if [ "$SYSTEM" = "HP-UX" ];then
389 # By default gcc is a ILP32 compiler (with long long == 64).
390 GCC_BITS="32"
391 if [ $GCCVER -ge 30 ]; then
392 # PA64 support only came in with gcc 3.0.x.
Andy Polyakov0a4c8ba2003-11-20 18:33:20 +0000393 # We check if the preprocessor symbol __LP64__ is defined...
394 if echo "__LP64__" | gcc -v -E -x c - 2>/dev/null | grep "^__LP64__" 2>&1 > /dev/null; then
395 : # __LP64__ has slipped through, it therefore is not defined
396 else
Lutz Jänicke1d4547a2002-06-14 20:15:18 +0000397 GCC_BITS="64"
398 fi
399 fi
400fi
Andy Polyakov1656ef21999-07-25 22:25:12 +0000401if [ "$SYSTEM" = "SunOS" ]; then
Andy Polyakovac7b4262001-07-25 15:58:57 +0000402 if [ $GCCVER -ge 30 ]; then
403 # 64-bit ABI isn't officially supported in gcc 3.0, but it appears
404 # to be working, at the very least 'make test' passes...
405 if gcc -v -E -x c /dev/null 2>&1 | grep __arch64__ > /dev/null; then
406 GCC_ARCH="-m64"
407 else
408 GCC_ARCH="-m32"
409 fi
410 fi
Andy Polyakovbdf5e182000-01-02 20:46:58 +0000411 # check for WorkShop C, expected output is "cc: blah-blah C x.x"
Andy Polyakov1656ef21999-07-25 22:25:12 +0000412 CCVER=`(cc -V 2>&1) 2>/dev/null | \
413 egrep -e '^cc: .* C [0-9]\.[0-9]' | \
414 sed 's/.* C \([0-9]\)\.\([0-9]\).*/\1\2/'`
415 CCVER=${CCVER:-0}
Andy Polyakov0abfd602005-04-04 17:10:53 +0000416 if [ $MACHINE != i86pc -a $CCVER -gt 40 ]; then
Andy Polyakov1656ef21999-07-25 22:25:12 +0000417 CC=cc # overrides gcc!!!
418 if [ $CCVER -eq 50 ]; then
419 echo "WARNING! Detected WorkShop C 5.0. Do make sure you have"
420 echo " patch #107357-01 or later applied."
421 sleep 5
422 fi
Ulf Möller744029c1999-05-04 23:18:24 +0000423 fi
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000424fi
425
Andy Polyakov726c2232003-01-18 15:13:03 +0000426if [ "${SYSTEM}" = "AIX" ]; then # favor vendor cc over gcc
Richard Levitte439909a2003-03-20 11:44:28 +0000427 (cc) 2>&1 | grep -iv "not found" > /dev/null && CC=cc
Andy Polyakov726c2232003-01-18 15:13:03 +0000428fi
429
Andy Polyakovda8fa721999-07-25 20:40:58 +0000430CCVER=${CCVER:-0}
431
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000432# read the output of the embedded GuessOS
433read GUESSOS
434
Ulf Möllerb1fe6b41999-04-30 18:22:59 +0000435echo Operating system: $GUESSOS
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000436
437# now map the output into SSLeay terms ... really should hack into the
438# script above so we end up with values in vars but that would take
439# more time that I want to waste at the moment
440case "$GUESSOS" in
Dr. Stephen Henson15c7adb2009-07-01 11:46:03 +0000441 uClinux*64*)
442 OUT=uClinux-dist64
443 ;;
444 uClinux*)
445 OUT=uClinux-dist
446 ;;
Andy Polyakovda8fa721999-07-25 20:40:58 +0000447 mips3-sgi-irix)
Andy Polyakov0c516002004-12-27 14:57:54 +0000448 #CPU=`(hinv -t cpu) 2>/dev/null | head -1 | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'`
449 #CPU=${CPU:-0}
450 #if [ $CPU -ge 5000 ]; then
451 # options="$options -mips4"
452 #else
453 # options="$options -mips3"
454 #fi
Andy Polyakovda8fa721999-07-25 20:40:58 +0000455 OUT="irix-mips3-$CC"
456 ;;
457 mips4-sgi-irix64)
458 echo "WARNING! If you wish to build 64-bit library, then you have to"
Richard Levitte9fe2bb72016-01-29 19:45:51 +0100459 echo " invoke '$THERE/Configure irix64-mips4-$CC' *manually*."
Richard Levitteffb261f2016-08-15 18:46:39 +0200460 if [ "$DRYRUN" = "false" -a -t 1 ]; then
Andy Polyakovac7b4262001-07-25 15:58:57 +0000461 echo " You have about 5 seconds to press Ctrl-C to abort."
Richard Levittea87c1592016-03-13 11:31:04 +0100462 (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
Ulf Möller06a2b072001-02-27 21:10:21 +0000463 fi
Andy Polyakov0c516002004-12-27 14:57:54 +0000464 #CPU=`(hinv -t cpu) 2>/dev/null | head -1 | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'`
465 #CPU=${CPU:-0}
466 #if [ $CPU -ge 5000 ]; then
467 # options="$options -mips4"
468 #else
469 # options="$options -mips3"
470 #fi
Andy Polyakovda8fa721999-07-25 20:40:58 +0000471 OUT="irix-mips3-$CC"
472 ;;
Andy Polyakovb7efa562005-01-24 14:38:14 +0000473 ppc-apple-rhapsody) OUT="rhapsody-ppc-cc" ;;
Andy Polyakovd6c76452007-07-31 18:24:41 +0000474 ppc-apple-darwin*)
475 ISA64=`(sysctl -n hw.optional.64bitops) 2>/dev/null`
Andy Polyakovaf036842011-11-08 13:31:28 +0000476 if [ "$ISA64" = "1" -a -z "$KERNEL_BITS" ]; then
Andy Polyakovd6c76452007-07-31 18:24:41 +0000477 echo "WARNING! If you wish to build 64-bit library, then you have to"
Richard Levitte9fe2bb72016-01-29 19:45:51 +0100478 echo " invoke '$THERE/Configure darwin64-ppc-cc' *manually*."
Richard Levitteffb261f2016-08-15 18:46:39 +0200479 if [ "$DRYRUN" = "false" -a -t 1 ]; then
Andy Polyakovd6c76452007-07-31 18:24:41 +0000480 echo " You have about 5 seconds to press Ctrl-C to abort."
Richard Levittea87c1592016-03-13 11:31:04 +0100481 (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
Andy Polyakovd6c76452007-07-31 18:24:41 +0000482 fi
483 fi
Andy Polyakovaf036842011-11-08 13:31:28 +0000484 if [ "$ISA64" = "1" -a "$KERNEL_BITS" = "64" ]; then
485 OUT="darwin64-ppc-cc"
486 else
487 OUT="darwin-ppc-cc"
488 fi ;;
Andy Polyakovca640562007-12-18 17:33:49 +0000489 i?86-apple-darwin*)
Andy Polyakov0bb01b72007-08-31 10:09:34 +0000490 ISA64=`(sysctl -n hw.optional.x86_64) 2>/dev/null`
Andy Polyakovaf036842011-11-08 13:31:28 +0000491 if [ "$ISA64" = "1" -a -z "$KERNEL_BITS" ]; then
Andy Polyakov0bb01b72007-08-31 10:09:34 +0000492 echo "WARNING! If you wish to build 64-bit library, then you have to"
Richard Levitte3dfcb6a2016-05-10 23:22:29 +0200493 echo " invoke 'KERNEL_BITS=64 $THERE/config $options'."
Richard Levitteffb261f2016-08-15 18:46:39 +0200494 if [ "$DRYRUN" = "false" -a -t 1 ]; then
Andy Polyakov0bb01b72007-08-31 10:09:34 +0000495 echo " You have about 5 seconds to press Ctrl-C to abort."
Ben Laurie190c8c62015-04-19 14:10:54 +0100496 # The stty technique used elsewhere doesn't work on
497 # MacOS. At least, right now on this Mac.
498 sleep 5
Andy Polyakov0bb01b72007-08-31 10:09:34 +0000499 fi
500 fi
Andy Polyakovaf036842011-11-08 13:31:28 +0000501 if [ "$ISA64" = "1" -a "$KERNEL_BITS" = "64" ]; then
502 OUT="darwin64-x86_64-cc"
503 else
504 OUT="darwin-i386-cc"
505 fi ;;
Richard Levitte3dfcb6a2016-05-10 23:22:29 +0200506 x86_64-apple-darwin*)
Richard Levitte3dfcb6a2016-05-10 23:22:29 +0200507 if [ "$KERNEL_BITS" = "32" ]; then
508 OUT="darwin-i386-cc"
509 else
510 OUT="darwin64-x86_64-cc"
511 fi ;;
Andy Polyakova2570242011-11-08 13:02:57 +0000512 armv6+7-*-iphoneos)
513 options="$options -arch%20armv6 -arch%20armv7"
514 OUT="iphoneos-cross" ;;
515 *-*-iphoneos)
516 options="$options -arch%20${MACHINE}"
517 OUT="iphoneos-cross" ;;
Andy Polyakovb06f7d92014-10-23 16:04:01 +0200518 arm64-*-iphoneos|*-*-ios64)
519 OUT="ios64-cross" ;;
Bodo Möller93cd57a2001-02-09 09:40:18 +0000520 alpha-*-linux2)
Andy Polyakovb7efa562005-01-24 14:38:14 +0000521 ISA=`awk '/cpu model/{print$4;exit(0);}' /proc/cpuinfo`
Andy Polyakovbdf5e182000-01-02 20:46:58 +0000522 case ${ISA:-generic} in
Andy Polyakovb7efa562005-01-24 14:38:14 +0000523 *[678]) OUT="linux-alpha+bwx-$CC" ;;
Andy Polyakovbdf5e182000-01-02 20:46:58 +0000524 *) OUT="linux-alpha-$CC" ;;
525 esac
526 if [ "$CC" = "gcc" ]; then
527 case ${ISA:-generic} in
Dr. Stephen Henson206a9752007-06-19 15:43:48 +0000528 EV5|EV45) options="$options -mcpu=ev5";;
529 EV56|PCA56) options="$options -mcpu=ev56";;
530 *) options="$options -mcpu=ev6";;
Andy Polyakovbdf5e182000-01-02 20:46:58 +0000531 esac
532 fi
533 ;;
Andy Polyakov76ef6ac2004-12-20 13:44:34 +0000534 ppc64-*-linux2)
Andy Polyakov78c3e202012-10-21 18:19:41 +0000535 if [ -z "$KERNEL_BITS" ]; then
536 echo "WARNING! If you wish to build 64-bit library, then you have to"
Richard Levitte9fe2bb72016-01-29 19:45:51 +0100537 echo " invoke '$THERE/Configure linux-ppc64' *manually*."
Richard Levitteffb261f2016-08-15 18:46:39 +0200538 if [ "$DRYRUN" = "false" -a -t 1 ]; then
Andy Polyakov78c3e202012-10-21 18:19:41 +0000539 echo " You have about 5 seconds to press Ctrl-C to abort."
Richard Levittea87c1592016-03-13 11:31:04 +0100540 (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
Andy Polyakov78c3e202012-10-21 18:19:41 +0000541 fi
Andy Polyakov76ef6ac2004-12-20 13:44:34 +0000542 fi
Andy Polyakov78c3e202012-10-21 18:19:41 +0000543 if [ "$KERNEL_BITS" = "64" ]; then
544 OUT="linux-ppc64"
545 else
546 OUT="linux-ppc"
547 (echo "__LP64__" | gcc -E -x c - 2>/dev/null | grep "^__LP64__" 2>&1 > /dev/null) || options="$options -m32"
548 fi
Andy Polyakov76ef6ac2004-12-20 13:44:34 +0000549 ;;
Andy Polyakovf1982ac2013-11-12 22:36:24 +0100550 ppc64le-*-linux2) OUT="linux-ppc64le" ;;
Andy Polyakovbdf5e182000-01-02 20:46:58 +0000551 ppc-*-linux2) OUT="linux-ppc" ;;
Andy Polyakovb8c59292012-09-19 20:58:07 +0000552 mips64*-*-linux2)
553 echo "WARNING! If you wish to build 64-bit library, then you have to"
Richard Levitte9fe2bb72016-01-29 19:45:51 +0100554 echo " invoke '$THERE/Configure linux64-mips64' *manually*."
Richard Levitteffb261f2016-08-15 18:46:39 +0200555 if [ "$DRYRUN" = "false" -a -t 1 ]; then
Andy Polyakovb8c59292012-09-19 20:58:07 +0000556 echo " You have about 5 seconds to press Ctrl-C to abort."
Richard Levittea87c1592016-03-13 11:31:04 +0100557 (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
Andy Polyakovb8c59292012-09-19 20:58:07 +0000558 fi
559 OUT="linux-mips64"
560 ;;
561 mips*-*-linux2) OUT="linux-mips32" ;;
Dr. Stephen Henson2f6efd62011-05-01 15:36:54 +0000562 ppc60x-*-vxworks*) OUT="vxworks-ppc60x" ;;
563 ppcgen-*-vxworks*) OUT="vxworks-ppcgen" ;;
Dr. Stephen Henson1fb2e0f2011-10-14 17:28:10 +0000564 pentium-*-vxworks*) OUT="vxworks-pentium" ;;
565 simlinux-*-vxworks*) OUT="vxworks-simlinux" ;;
566 mips-*-vxworks*) OUT="vxworks-mips";;
Ralf S. Engelschall010712f2000-02-29 15:29:02 +0000567 ia64-*-linux?) OUT="linux-ia64" ;;
Andy Polyakova0618e31999-07-25 15:13:49 +0000568 sparc64-*-linux2)
Bodo Möllerc14b4d62003-01-13 12:52:33 +0000569 echo "WARNING! If you *know* that your GNU C supports 64-bit/V9 ABI"
Andy Polyakov6d4ac672002-12-05 13:17:52 +0000570 echo " and wish to build 64-bit library, then you have to"
Richard Levitte9fe2bb72016-01-29 19:45:51 +0100571 echo " invoke '$THERE/Configure linux64-sparcv9' *manually*."
Richard Levitteffb261f2016-08-15 18:46:39 +0200572 if [ "$DRYRUN" = "false" -a -t 1 ]; then
Andy Polyakov6d4ac672002-12-05 13:17:52 +0000573 echo " You have about 5 seconds to press Ctrl-C to abort."
Richard Levittea87c1592016-03-13 11:31:04 +0100574 (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
Andy Polyakov6d4ac672002-12-05 13:17:52 +0000575 fi
Andy Polyakova0618e31999-07-25 15:13:49 +0000576 OUT="linux-sparcv9" ;;
Andy Polyakovda8fa721999-07-25 20:40:58 +0000577 sparc-*-linux2)
Andy Polyakovb7efa562005-01-24 14:38:14 +0000578 KARCH=`awk '/^type/{print$3;exit(0);}' /proc/cpuinfo`
Andy Polyakova0618e31999-07-25 15:13:49 +0000579 case ${KARCH:-sun4} in
580 sun4u*) OUT="linux-sparcv9" ;;
581 sun4m) OUT="linux-sparcv8" ;;
582 sun4d) OUT="linux-sparcv8" ;;
Andy Polyakovb7efa562005-01-24 14:38:14 +0000583 *) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
Andy Polyakova0618e31999-07-25 15:13:49 +0000584 esac ;;
Andy Polyakov57a68b22005-01-20 17:00:14 +0000585 parisc*-*-linux2)
586 # 64-bit builds under parisc64 linux are not supported and
587 # compiler is expected to generate 32-bit objects...
588 CPUARCH=`awk '/cpu family/{print substr($5,1,3); exit(0);}' /proc/cpuinfo`
589 CPUSCHEDULE=`awk '/^cpu.[ ]*: PA/{print substr($3,3); exit(0);}' /proc/cpuinfo`
Richard Levitte95f8c712002-01-02 10:00:22 +0000590
591 # ??TODO ?? Model transformations
592 # 0. CPU Architecture for the 1.1 processor has letter suffixes. We strip that off
593 # assuming no further arch. identification will ever be used by GCC.
594 # 1. I'm most concerned about whether is a 7300LC is closer to a 7100 versus a 7100LC.
595 # 2. The variant 64-bit processors cause concern should GCC support explicit schedulers
596 # for these chips in the future.
597 # PA7300LC -> 7100LC (1.1)
598 # PA8200 -> 8000 (2.0)
599 # PA8500 -> 8000 (2.0)
600 # PA8600 -> 8000 (2.0)
601
Andy Polyakov57a68b22005-01-20 17:00:14 +0000602 CPUSCHEDULE=`echo $CPUSCHEDULE|sed -e 's/7300LC/7100LC/' -e 's/8.00/8000/'`
Richard Levitte95f8c712002-01-02 10:00:22 +0000603 # Finish Model transformations
604
Andy Polyakovb7efa562005-01-24 14:38:14 +0000605 options="$options -DB_ENDIAN -mschedule=$CPUSCHEDULE -march=$CPUARCH"
606 OUT="linux-generic32" ;;
Andy Polyakov2c3ee162007-09-27 07:43:58 +0000607 armv[1-3]*-*-linux2) OUT="linux-generic32" ;;
Andy Polyakov87873f42011-07-17 17:40:29 +0000608 armv[7-9]*-*-linux2) OUT="linux-armv4"; options="$options -march=armv7-a" ;;
Andy Polyakov7722e532007-09-27 16:27:03 +0000609 arm*-*-linux2) OUT="linux-armv4" ;;
Andy Polyakove8d93e32014-06-01 17:21:06 +0200610 aarch64-*-linux2) OUT="linux-aarch64" ;;
Lutz Jänicke02756aa2007-02-21 18:10:20 +0000611 sh*b-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
612 sh*-*-linux2) OUT="linux-generic32"; options="$options -DL_ENDIAN" ;;
Lutz Jänicke072dfb92007-02-21 17:58:54 +0000613 m68k*-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
Andy Polyakovb900df52007-04-30 09:22:27 +0000614 s390-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
Andy Polyakove822c752010-11-29 20:52:43 +0000615 s390x-*-linux2)
616 # To be uncommented when glibc bug is fixed, see Configure...
617 #if egrep -e '^features.* highgprs' /proc/cpuinfo >/dev/null ; then
618 # echo "WARNING! If you wish to build \"highgprs\" 32-bit library, then you"
619 # echo " have to invoke './Configure linux32-s390x' *manually*."
Richard Levitteffb261f2016-08-15 18:46:39 +0200620 # if [ "$DRYRUN" = "false" -a -t -1 ]; then
Andy Polyakove822c752010-11-29 20:52:43 +0000621 # echo " You have about 5 seconds to press Ctrl-C to abort."
Richard Levittea87c1592016-03-13 11:31:04 +0100622 # (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
Andy Polyakove822c752010-11-29 20:52:43 +0000623 # fi
624 #fi
625 OUT="linux64-s390x"
626 ;;
Andy Polyakovc5c0cac2016-06-23 15:52:02 +0200627 x86_64-*-linux?)
628 if $CC -dM -E -x c /dev/null 2>&1 | grep -q ILP32 > /dev/null; then
629 OUT="linux-x32"
630 else
631 OUT="linux-x86_64"
632 fi ;;
Richard Levitte27a451e2016-11-15 09:56:20 +0100633 *86-*-linux2)
634 # On machines where the compiler understands -m32, prefer a
635 # config target that uses it
636 if $CC -m32 -E -x c /dev/null > /dev/null 2>&1; then
637 OUT="linux-x86"
638 else
639 OUT="linux-elf"
640 fi ;;
Andy Polyakov8f3bc092016-06-23 16:04:37 +0200641 *86-*-linux1) OUT="linux-aout" ;;
642 *-*-linux?) OUT="linux-generic32" ;;
Andy Polyakov160065c2007-05-04 13:04:17 +0000643 sun4[uv]*-*-solaris2)
Richard Levittecc8aa082002-08-16 09:41:14 +0000644 OUT="solaris-sparcv9-$CC"
mmiyashi74c2db32015-07-27 17:07:59 -0500645 ISA64=`(isainfo) 2>/dev/null | grep sparcv9`
Andy Polyakovbba391a2011-11-08 14:40:33 +0000646 if [ "$ISA64" != "" -a "$KERNEL_BITS" = "" ]; then
Andy Polyakovac7b4262001-07-25 15:58:57 +0000647 if [ "$CC" = "cc" -a $CCVER -ge 50 ]; then
Andy Polyakov1656ef21999-07-25 22:25:12 +0000648 echo "WARNING! If you wish to build 64-bit library, then you have to"
Richard Levitte9fe2bb72016-01-29 19:45:51 +0100649 echo " invoke '$THERE/Configure solaris64-sparcv9-cc' *manually*."
Richard Levitteffb261f2016-08-15 18:46:39 +0200650 if [ "$DRYRUN" = "false" -a -t 1 ]; then
Andy Polyakovac7b4262001-07-25 15:58:57 +0000651 echo " You have about 5 seconds to press Ctrl-C to abort."
Richard Levittea87c1592016-03-13 11:31:04 +0100652 (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
Ulf Möller06a2b072001-02-27 21:10:21 +0000653 fi
Andy Polyakovac7b4262001-07-25 15:58:57 +0000654 elif [ "$CC" = "gcc" -a "$GCC_ARCH" = "-m64" ]; then
655 # $GCC_ARCH denotes default ABI chosen by compiler driver
656 # (first one found on the $PATH). I assume that user
657 # expects certain consistency with the rest of his builds
658 # and therefore switch over to 64-bit. <appro>
659 OUT="solaris64-sparcv9-gcc"
660 echo "WARNING! If you wish to build 32-bit library, then you have to"
Richard Levitte9fe2bb72016-01-29 19:45:51 +0100661 echo " invoke '$THERE/Configure solaris-sparcv9-gcc' *manually*."
Richard Levitteffb261f2016-08-15 18:46:39 +0200662 if [ "$DRYRUN" = "false" -a -t 1 ]; then
Andy Polyakovac7b4262001-07-25 15:58:57 +0000663 echo " You have about 5 seconds to press Ctrl-C to abort."
Richard Levittea87c1592016-03-13 11:31:04 +0100664 (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
Andy Polyakovac7b4262001-07-25 15:58:57 +0000665 fi
666 elif [ "$GCC_ARCH" = "-m32" ]; then
667 echo "NOTICE! If you *know* that your GNU C supports 64-bit/V9 ABI"
668 echo " and wish to build 64-bit library, then you have to"
Richard Levitte9fe2bb72016-01-29 19:45:51 +0100669 echo " invoke '$THERE/Configure solaris64-sparcv9-gcc' *manually*."
Richard Levitteffb261f2016-08-15 18:46:39 +0200670 if [ "$DRYRUN" = "false" -a -t 1 ]; then
Andy Polyakovac7b4262001-07-25 15:58:57 +0000671 echo " You have about 5 seconds to press Ctrl-C to abort."
Richard Levittea87c1592016-03-13 11:31:04 +0100672 (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
Andy Polyakovac7b4262001-07-25 15:58:57 +0000673 fi
674 fi
Andy Polyakov1656ef21999-07-25 22:25:12 +0000675 fi
Andy Polyakovbba391a2011-11-08 14:40:33 +0000676 if [ "$ISA64" != "" -a "$KERNEL_BITS" = "64" ]; then
677 OUT="solaris64-sparcv9-$CC"
678 fi
Andy Polyakovac7b4262001-07-25 15:58:57 +0000679 ;;
Bodo Möller72289202000-09-06 17:09:58 +0000680 sun4m-*-solaris2) OUT="solaris-sparcv8-$CC" ;;
681 sun4d-*-solaris2) OUT="solaris-sparcv8-$CC" ;;
682 sun4*-*-solaris2) OUT="solaris-sparcv7-$CC" ;;
Andy Polyakov0abfd602005-04-04 17:10:53 +0000683 *86*-*-solaris2)
mmiyashi74c2db32015-07-27 17:07:59 -0500684 ISA64=`(isainfo) 2>/dev/null | grep amd64`
Andy Polyakovbba391a2011-11-08 14:40:33 +0000685 if [ "$ISA64" != "" -a ${KERNEL_BITS:-64} -eq 64 ]; then
Andy Polyakov0abfd602005-04-04 17:10:53 +0000686 OUT="solaris64-x86_64-$CC"
687 else
688 OUT="solaris-x86-$CC"
Andy Polyakove4c9b852005-05-21 16:50:27 +0000689 if [ `uname -r | sed -e 's/5\.//'` -lt 10 ]; then
690 options="$options no-sse2"
691 fi
Andy Polyakov0abfd602005-04-04 17:10:53 +0000692 fi
693 ;;
Andy Polyakovb7efa562005-01-24 14:38:14 +0000694 *-*-sunos4) OUT="sunos-$CC" ;;
695
Andy Polyakovb2d91a62005-06-05 18:10:19 +0000696 *86*-*-bsdi4) OUT="BSD-x86-elf"; options="$options no-sse2 -ldl" ;;
Andy Polyakove45c1002007-08-01 11:20:39 +0000697 alpha*-*-*bsd*) OUT="BSD-generic64"; options="$options -DL_ENDIAN" ;;
698 powerpc64-*-*bsd*) OUT="BSD-generic64"; options="$options -DB_ENDIAN" ;;
Andy Polyakovb7efa562005-01-24 14:38:14 +0000699 sparc64-*-*bsd*) OUT="BSD-sparc64" ;;
700 ia64-*-*bsd*) OUT="BSD-ia64" ;;
jrmarino2df7f112016-10-21 08:48:31 -0500701 x86_64-*-dragonfly*) OUT="BSD-x86_64" ;;
Andy Polyakovb7efa562005-01-24 14:38:14 +0000702 amd64-*-*bsd*) OUT="BSD-x86_64" ;;
Andy Polyakov8b452002005-06-20 17:39:10 +0000703 *86*-*-*bsd*) # mimic ld behaviour when it's looking for libc...
704 if [ -L /usr/lib/libc.so ]; then # [Free|Net]BSD
705 libc=/usr/lib/libc.so
706 else # OpenBSD
707 # ld searches for highest libc.so.* and so do we
Andy Polyakovc256e692013-06-30 23:55:55 +0200708 libc=`(ls /usr/lib/libc.so.* /lib/libc.so.* | tail -1) 2>/dev/null`
Andy Polyakov8b452002005-06-20 17:39:10 +0000709 fi
710 case "`(file -L $libc) 2>/dev/null`" in
Andy Polyakove1892f22005-02-06 13:20:23 +0000711 *ELF*) OUT="BSD-x86-elf" ;;
Andy Polyakove4c9b852005-05-21 16:50:27 +0000712 *) OUT="BSD-x86"; options="$options no-sse2" ;;
Andy Polyakove1892f22005-02-06 13:20:23 +0000713 esac ;;
Andy Polyakov8f3bc092016-06-23 16:04:37 +0200714 *-*-*bsd*) OUT="BSD-generic32" ;;
715
Jérôme Duval6e08e9e2016-02-23 22:49:01 +0100716 x86_64-*-haiku) OUT="haiku-x86_64" ;;
717 *-*-haiku) OUT="haiku-x86" ;;
Andy Polyakovb7efa562005-01-24 14:38:14 +0000718
719 *-*-osf) OUT="osf1-alpha-cc" ;;
720 *-*-tru64) OUT="tru64-alpha-cc" ;;
Andy Polyakov14cc0aa2005-06-26 18:06:38 +0000721 *-*-[Uu]nix[Ww]are7)
Lutz Jänickecb42ce02001-09-07 12:13:10 +0000722 if [ "$CC" = "gcc" ]; then
Andy Polyakov14cc0aa2005-06-26 18:06:38 +0000723 OUT="unixware-7-gcc" ; options="$options no-sse2"
Lutz Jänickecb42ce02001-09-07 12:13:10 +0000724 else
Andy Polyakov14cc0aa2005-06-26 18:06:38 +0000725 OUT="unixware-7" ; options="$options no-sse2 -D__i386__"
Lutz Jänickecb42ce02001-09-07 12:13:10 +0000726 fi
727 ;;
Andy Polyakov5b737a02005-05-31 09:39:03 +0000728 *-*-[Uu]nix[Ww]are20*) OUT="unixware-2.0"; options="$options no-sse2 no-sha512" ;;
729 *-*-[Uu]nix[Ww]are21*) OUT="unixware-2.1"; options="$options no-sse2 no-sha512" ;;
Richard Levitte28a80032004-06-28 22:01:37 +0000730 *-*-vos)
731 options="$options no-threads no-shared no-asm no-dso"
732 EXE=".pm"
733 OUT="vos-$CC" ;;
Ulf Möller9231f471999-06-04 21:32:31 +0000734 BS2000-siemens-sysv4) OUT="BS2000-OSD" ;;
Andy Polyakov6d03b732001-07-30 16:42:15 +0000735 *-hpux1*)
Andy Polyakov12470922004-01-29 22:16:08 +0000736 if [ $CC = "gcc" -a $GCC_BITS = "64" ]; then
737 OUT="hpux64-parisc2-gcc"
Lutz Jänicke1d4547a2002-06-14 20:15:18 +0000738 fi
Dr. Stephen Henson9fa8f3a2011-06-24 14:04:03 +0000739 [ "$KERNEL_BITS" ] || KERNEL_BITS=`(getconf KERNEL_BITS) 2>/dev/null`
Andy Polyakov6d03b732001-07-30 16:42:15 +0000740 KERNEL_BITS=${KERNEL_BITS:-32}
741 CPU_VERSION=`(getconf CPU_VERSION) 2>/dev/null`
742 CPU_VERSION=${CPU_VERSION:-0}
743 # See <sys/unistd.h> for further info on CPU_VERSION.
744 if [ $CPU_VERSION -ge 768 ]; then # IA-64 CPU
Dr. Stephen Hensonbdd45492011-06-27 11:38:48 +0000745 if [ $KERNEL_BITS -eq 64 -a "$CC" = "cc" ]; then
746 OUT="hpux64-ia64-cc"
747 else
748 OUT="hpux-ia64-cc"
749 fi
Andy Polyakov6d03b732001-07-30 16:42:15 +0000750 elif [ $CPU_VERSION -ge 532 ]; then # PA-RISC 2.x CPU
Andy Polyakov12470922004-01-29 22:16:08 +0000751 OUT=${OUT:-"hpux-parisc2-${CC}"}
Andy Polyakov6d03b732001-07-30 16:42:15 +0000752 if [ $KERNEL_BITS -eq 64 -a "$CC" = "cc" ]; then
753 echo "WARNING! If you wish to build 64-bit library then you have to"
Richard Levitte9fe2bb72016-01-29 19:45:51 +0100754 echo " invoke '$THERE/Configure hpux64-parisc2-cc' *manually*."
Richard Levitteffb261f2016-08-15 18:46:39 +0200755 if [ "$DRYRUN" = "false" -a -t 1 ]; then
Andy Polyakov6d03b732001-07-30 16:42:15 +0000756 echo " You have about 5 seconds to press Ctrl-C to abort."
Richard Levittea87c1592016-03-13 11:31:04 +0100757 (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
Andy Polyakov6d03b732001-07-30 16:42:15 +0000758 fi
759 fi
Andy Polyakov74acf1c2016-03-14 13:42:48 +0100760 # PA-RISC 2.0 is no longer supported as separate 32-bit
761 # target. This is compensated for by run-time detection
762 # in most critical assembly modules and taking advantage
Andy Polyakovd8292af2016-03-16 14:29:16 +0100763 # of 2.0 architecture in PA-RISC 1.1 build.
Andy Polyakov74acf1c2016-03-14 13:42:48 +0100764 OUT="hpux-parisc1_1-${CC}"
Andy Polyakov6d03b732001-07-30 16:42:15 +0000765 elif [ $CPU_VERSION -ge 528 ]; then # PA-RISC 1.1+ CPU
Andy Polyakov74acf1c2016-03-14 13:42:48 +0100766 OUT="hpux-parisc1_1-${CC}"
Andy Polyakov6d03b732001-07-30 16:42:15 +0000767 elif [ $CPU_VERSION -ge 523 ]; then # PA-RISC 1.0 CPU
Ulf Möller83ed4912006-05-06 18:26:12 +0000768 OUT="hpux-parisc-${CC}"
Andy Polyakov6d03b732001-07-30 16:42:15 +0000769 else # Motorola(?) CPU
770 OUT="hpux-$CC"
771 fi
772 options="$options -D_REENTRANT" ;;
Andy Polyakovbcba6cc2000-02-12 23:33:01 +0000773 *-hpux) OUT="hpux-parisc-$CC" ;;
Andy Polyakov76ef6ac2004-12-20 13:44:34 +0000774 *-aix)
Dr. Stephen Henson9fa8f3a2011-06-24 14:04:03 +0000775 [ "$KERNEL_BITS" ] || KERNEL_BITS=`(getconf KERNEL_BITMODE) 2>/dev/null`
Andy Polyakovdd558802004-04-27 22:05:50 +0000776 KERNEL_BITS=${KERNEL_BITS:-32}
Andy Polyakov76ef6ac2004-12-20 13:44:34 +0000777 OBJECT_MODE=${OBJECT_MODE:-32}
Andy Polyakovdd558802004-04-27 22:05:50 +0000778 if [ "$CC" = "gcc" ]; then
779 OUT="aix-gcc"
Dr. Stephen Hensona0e4a8e2010-03-09 17:08:48 +0000780 if [ $OBJECT_MODE -eq 64 ]; then
781 echo 'Your $OBJECT_MODE was found to be set to 64'
782 OUT="aix64-gcc"
783 fi
Andy Polyakov76ef6ac2004-12-20 13:44:34 +0000784 elif [ $OBJECT_MODE -eq 64 ]; then
785 echo 'Your $OBJECT_MODE was found to be set to 64'
786 OUT="aix64-cc"
Andy Polyakovdd558802004-04-27 22:05:50 +0000787 else
Andy Polyakov76ef6ac2004-12-20 13:44:34 +0000788 OUT="aix-cc"
789 if [ $KERNEL_BITS -eq 64 ]; then
790 echo "WARNING! If you wish to build 64-bit kit, then you have to"
Richard Levitte9fe2bb72016-01-29 19:45:51 +0100791 echo " invoke '$THERE/Configure aix64-cc' *manually*."
Richard Levitteffb261f2016-08-15 18:46:39 +0200792 if [ "$DRYRUN" = "false" -a -t 1 ]; then
Andy Polyakov76ef6ac2004-12-20 13:44:34 +0000793 echo " You have ~5 seconds to press Ctrl-C to abort."
Richard Levittea87c1592016-03-13 11:31:04 +0100794 (trap "stty `stty -g`; exit 0" 2 0; stty -icanon min 0 time 50; read waste) <&1
Andy Polyakov76ef6ac2004-12-20 13:44:34 +0000795 fi
796 fi
Andy Polyakovdd558802004-04-27 22:05:50 +0000797 fi
Andy Polyakov0a29f512007-03-20 08:57:18 +0000798 if (lsattr -E -O -l `lsdev -c processor|awk '{print$1;exit}'` | grep -i powerpc) >/dev/null 2>&1; then
Andy Polyakov60dd0852005-09-20 07:43:27 +0000799 : # this applies even to Power3 and later, as they return PowerPC_POWER[345]
800 else
801 options="$options no-asm"
802 fi
Andy Polyakovdd558802004-04-27 22:05:50 +0000803 ;;
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000804 # these are all covered by the catchall below
Richard Levitte3f542962016-01-17 17:48:53 +0100805 i[3456]86-*-cygwin) OUT="Cygwin-x86" ;;
Corinna Vinschena717c112016-01-17 16:42:38 +0100806 *-*-cygwin) OUT="Cygwin-${MACHINE}" ;;
Dr. Stephen Henson4f335342009-06-17 11:37:44 +0000807 x86pc-*-qnx6) OUT="QNX6-i386" ;;
808 *-*-qnx6) OUT="QNX6" ;;
Andy Polyakov8fcdb1e2011-10-15 08:32:16 +0000809 x86-*-android|i?86-*-android) OUT="android-x86" ;;
Richard Levitte893fe732016-02-22 21:02:42 +0100810 armv[7-9]*-*-android)
811 OUT="android-armeabi"; options="$options -march=armv7-a" ;;
812 arm*-*-android) OUT="android-armeabi" ;;
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000813 *) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
814esac
815
Veres Lajos478b50c2013-06-13 00:22:32 +0100816# NB: This atalla support has been superseded by the ENGINE support
Richard Levitte5270e702000-10-26 21:07:28 +0000817# That contains its own header and definitions anyway. Support can
818# be enabled or disabled on any supported platform without external
819# headers, eg. by adding the "hw-atalla" switch to ./config or
820# perl Configure
821#
Ben Lauriebd03b992000-02-16 22:15:39 +0000822# See whether we can compile Atalla support
Richard Levitte5270e702000-10-26 21:07:28 +0000823#if [ -f /usr/include/atasi.h ]
824#then
825# options="$options -DATALLA"
826#fi
Ben Lauriebd03b992000-02-16 22:15:39 +0000827
Dr. Stephen Henson1fb2e0f2011-10-14 17:28:10 +0000828if [ -n "$CONFIG_OPTIONS" ]; then
829 options="$options $CONFIG_OPTIONS"
830fi
831
Andy Polyakov8b8d2dc2011-10-23 15:12:37 +0000832if expr "$options" : '.*no\-asm' > /dev/null; then :; else
833 sh -c "$CROSS_COMPILE${CC:-gcc} -Wa,--help -c -o /tmp/null.$$.o -x assembler /dev/null && rm /tmp/null.$$.o" 2>&1 | \
834 grep \\--noexecstack >/dev/null && \
Andy Polyakov2966c2e2011-07-13 14:23:19 +0000835 options="$options -Wa,--noexecstack"
Dr. Stephen Henson1fb2e0f2011-10-14 17:28:10 +0000836fi
Andy Polyakov2966c2e2011-07-13 14:23:19 +0000837
Dr. Stephen Henson9540ccd2006-05-12 16:06:12 +0000838# gcc < 2.8 does not support -march=ultrasparc
Andy Polyakov1656ef21999-07-25 22:25:12 +0000839if [ "$OUT" = solaris-sparcv9-gcc -a $GCCVER -lt 28 ]
Ulf Möllerb6735831999-05-18 23:44:38 +0000840then
Andy Polyakovd0590fe2004-07-18 16:19:34 +0000841 echo "WARNING! Falling down to 'solaris-sparcv8-gcc'."
842 echo " Upgrade to gcc-2.8 or later."
Andy Polyakov1656ef21999-07-25 22:25:12 +0000843 sleep 5
Andy Polyakovd0590fe2004-07-18 16:19:34 +0000844 OUT=solaris-sparcv8-gcc
Andy Polyakova0618e31999-07-25 15:13:49 +0000845fi
846if [ "$OUT" = "linux-sparcv9" -a $GCCVER -lt 28 ]
847then
848 echo "WARNING! Falling down to 'linux-sparcv8'."
849 echo " Upgrade to gcc-2.8 or later."
Andy Polyakov1656ef21999-07-25 22:25:12 +0000850 sleep 5
Andy Polyakova0618e31999-07-25 15:13:49 +0000851 OUT=linux-sparcv8
Ulf Möllerb6735831999-05-18 23:44:38 +0000852fi
853
Ulf Möller5d3bb221999-04-22 19:23:56 +0000854case "$GUESSOS" in
855 i386-*) options="$options 386" ;;
856esac
857
Bodo Möller96afc1c2007-04-23 23:48:59 +0000858for i in aes bf camellia cast des dh dsa ec hmac idea md2 md5 mdc2 rc2 rc4 rc5 ripemd rsa seed sha
Ulf Möller9231f471999-06-04 21:32:31 +0000859do
Richard Levitte9fe2bb72016-01-29 19:45:51 +0100860 if [ ! -d $THERE/crypto/$i ]
Ulf Möller9231f471999-06-04 21:32:31 +0000861 then
862 options="$options no-$i"
863 fi
864done
865
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000866if [ -z "$OUT" ]; then
867 OUT="$CC"
868fi
869
Ulf Möller99aab161999-04-01 12:34:33 +0000870if [ ".$PERL" = . ] ; then
871 for i in . `echo $PATH | sed 's/:/ /g'`; do
Richard Levitte28a80032004-06-28 22:01:37 +0000872 if [ -f "$i/perl5$EXE" ] ; then
873 PERL="$i/perl5$EXE"
Ulf Möller99aab161999-04-01 12:34:33 +0000874 break;
875 fi;
876 done
877fi
878
879if [ ".$PERL" = . ] ; then
880 for i in . `echo $PATH | sed 's/:/ /g'`; do
Richard Levitte28a80032004-06-28 22:01:37 +0000881 if [ -f "$i/perl$EXE" ] ; then
882 if "$i/perl$EXE" -e 'exit($]<5.0)'; then
883 PERL="$i/perl$EXE"
Ulf Möllera5a47e41999-04-09 16:25:25 +0000884 break;
885 fi;
Ulf Möller99aab161999-04-01 12:34:33 +0000886 fi;
887 done
888fi
889
Ulf Möllera5a47e41999-04-09 16:25:25 +0000890if [ ".$PERL" = . ] ; then
Ulf Möller99aab161999-04-01 12:34:33 +0000891 echo "You need Perl 5."
892 exit 1
893fi
894
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000895# run Configure to check to see if we need to specify the
896# compiler for the platform ... in which case we add it on
897# the end ... otherwise we leave it off
Ulf Möller99aab161999-04-01 12:34:33 +0000898
Richard Levitte9fe2bb72016-01-29 19:45:51 +0100899$PERL $THERE/Configure LIST | grep "$OUT-$CC" > /dev/null
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000900if [ $? = "0" ]; then
901 OUT="$OUT-$CC"
902fi
903
Richard Levitted2a5c402015-03-22 09:00:43 +0100904OUT="$OUT"
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000905
Richard Levitte9fe2bb72016-01-29 19:45:51 +0100906$PERL $THERE/Configure LIST | grep "$OUT" > /dev/null
Ulf Möllerb1fe6b41999-04-30 18:22:59 +0000907if [ $? = "0" ]; then
Richard Levitteffb261f2016-08-15 18:46:39 +0200908 if [ "$VERBOSE" = "true" ]; then
Richard Levitte9fe2bb72016-01-29 19:45:51 +0100909 echo $PERL $THERE/Configure $OUT $options
Richard Levitteffb261f2016-08-15 18:46:39 +0200910 fi
911 if [ "$DRYRUN" = "false" ]; then
Richard Levitte9fe2bb72016-01-29 19:45:51 +0100912 $PERL $THERE/Configure $OUT $options
Ulf Möllerb1fe6b41999-04-30 18:22:59 +0000913 fi
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000914else
Ulf Möller744029c1999-05-04 23:18:24 +0000915 echo "This system ($OUT) is not supported. See file INSTALL for details."
Rich Salz141d7322016-09-06 12:26:38 -0400916 exit 1
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000917fi
Ben Laurie26967dc2017-01-02 18:13:30 +0000918
919if [ "$OUT" = "darwin64-x86_64-cc" ]; then
920 echo "WARNING! If you wish to build 32-bit libraries, then you have to"
921 echo " invoke 'KERNEL_BITS=32 $THERE/config $options'."
922fi
Ralf S. Engelschall58964a41998-12-21 10:56:39 +0000923)