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 "i486-whatever-freebsd"; exit 0
133 echo "${MACHINE}-whatever-freebsd"; exit 0
137 echo "i486-whatever-netbsd"; exit 0
141 echo "${MACHINE}-whatever-netbsd"; exit 0
145 echo "${MACHINE}-whatever-openbsd"; exit 0
149 echo "${MACHINE}-dec-osf"; exit 0
155 echo "${MACHINE}-qssl-qnx32"
158 echo "${MACHINE}-qssl-qnx"
165 echo "i860-intel-osf1"; exit 0
169 echo "${MACHINE}-sun-solaris2"; exit 0
173 echo "${MACHINE}-sun-sunos4"; exit 0
177 echo "${MACHINE}-whatever-sysv4"; exit 0
181 echo "${MACHINE}-whatever-sysv4"; exit 0
185 echo "${MACHINE}-whatever-sysv4"; exit 0
188 *:4.0:3.0:3[34]?? | *:4.0:3.0:3[34]??,*)
189 echo "i486-ncr-sysv4"; exit 0
193 echo "${MACHINE}-unknown-ultrix"; exit 0
197 echo "${MACHINE}-sni-sysv4"; exit 0
201 echo "${MACHINE}-tenon-${SYSTEM}"; exit 0;
205 echo "${MACHINE}-ncr-sysv4"; exit 0
209 echo "${MACHINE}-v11-${SYSTEM}"; exit 0;
215 # Ugg. These are all we can determine by what we know about
216 # the output of uname. Be more creative:
219 # Do the Apollo stuff first. Here, we just simply assume
220 # that the existance of the /usr/apollo directory is proof
222 if [ -d /usr/apollo ]; then
223 echo "whatever-apollo-whatever"
228 ISNEXT=`hostinfo 2>/dev/null`
231 echo "whatever-next-nextstep"; exit 0
235 # At this point we gone through all the one's
238 echo "${MACHINE}-whatever-${SYSTEM}|${RELEASE}|${VERSION}"
242 # ---------------------------------------------------------------------------
243 # this is where the translation occurs into SSLeay terms
244 # ---------------------------------------------------------------------------
251 # pick up any command line args to config
255 -d*) PREFIX="debug-";;
256 -v*) VERBOSE="true";;
259 usage: config [options]
260 -d Add a debug- prefix to machine choice.
262 -t Test mode, do not run the Configure perl script.
265 Any other text will be passed to ther Configure perl script.
266 Usefull options include
267 no-asm Build with no assember code.
268 -Dxxx Add xxx define to compilation.
269 -Lxxx Add xxx library include path to build.
270 -lxxx Add xxx library to build.
272 eg, to build using RSAref, without assember, building to allow anon-DH
273 ciphers and null encryption ciphers,
274 config no-asm -DRSAref -DSSL_ALLOW_ADH -DSSL_ALLOW_ENULL -lrsaref
277 *) options=$options" $i" ;;
281 # figure out if gcc is available and if so we use it otherwise
282 # we fallback to whatever cc does on the system
284 if [ $? = "0" ]; then
290 # read the output of the embedded GuessOS
293 if [ "$VERBOSE" = "true" ]; then
294 echo GUESSOS $GUESSOS
297 # now map the output into SSLeay terms ... really should hack into the
298 # script above so we end up with values in vars but that would take
299 # more time that I want to waste at the moment
301 alpha-*-linux2) OUT="alpha-gcc" ;;
302 *-*-linux2) OUT="linux-elf" ;;
303 *-*-linux) OUT="linux-aout" ;;
304 sun4*-sun-solaris2) OUT="solaris-sparc-$CC" ;;
305 *86*-sun-solaris2) OUT="solaris-x86-$CC" ;;
306 *-*-sunos4) OUT="sunos-$CC" ;;
307 *-freebsd) OUT="FreeBSD" ;;
308 *86*-*-netbsd) OUT="NetBSD-x86" ;;
309 sun3*-*-netbsd) OUT="NetBSD-m68" ;;
310 *-*-netbsd) OUT="NetBSD-sparc" ;;
311 *86*-*-openbsd) OUT="OpenBSD-x86" ;;
312 alpha*-*-openbsd) OUT="OpenBSD-alpha" ;;
313 pmax*-*-openbsd) OUT="OpenBSD-mips" ;;
314 *-*-openbsd) OUT="OpenBSD" ;;
315 *-*-osf) OUT="alpha-cc" ;;
316 *-*-unixware*) OUT="unixware-2.0" ;;
317 *-sni-sysv4) OUT="SINIX" ;;
318 *-hpux*) OUT="hpux-$CC" ;;
319 # these are all covered by the catchall below
320 # *-aix) OUT="aix-$CC" ;;
321 # *-dgux) OUT="dgux" ;;
322 *) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
325 if [ -z "$OUT" ]; then
329 # run Configure to check to see if we need to specify the
330 # compiler for the platform ... in which case we add it on
331 # the end ... otherwise we leave it off
332 perl ./Configure 2>&1 | grep "$OUT-$CC" > /dev/null
333 if [ $? = "0" ]; then
339 # at this point we have the answer ... which we could check again
340 # and then fallback to a vanilla SSLeay build but then this script
341 # wouldn't get updated
342 echo Configuring for $OUT
344 if [ "$TEST" = "true" ]; then
345 echo ./Configure $OUT $options
347 perl ./Configure $OUT $options