xref: /freebsd/crypto/openssl/config (revision c4f6a2a9e1b1879b618c436ab4f56ff75c73a0f5)
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# First get uname entries that we use below
24
25MACHINE=`(uname -m) 2>/dev/null` || MACHINE="unknown"
26RELEASE=`(uname -r) 2>/dev/null` || RELEASE="unknown"
27SYSTEM=`(uname -s) 2>/dev/null`  || SYSTEM="unknown"
28VERSION=`(uname -v) 2>/dev/null` || VERSION="unknown"
29
30
31# Now test for ISC and SCO, since it is has a braindamaged uname.
32#
33# We need to work around FreeBSD 1.1.5.1
34(
35XREL=`uname -X 2>/dev/null | grep "^Release" | awk '{print $3}'`
36if [ "x$XREL" != "x" ]; then
37    if [ -f /etc/kconfig ]; then
38	case "$XREL" in
39	    4.0|4.1)
40		    echo "${MACHINE}-whatever-isc4"; exit 0
41		;;
42	esac
43    else
44	case "$XREL" in
45	    3.2v4.2)
46		echo "whatever-whatever-sco3"; exit 0
47		;;
48	    3.2v5.0*)
49		echo "whatever-whatever-sco5"; exit 0
50		;;
51	    4.2MP)
52		if [ "x$VERSION" = "x2.01" ]; then
53		    echo "${MACHINE}-whatever-unixware201"; exit 0
54		elif [ "x$VERSION" = "x2.02" ]; then
55		    echo "${MACHINE}-whatever-unixware202"; exit 0
56		elif [ "x$VERSION" = "x2.03" ]; then
57		    echo "${MACHINE}-whatever-unixware203"; exit 0
58		elif [ "x$VERSION" = "x2.1.1" ]; then
59		    echo "${MACHINE}-whatever-unixware211"; exit 0
60		elif [ "x$VERSION" = "x2.1.2" ]; then
61		    echo "${MACHINE}-whatever-unixware212"; exit 0
62		elif [ "x$VERSION" = "x2.1.3" ]; then
63		    echo "${MACHINE}-whatever-unixware213"; exit 0
64		else
65		    echo "${MACHINE}-whatever-unixware2"; exit 0
66		fi
67		;;
68	    4.2)
69		echo "whatever-whatever-unixware1"; exit 0
70		;;
71     OpenUNIX)
72		if [ "`echo x$VERSION | sed -e 's/\..*//'`" = "x8" ]; then
73		    echo "${MACHINE}-unknown-OpenUNIX${VERSION}"; exit 0
74		fi
75		;;
76	    5)
77		if [ "`echo x$VERSION | sed -e 's/\..*//'`" = "x7" ]; then
78		    echo "${MACHINE}-sco-unixware7"; exit 0
79		fi
80		;;
81	esac
82    fi
83fi
84# Now we simply scan though... In most cases, the SYSTEM info is enough
85#
86case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
87    MPE/iX:*)
88	MACHINE=`echo "$MACHINE" | sed -e 's/-/_/g'`
89	echo "parisc-hp-MPE/iX"; exit 0
90	;;
91    A/UX:*)
92	echo "m68k-apple-aux3"; exit 0
93	;;
94
95    AIX:[3456789]:4:*)
96	echo "${MACHINE}-ibm-aix43"; exit 0
97	;;
98
99    AIX:*:[56789]:*)
100	echo "${MACHINE}-ibm-aix43"; exit 0
101	;;
102
103    AIX:*)
104	echo "${MACHINE}-ibm-aix"; exit 0
105	;;
106
107    dgux:*)
108	echo "${MACHINE}-dg-dgux"; exit 0
109	;;
110
111    HI-UX:*)
112	echo "${MACHINE}-hi-hiux"; exit 0
113	;;
114
115    HP-UX:*)
116	HPUXVER=`echo ${RELEASE}|sed -e 's/[^.]*.[0B]*//'`
117	case "$HPUXVER" in
118	    11.*)
119		echo "${MACHINE}-hp-hpux11"; exit 0
120		;;
121	    10.*)
122		echo "${MACHINE}-hp-hpux10"; exit 0
123		;;
124	    *)
125		echo "${MACHINE}-hp-hpux"; exit 0
126		;;
127	esac
128	;;
129
130    IRIX:5.*)
131	echo "mips2-sgi-irix"; exit 0
132	;;
133
134    IRIX:6.*)
135	echo "mips3-sgi-irix"; exit 0
136	;;
137
138    IRIX64:*)
139	echo "mips4-sgi-irix64"; exit 0
140	;;
141
142    Linux:[2-9].*)
143	echo "${MACHINE}-whatever-linux2"; exit 0
144	;;
145
146    Linux:1.*)
147	echo "${MACHINE}-whatever-linux1"; exit 0
148	;;
149
150    LynxOS:*)
151	echo "${MACHINE}-lynx-lynxos"; exit 0
152	;;
153
154    BSD/OS:4.*)  # BSD/OS always says 386
155	echo "i486-whatever-bsdi4"; exit 0
156	;;
157
158    BSD/386:*:*:*486*|BSD/OS:*:*:*:*486*)
159        case `/sbin/sysctl -n hw.model` in
160	    Pentium*)
161                echo "i586-whatever-bsdi"; exit 0
162                ;;
163            *)
164                echo "i386-whatever-bsdi"; exit 0
165                ;;
166            esac;
167	;;
168
169    BSD/386:*|BSD/OS:*)
170	echo "${MACHINE}-whatever-bsdi"; exit 0
171	;;
172
173    FreeBSD:*)
174        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"     ;;
182           Alpha*      ) MACH="alpha"    ;;
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        ;;
190
191    NetBSD:*:*:*386*)
192        echo "`(/usr/sbin/sysctl -n hw.model || /sbin/sysctl -n hw.model) | sed 's,.*\(.\)86-class.*,i\186,'`-whatever-netbsd"; exit 0
193	;;
194
195    NetBSD:*)
196	echo "${MACHINE}-whatever-netbsd"; exit 0
197	;;
198
199    OpenBSD:*)
200	echo "${MACHINE}-whatever-openbsd"; exit 0
201	;;
202
203    OpenUNIX:*)
204	echo "${MACHINE}-unknown-OpenUNIX${VERSION}"; exit 0
205	;;
206
207    OSF1:*:*:*alpha*)
208	OSFMAJOR=`echo ${RELEASE}| sed -e 's/^V\([0-9]*\)\..*$/\1/'`
209	case "$OSFMAJOR" in
210	    4|5)
211		echo "${MACHINE}-dec-tru64"; exit 0
212		;;
213	    1|2|3)
214		echo "${MACHINE}-dec-osf"; exit 0
215		;;
216	    *)
217		echo "${MACHINE}-dec-osf"; exit 0
218		;;
219	esac
220	;;
221
222    QNX:*)
223	case "$RELEASE" in
224	    4*)
225		echo "${MACHINE}-whatever-qnx4"
226		;;
227	    6*)
228		echo "${MACHINE}-whatever-qnx6"
229		;;
230	    *)
231		echo "${MACHINE}-whatever-qnx"
232		;;
233	esac
234	exit 0
235	;;
236
237    Paragon*:*:*:*)
238	echo "i860-intel-osf1"; exit 0
239	;;
240
241    Rhapsody:*)
242	echo "ppc-apple-rhapsody"; exit 0
243	;;
244
245    Darwin:*)
246	echo "ppc-apple-darwin"; exit 0
247	;;
248
249    SunOS:5.*)
250	echo "${MACHINE}-whatever-solaris2"; exit 0
251	;;
252
253    SunOS:*)
254	echo "${MACHINE}-sun-sunos4"; exit 0
255	;;
256
257    UNIX_System_V:4.*:*)
258	echo "${MACHINE}-whatever-sysv4"; exit 0
259	;;
260
261    *:4*:R4*:m88k)
262	echo "${MACHINE}-whatever-sysv4"; exit 0
263	;;
264
265    DYNIX/ptx:4*:*)
266	echo "${MACHINE}-whatever-sysv4"; exit 0
267	;;
268
269    *:4.0:3.0:3[34]?? | *:4.0:3.0:3[34]??,*)
270	echo "i486-ncr-sysv4"; exit 0
271	;;
272
273    ULTRIX:*)
274	echo "${MACHINE}-unknown-ultrix"; exit 0
275	;;
276
277    SINIX*|ReliantUNIX*)
278	echo "${MACHINE}-siemens-sysv4"; exit 0
279	;;
280
281    POSIX-BC*)
282	echo "${MACHINE}-siemens-sysv4"; exit 0   # Here, $MACHINE == "BS2000"
283	;;
284
285    machten:*)
286       echo "${MACHINE}-tenon-${SYSTEM}"; exit 0;
287       ;;
288
289    library:*)
290	echo "${MACHINE}-ncr-sysv4"; exit 0
291	;;
292
293    ConvexOS:*:11.0:*)
294	echo "${MACHINE}-v11-${SYSTEM}"; exit 0;
295	;;
296
297    NEWS-OS:4.*)
298	echo "mips-sony-newsos4"; exit 0;
299	;;
300
301    CYGWIN*)
302	case "$RELEASE" in
303	    [bB]*|1.0|1.[12].*)
304		echo "${MACHINE}-whatever-cygwin_pre1.3"
305		;;
306	    *)
307		echo "${MACHINE}-whatever-cygwin"
308		;;
309	esac
310	exit 0
311	;;
312
313    *"CRAY T3E")
314       echo "t3e-cray-unicosmk"; exit 0;
315       ;;
316
317    *CRAY*)
318       echo "j90-cray-unicos"; exit 0;
319       ;;
320esac
321
322#
323# Ugg. These are all we can determine by what we know about
324# the output of uname. Be more creative:
325#
326
327# Do the Apollo stuff first. Here, we just simply assume
328# that the existance of the /usr/apollo directory is proof
329# enough
330if [ -d /usr/apollo ]; then
331    echo "whatever-apollo-whatever"
332    exit 0
333fi
334
335# Now NeXT
336ISNEXT=`hostinfo 2>/dev/null`
337case "$ISNEXT" in
338    *'NeXT Mach 3.3'*)
339	echo "whatever-next-nextstep3.3"; exit 0
340	;;
341    *NeXT*)
342	echo "whatever-next-nextstep"; exit 0
343	;;
344esac
345
346# At this point we gone through all the one's
347# we know of: Punt
348
349echo "${MACHINE}-whatever-${SYSTEM}"
350exit 0
351) 2>/dev/null | (
352
353# ---------------------------------------------------------------------------
354# this is where the translation occurs into SSLeay terms
355# ---------------------------------------------------------------------------
356
357PREFIX=""
358SUFFIX=""
359TEST="false"
360
361# pick up any command line args to config
362for i
363do
364case "$i" in
365-d*) PREFIX="debug-";;
366-t*) TEST="true";;
367-h*) TEST="true"; cat <<EOF
368Usage: config [options]
369 -d	Add a debug- prefix to machine choice.
370 -t	Test mode, do not run the Configure perl script.
371 -h	This help.
372
373Any other text will be passed to the Configure perl script.
374See INSTALL for instructions.
375
376EOF
377;;
378*) options=$options" $i" ;;
379esac
380done
381
382# figure out if gcc is available and if so we use it otherwise
383# we fallback to whatever cc does on the system
384GCCVER=`(gcc -dumpversion) 2>/dev/null`
385if [ "$GCCVER" != "" ]; then
386  CC=gcc
387  # then strip off whatever prefix egcs prepends the number with...
388  # Hopefully, this will work for any future prefixes as well.
389  GCCVER=`echo $GCCVER | sed 's/^[a-zA-Z]*\-//'`
390  # Since gcc 3.1 gcc --version behaviour has changed.  gcc -dumpversion
391  # does give us what we want though, so we use that.  We just just the
392  # major and minor version numbers.
393  # peak single digit before and after first dot, e.g. 2.95.1 gives 29
394  GCCVER=`echo $GCCVER | sed 's/\([0-9]\)\.\([0-9]\).*/\1\2/'`
395else
396  CC=cc
397fi
398GCCVER=${GCCVER:-0}
399if [ "$SYSTEM" = "HP-UX" ];then
400  # By default gcc is a ILP32 compiler (with long long == 64).
401  GCC_BITS="32"
402  if [ $GCCVER -ge 30 ]; then
403    # PA64 support only came in with gcc 3.0.x.
404    # We look for the preprocessor symbol __LP64__ indicating
405    # 64bit bit long and pointer.  sizeof(int) == 32 on HPUX64.
406    if gcc -v -E -x c /dev/null 2>&1 | grep __LP64__ > /dev/null; then
407      GCC_BITS="64"
408    fi
409  fi
410fi
411if [ "$SYSTEM" = "SunOS" ]; then
412  # check for WorkShop C, expected output is "cc: blah-blah C x.x"
413  CCVER=`(cc -V 2>&1) 2>/dev/null | \
414  	egrep -e '^cc: .* C [0-9]\.[0-9]' | \
415	sed 's/.* C \([0-9]\)\.\([0-9]\).*/\1\2/'`
416  CCVER=${CCVER:-0}
417  if [ $CCVER -gt 40 ]; then
418    CC=cc	# overrides gcc!!!
419    if [ $CCVER -eq 50 ]; then
420      echo "WARNING! Detected WorkShop C 5.0. Do make sure you have"
421      echo "         patch #107357-01 or later applied."
422      sleep 5
423    fi
424  elif [ "$CC" = "cc" -a $CCVER -gt 0 ]; then
425    CC=sc3
426  fi
427fi
428
429if [ "${SYSTEM}-${MACHINE}" = "Linux-alpha" ]; then
430  # check for Compaq C, expected output is "blah-blah C Vx.x"
431  CCCVER=`(ccc -V 2>&1) 2>/dev/null | \
432	egrep -e '.* C V[0-9]\.[0-9]' | \
433	sed 's/.* C V\([0-9]\)\.\([0-9]\).*/\1\2/'`
434  CCCVER=${CCCVER:-0}
435  if [ $CCCVER -gt 60 ]; then
436    CC=ccc	# overrides gcc!!! well, ccc outperforms inoticeably
437		# only on hash routines and des, otherwise gcc (2.95)
438		# keeps along rather tight...
439  fi
440fi
441
442GCCVER=${GCCVER:-0}
443CCVER=${CCVER:-0}
444
445# read the output of the embedded GuessOS
446read GUESSOS
447
448echo Operating system: $GUESSOS
449
450# now map the output into SSLeay terms ... really should hack into the
451# script above so we end up with values in vars but that would take
452# more time that I want to waste at the moment
453case "$GUESSOS" in
454  mips2-sgi-irix)
455	CPU=`(hinv -t cpu) 2>/dev/null | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'`
456	CPU=${CPU:-0}
457	if [ $CPU -ge 4000 ]; then
458		options="$options -mips2"
459	fi
460	OUT="irix-$CC"
461	;;
462  mips3-sgi-irix)
463	CPU=`(hinv -t cpu) 2>/dev/null | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'`
464	CPU=${CPU:-0}
465	if [ $CPU -ge 5000 ]; then
466		options="$options -mips4"
467	else
468		options="$options -mips3"
469	fi
470	OUT="irix-mips3-$CC"
471	;;
472  mips4-sgi-irix64)
473	echo "WARNING! If you wish to build 64-bit library, then you have to"
474	echo "         invoke './Configure irix64-mips4-$CC' *manually*."
475	echo "         Type return if you want to continue, Ctrl-C to abort."
476	read waste < /dev/tty
477        CPU=`(hinv -t cpu) 2>/dev/null | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'`
478        CPU=${CPU:-0}
479        if [ $CPU -ge 5000 ]; then
480                options="$options -mips4"
481        else
482                options="$options -mips3"
483        fi
484	OUT="irix-mips3-$CC"
485	;;
486  alpha-*-linux2)
487        ISA=`awk '/cpu model/{print$4}' /proc/cpuinfo`
488	case ${ISA:-generic} in
489	*[67])	OUT="linux-alpha+bwx-$CC" ;;
490	*)	OUT="linux-alpha-$CC" ;;
491	esac
492	if [ "$CC" = "gcc" ]; then
493	    case ${ISA:-generic} in
494	    EV5|EV45)		options="$options -mcpu=ev5";;
495	    EV56|PCA56)		options="$options -mcpu=ev56";;
496	    EV6|EV67|PCA57)	options="$options -mcpu=ev6";;
497	    esac
498	fi
499	;;
500  mips-*-linux?)
501          cat >dummy.c <<EOF
502#include <stdio.h>  /* for printf() prototype */
503        int main (argc, argv) int argc; char *argv[]; {
504#ifdef __MIPSEB__
505  printf ("linux-%s\n", argv[1]);
506#endif
507#ifdef __MIPSEL__
508  printf ("linux-%sel\n", argv[1]);
509#endif
510  return 0;
511}
512EOF
513	${CC} -o dummy dummy.c && OUT=`./dummy ${MACHINE}`
514	rm dummy dummy.c
515	;;
516  ppc64-*-linux2)
517	#Use the standard target for PPC architecture until we create a
518	#special one for the 64bit architecture.
519	OUT="linux-ppc" ;;
520  ppc-*-linux2) OUT="linux-ppc" ;;
521  m68k-*-linux*) OUT="linux-m68k" ;;
522  ia64-*-linux?) OUT="linux-ia64" ;;
523  ppc-apple-rhapsody) OUT="rhapsody-ppc-cc" ;;
524  ppc-apple-darwin) OUT="darwin-ppc-cc" ;;
525  sparc64-*-linux2)
526	#Before we can uncomment following lines we have to wait at least
527	#till 64-bit glibc for SPARC is operational:-(
528	#echo "WARNING! If you wish to build 64-bit library, then you have to"
529	#echo "         invoke './Configure linux64-sparcv9' *manually*."
530	#echo "         Type return if you want to continue, Ctrl-C to abort."
531	#read waste < /dev/tty
532	OUT="linux-sparcv9" ;;
533  sparc-*-linux2)
534	KARCH=`awk '/^type/{print$3}' /proc/cpuinfo`
535	case ${KARCH:-sun4} in
536	sun4u*)	OUT="linux-sparcv9" ;;
537	sun4m)	OUT="linux-sparcv8" ;;
538	sun4d)	OUT="linux-sparcv8" ;;
539	*)	OUT="linux-sparcv7" ;;
540	esac ;;
541  parisc-*-linux2)
542        CPUARCH=`awk '/cpu family/{print substr($5,1,3)}' /proc/cpuinfo`
543	CPUSCHEDULE=`awk '/^cpu.[ 	]: PA/{print substr($3,3)}' /proc/cpuinfo`
544
545	# ??TODO ??  Model transformations
546	# 0. CPU Architecture for the 1.1 processor has letter suffixes. We strip that off
547	#    assuming no further arch. identification will ever be used by GCC.
548	# 1. I'm most concerned about whether is a 7300LC is closer to a 7100 versus a 7100LC.
549	# 2. The variant 64-bit processors cause concern should GCC support explicit schedulers
550	#    for these chips in the future.
551	#         PA7300LC -> 7100LC (1.1)
552	#         PA8200   -> 8000   (2.0)
553	#         PA8500   -> 8000   (2.0)
554	#         PA8600   -> 8000   (2.0)
555
556	CPUSCHEDULE=`echo $CPUSCHEDULE|sed -e 's/7300LC/7100LC/' -e 's/8?00/8000/'`
557	# Finish Model transformations
558
559	options="$options -mschedule=$CPUSCHEDULE -march=$CPUARCH"
560	OUT="linux-parisc" ;;
561  arm*-*-linux2) OUT="linux-elf-arm" ;;
562  s390-*-linux2) OUT="linux-s390" ;;
563  s390x-*-linux?) OUT="linux-s390x" ;;
564  *-*-linux2) OUT="linux-elf" ;;
565  *-*-linux1) OUT="linux-aout" ;;
566  sun4u*-*-solaris2)
567	ISA64=`(isalist) 2>/dev/null | grep sparcv9`
568	if [ "$ISA64" != "" -a "$CC" = "cc" -a $CCVER -ge 50 ]; then
569		echo "WARNING! If you wish to build 64-bit library, then you have to"
570		echo "         invoke './Configure solaris64-sparcv9-cc' *manually*."
571		echo "         Type return if you want to continue, Ctrl-C to abort."
572		read waste < /dev/tty
573	fi
574	OUT="solaris-sparcv9-$CC" ;;
575  sun4m-*-solaris2)	OUT="solaris-sparcv8-$CC" ;;
576  sun4d-*-solaris2)	OUT="solaris-sparcv8-$CC" ;;
577  sun4*-*-solaris2)	OUT="solaris-sparcv7-$CC" ;;
578  *86*-*-solaris2) OUT="solaris-x86-$CC" ;;
579  *-*-sunos4) OUT="sunos-$CC" ;;
580  alpha*-*-freebsd*) OUT="FreeBSD-alpha" ;;
581  *-freebsd[3-9]*) OUT="FreeBSD-elf" ;;
582  *-freebsd[1-2]*) OUT="FreeBSD" ;;
583  *86*-*-netbsd) OUT="NetBSD-x86" ;;
584  sun3*-*-netbsd) OUT="NetBSD-m68" ;;
585  *-*-netbsd) OUT="NetBSD-sparc" ;;
586  *86*-*-openbsd) OUT="OpenBSD-x86" ;;
587  alpha*-*-openbsd) OUT="OpenBSD-alpha" ;;
588  pmax*-*-openbsd) OUT="OpenBSD-mips" ;;
589  *-*-openbsd) OUT="OpenBSD" ;;
590  *86*-*-bsdi4) OUT="bsdi-elf-gcc" ;;
591  *-*-osf) OUT="alphaold-cc" ;;
592  *-*-tru64) OUT="alpha-cc" ;;
593  *-*-OpenUNIX*)
594	if [ "$CC" = "gcc" ]; then
595	  OUT="OpenUNIX-8-gcc"
596	else
597	  OUT="OpenUNIX-8"
598	fi
599	;;
600  *-*-unixware7) OUT="unixware-7" ;;
601  *-*-UnixWare7) OUT="unixware-7" ;;
602  *-*-Unixware7) OUT="unixware-7" ;;
603  *-*-unixware20*) OUT="unixware-2.0" ;;
604  *-*-unixware21*) OUT="unixware-2.1" ;;
605  *-*-UnixWare20*) OUT="unixware-2.0" ;;
606  *-*-UnixWare21*) OUT="unixware-2.1" ;;
607  *-*-Unixware20*) OUT="unixware-2.0" ;;
608  *-*-Unixware21*) OUT="unixware-2.1" ;;
609  BS2000-siemens-sysv4) OUT="BS2000-OSD" ;;
610  RM*-siemens-sysv4) OUT="ReliantUNIX" ;;
611  *-siemens-sysv4) OUT="SINIX" ;;
612  *-hpux1*)
613	if [ $CC = "gcc" ];
614	then
615	  if [ $GCC_BITS = "64" ]; then
616	    OUT="hpux64-parisc-gcc"
617	  else
618	    OUT="hpux-parisc-gcc"
619	  fi
620	else
621	  OUT="hpux-parisc-$CC"
622	fi
623	options="$options -D_REENTRANT" ;;
624  *-hpux)	OUT="hpux-parisc-$CC" ;;
625  # these are all covered by the catchall below
626  # *-aix) OUT="aix-$CC" ;;
627  # *-dgux) OUT="dgux" ;;
628  mips-sony-newsos4) OUT="newsos4-gcc" ;;
629  *-*-cygwin_pre1.3) OUT="Cygwin-pre1.3" ;;
630  *-*-cygwin) OUT="Cygwin" ;;
631  t3e-cray-unicosmk) OUT="cray-t3e" ;;
632  j90-cray-unicos) OUT="cray-j90" ;;
633  *) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
634esac
635
636# See whether we can compile Atalla support
637if [ -f /usr/include/atasi.h ]
638then
639  options="$options -DATALLA"
640fi
641
642# gcc < 2.8 does not support -mcpu=ultrasparc
643if [ "$OUT" = solaris-sparcv9-gcc -a $GCCVER -lt 28 ]
644then
645  echo "WARNING! Do consider upgrading to gcc-2.8 or later."
646  sleep 5
647  OUT=solaris-sparcv9-gcc27
648fi
649if [ "$OUT" = "linux-sparcv9" -a $GCCVER -lt 28 ]
650then
651  echo "WARNING! Falling down to 'linux-sparcv8'."
652  echo "         Upgrade to gcc-2.8 or later."
653  sleep 5
654  OUT=linux-sparcv8
655fi
656
657case "$GUESSOS" in
658  i386-*) options="$options 386" ;;
659esac
660
661for i in bf cast des dh dsa hmac idea md2 md5 mdc2 rc2 rc4 rc5 ripemd rsa sha
662do
663  if [ ! -d crypto/$i ]
664  then
665    options="$options no-$i"
666  fi
667done
668
669if [ -z "$OUT" ]; then
670  OUT="$CC"
671fi
672
673if [ ".$PERL" = . ] ; then
674	for i in . `echo $PATH | sed 's/:/ /g'`; do
675		if [ -f "$i/perl5" ] ; then
676			PERL="$i/perl5"
677			break;
678		fi;
679	done
680fi
681
682if [ ".$PERL" = . ] ; then
683	for i in . `echo $PATH | sed 's/:/ /g'`; do
684		if [ -f "$i/perl" ] ; then
685			if "$i/perl" -e 'exit($]<5.0)'; then
686				PERL="$i/perl"
687				break;
688			fi;
689		fi;
690	done
691fi
692
693if [ ".$PERL" = . ] ; then
694	echo "You need Perl 5."
695	exit 1
696fi
697
698# run Configure to check to see if we need to specify the
699# compiler for the platform ... in which case we add it on
700# the end ... otherwise we leave it off
701
702$PERL ./Configure LIST | grep "$OUT-$CC" > /dev/null
703if [ $? = "0" ]; then
704  OUT="$OUT-$CC"
705fi
706
707OUT="$PREFIX$OUT"
708
709$PERL ./Configure LIST | grep "$OUT" > /dev/null
710if [ $? = "0" ]; then
711  echo Configuring for $OUT
712
713  if [ "$TEST" = "true" ]; then
714    echo $PERL ./Configure $OUT $options
715  else
716    $PERL ./Configure $OUT $options
717  fi
718else
719  echo "This system ($OUT) is not supported. See file INSTALL for details."
720fi
721)
722