3 # config - this is a merge of minarch and GuessOS from the Apache Group
4 # which then automatically runs Configure from SSLeay after
5 # mapping the Apache names for OSs into SSLeay names
7 # 29-May-97 eay Added no-asm option
8 # 27-May-97 eay Alpha linux mods
9 # ??-May-97 eay IRIX mods
10 # 16-Sep-97 tjh first cut of merged version
16 # Original Apache Group comments on GuessOS
18 # Simple OS/Platform guesser. Similar to config.guess but
19 # much, much smaller. Since it was developed for use with
20 # Apache, it follows under Apache's regular licensing
21 # with one specific addition: Any changes or additions
22 # to this script should be Emailed to the Apache
23 # group (apache@apache.org) in general and to
24 # Jim Jagielski (jim@jaguNET.com) in specific.
26 # Be as similar to the output of config.guess/config.sub
29 # First get uname entries that we use below
31 MACHINE=`(uname -m) 2>/dev/null` || MACHINE="unknown"
32 RELEASE=`(uname -r) 2>/dev/null` || RELEASE="unknown"
33 SYSTEM=`(uname -s) 2>/dev/null` || SYSTEM="unknown"
34 VERSION=`(uname -v) 2>/dev/null` || VERSION="unknown"
36 # Now test for ISC and SCO, since it is has a braindamaged uname.
38 # We need to work around FreeBSD 1.1.5.1
40 XREL=`uname -X 2>/dev/null | grep "^Release" | awk '{print $3}'`
41 if [ "x$XREL" != "x" ]; then
42 if [ -f /etc/kconfig ]; then
45 echo "${MACHINE}-whatever-isc4"; exit 0
51 echo "whatever-whatever-sco3"; exit 0
54 echo "whatever-whatever-sco5"; exit 0
57 if [ "x$VERSION" = "x2.1.1" ]; then
58 echo "${MACHINE}-whatever-unixware211"; exit 0
60 echo "${MACHINE}-whatever-unixware2"; exit 0
64 echo "whatever-whatever-unixware1"; exit 0
69 # Now we simply scan though... In most cases, the SYSTEM info is enough
71 case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
73 echo "m68k-apple-aux3"; exit 0
77 echo "${MACHINE}-ibm-aix"; exit 0
81 echo "${MACHINE}-dg-dgux"; exit 0
85 echo "${MACHINE}-hi-hiux"; exit 0
89 HPUXVER=`echo ${RELEASE}|sed -e 's/[^.]*.[0B]*//'`
92 echo "${MACHINE}-hp-hpux10."; exit 0
95 echo "${MACHINE}-hp-hpux"; exit 0
101 echo "${MACHINE}-sgi-irix"; exit 0
105 echo "${MACHINE}-sgi-irix64"; exit 0
109 echo "${MACHINE}-whatever-linux2"; exit 0
113 echo "${MACHINE}-whatever-linux1"; exit 0
117 echo "${MACHINE}-lynx-lynxos"; exit 0
120 BSD/386:*:*:*486*|BSD/OS:*:*:*:*486*)
121 echo "i486-whatever-bsdi"; exit 0
125 echo "${MACHINE}-whatever-bsdi"; exit 0
129 echo "${MACHINE}-whatever-freebsd3"; exit 0
133 echo "i486-whatever-freebsd"; exit 0
137 echo "${MACHINE}-whatever-freebsd"; exit 0
141 echo "i486-whatever-netbsd"; exit 0
145 echo "${MACHINE}-whatever-netbsd"; exit 0
149 echo "${MACHINE}-whatever-openbsd"; exit 0
153 echo "${MACHINE}-dec-osf"; exit 0
159 echo "${MACHINE}-qssl-qnx32"
162 echo "${MACHINE}-qssl-qnx"
169 echo "i860-intel-osf1"; exit 0
173 echo "${MACHINE}-sun-solaris2"; exit 0
177 echo "${MACHINE}-sun-sunos4"; exit 0
181 echo "${MACHINE}-whatever-sysv4"; exit 0
185 echo "${MACHINE}-whatever-sysv4"; exit 0
189 echo "${MACHINE}-whatever-sysv4"; exit 0
192 *:4.0:3.0:3[34]?? | *:4.0:3.0:3[34]??,*)
193 echo "i486-ncr-sysv4"; exit 0
197 echo "${MACHINE}-unknown-ultrix"; exit 0
201 echo "${MACHINE}-sni-sysv4"; exit 0
205 echo "${MACHINE}-tenon-${SYSTEM}"; exit 0;
209 echo "${MACHINE}-ncr-sysv4"; exit 0
213 echo "${MACHINE}-v11-${SYSTEM}"; exit 0;
219 # Ugg. These are all we can determine by what we know about
220 # the output of uname. Be more creative:
223 # Do the Apollo stuff first. Here, we just simply assume
224 # that the existance of the /usr/apollo directory is proof
226 if [ -d /usr/apollo ]; then
227 echo "whatever-apollo-whatever"
232 ISNEXT=`hostinfo 2>/dev/null`
235 echo "whatever-next-nextstep"; exit 0
239 # At this point we gone through all the one's
242 echo "${MACHINE}-whatever-${SYSTEM}|${RELEASE}|${VERSION}"
246 # ---------------------------------------------------------------------------
247 # this is where the translation occurs into SSLeay terms
248 # ---------------------------------------------------------------------------
255 # pick up any command line args to config
259 -d*) PREFIX="debug-";;
260 -v*) VERBOSE="true";;
263 usage: config [options]
264 -d Add a debug- prefix to machine choice.
266 -t Test mode, do not run the Configure perl script.
269 Any other text will be passed to the Configure perl script.
270 Usefull options include
271 no-asm Build with no assember code.
272 -Dxxx Add xxx define to compilation.
273 -Lxxx Add xxx library include path to build.
274 -lxxx Add xxx library to build.
276 eg, to build using RSAref, without assember, building to allow anon-DH
277 ciphers and null encryption ciphers,
278 config no-asm -DRSAref -DSSL_ALLOW_ADH -DSSL_ALLOW_ENULL -lrsaref
281 *) options=$options" $i" ;;
285 # figure out if gcc is available and if so we use it otherwise
286 # we fallback to whatever cc does on the system
287 GCCVER=`(gcc -v) 2>&1`
288 if [ $? = "0" ]; then
294 # read the output of the embedded GuessOS
297 if [ "$VERBOSE" = "true" ]; then
298 echo GUESSOS $GUESSOS
301 # now map the output into SSLeay terms ... really should hack into the
302 # script above so we end up with values in vars but that would take
303 # more time that I want to waste at the moment
305 alpha-*-linux2) OUT="alpha-gcc" ;;
306 ppc-*-linux2) OUT="linux-ppc" ;;
307 *-*-linux2) OUT="linux-elf" ;;
308 *-*-linux1) OUT="linux-aout" ;;
309 sun4*-sun-solaris2) OUT="solaris-sparc-$CC" ;;
310 *86*-sun-solaris2) OUT="solaris-x86-$CC" ;;
311 *-*-sunos4) OUT="sunos-$CC" ;;
312 *-freebsd3) OUT="FreeBSD-elf" ;;
313 *-freebsd) OUT="FreeBSD" ;;
314 *86*-*-netbsd) OUT="NetBSD-x86" ;;
315 sun3*-*-netbsd) OUT="NetBSD-m68" ;;
316 *-*-netbsd) OUT="NetBSD-sparc" ;;
317 *86*-*-openbsd) OUT="OpenBSD-x86" ;;
318 alpha*-*-openbsd) OUT="OpenBSD-alpha" ;;
319 pmax*-*-openbsd) OUT="OpenBSD-mips" ;;
320 *-*-openbsd) OUT="OpenBSD" ;;
321 *-*-osf) OUT="alpha-cc" ;;
322 *-*-unixware*) OUT="unixware-2.0" ;;
323 *-sni-sysv4) OUT="SINIX" ;;
324 *-hpux*) OUT="hpux-$CC" ;;
325 # these are all covered by the catchall below
326 # *-aix) OUT="aix-$CC" ;;
327 # *-dgux) OUT="dgux" ;;
328 *) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
331 if [ -z "$OUT" ]; then
335 if [ ".$PERL" = . ] ; then
336 for i in . `echo $PATH | sed 's/:/ /g'`; do
337 if [ -f "$i/perl5" ] ; then
344 if [ ".$PERL" = . ] ; then
345 for i in . `echo $PATH | sed 's/:/ /g'`; do
346 if [ -f "$i/perl" ] ; then
353 if $PERL -e 'exit($]>=5.0);' ; then
354 echo "You need Perl 5."
358 # run Configure to check to see if we need to specify the
359 # compiler for the platform ... in which case we add it on
360 # the end ... otherwise we leave it off
362 $PERL ./Configure 2>&1 | grep "$OUT-$CC" > /dev/null
363 if [ $? = "0" ]; then
369 # at this point we have the answer ... which we could check again
370 # and then fallback to a vanilla SSLeay build but then this script
371 # wouldn't get updated
372 echo Configuring for $OUT
374 if [ "$TEST" = "true" ]; then
375 echo $PERL ./Configure $OUT $options
377 $PERL ./Configure $OUT $options