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