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 # 16-Sep-97 tjh first cut of merged version
13 # Original Apache Group comments on GuessOS
15 # Simple OS/Platform guesser. Similar to config.guess but
16 # much, much smaller. Since it was developed for use with
17 # Apache, it follows under Apache's regular licensing
18 # with one specific addition: Any changes or additions
19 # to this script should be Emailed to the Apache
20 # group (apache@apache.org) in general and to
21 # Jim Jagielski (jim@jaguNET.com) in specific.
23 # Be as similar to the output of config.guess/config.sub
26 # First get uname entries that we use below
28 MACHINE=`(uname -m) 2>/dev/null` || MACHINE="unknown"
29 RELEASE=`(uname -r) 2>/dev/null` || RELEASE="unknown"
30 SYSTEM=`(uname -s) 2>/dev/null` || SYSTEM="unknown"
31 VERSION=`(uname -v) 2>/dev/null` || VERSION="unknown"
34 # Now test for ISC and SCO, since it is has a braindamaged uname.
36 # We need to work around FreeBSD 1.1.5.1
38 XREL=`uname -X 2>/dev/null | grep "^Release" | awk '{print $3}'`
39 if [ "x$XREL" != "x" ]; then
40 if [ -f /etc/kconfig ]; then
43 echo "${MACHINE}-whatever-isc4"; exit 0
49 echo "whatever-whatever-sco3"; exit 0
52 echo "whatever-whatever-sco5"; exit 0
55 if [ "x$VERSION" = "x2.1.1" ]; then
56 echo "${MACHINE}-whatever-unixware211"; exit 0
58 echo "${MACHINE}-whatever-unixware2"; exit 0
62 echo "whatever-whatever-unixware1"; exit 0
67 # Now we simply scan though... In most cases, the SYSTEM info is enough
69 case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
71 echo "m68k-apple-aux3"; exit 0
75 echo "${MACHINE}-ibm-aix"; exit 0
79 echo "${MACHINE}-dg-dgux"; exit 0
83 echo "${MACHINE}-hi-hiux"; exit 0
87 HPUXVER=`echo ${RELEASE}|sed -e 's/[^.]*.[0B]*//'`
90 echo "${MACHINE}-hp-hpux10."; exit 0
93 echo "${MACHINE}-hp-hpux"; exit 0
99 echo "${MACHINE}-sgi-irix"; exit 0
103 echo "${MACHINE}-sgi-irix64"; exit 0
107 echo "${MACHINE}-whatever-linux2"; exit 0
111 echo "${MACHINE}-whatever-linux1"; exit 0
115 echo "${MACHINE}-lynx-lynxos"; exit 0
118 BSD/386:*:*:*486*|BSD/OS:*:*:*:*486*)
119 echo "i486-whatever-bsdi"; exit 0
123 echo "${MACHINE}-whatever-bsdi"; exit 0
127 echo "i486-whatever-freebsd"; exit 0
131 echo "${MACHINE}-whatever-freebsd"; exit 0
135 echo "i486-whatever-netbsd"; exit 0
139 echo "${MACHINE}-whatever-netbsd"; exit 0
143 echo "${MACHINE}-whatever-openbsd"; exit 0
147 echo "${MACHINE}-dec-osf"; exit 0
153 echo "${MACHINE}-qssl-qnx32"
156 echo "${MACHINE}-qssl-qnx"
163 echo "i860-intel-osf1"; exit 0
167 echo "${MACHINE}-sun-solaris2"; exit 0
171 echo "${MACHINE}-sun-sunos4"; exit 0
175 echo "${MACHINE}-whatever-sysv4"; exit 0
179 echo "${MACHINE}-whatever-sysv4"; exit 0
183 echo "${MACHINE}-whatever-sysv4"; exit 0
186 *:4.0:3.0:3[34]?? | *:4.0:3.0:3[34]??,*)
187 echo "i486-ncr-sysv4"; exit 0
191 echo "${MACHINE}-unknown-ultrix"; exit 0
195 echo "${MACHINE}-sni-sysv4"; exit 0
199 echo "${MACHINE}-tenon-${SYSTEM}"; exit 0;
203 echo "${MACHINE}-ncr-sysv4"; exit 0
207 echo "${MACHINE}-v11-${SYSTEM}"; exit 0;
213 # Ugg. These are all we can determine by what we know about
214 # the output of uname. Be more creative:
217 # Do the Apollo stuff first. Here, we just simply assume
218 # that the existance of the /usr/apollo directory is proof
220 if [ -d /usr/apollo ]; then
221 echo "whatever-apollo-whatever"
226 ISNEXT=`hostinfo 2>/dev/null`
229 echo "whatever-next-nextstep"; exit 0
233 # At this point we gone through all the one's
236 echo "${MACHINE}-whatever-${SYSTEM}|${RELEASE}|${VERSION}"
240 # ---------------------------------------------------------------------------
241 # this is where the translation occurs into SSLeay terms
242 # ---------------------------------------------------------------------------
249 # pick up any command line args to config
253 -d*) PREFIX="debug-";;
254 -v*) VERBOSE="true";;
255 -n*|-t*) TEST="true";;
259 # figure out if gcc is available and if so we use it otherwise
260 # we fallback to whatever cc does on the system
262 if [ $? = "0" ]; then
268 # read the output of the embedded GuessOS
271 if [ "$VERBOSE" = "true" ]; then
272 echo GUESSOS $GUESSOS
275 # now map the output into SSLeay terms ... really should hack into the
276 # script above so we end up with values in vars but that would take
277 # more time that I want to waste at the moment
279 *-*-linux2) OUT="linux-elf" ;;
280 *-*-linux) OUT="linux-aout" ;;
281 sun4*-sun-solaris2) OUT="solaris-sparc-$CC" ;;
282 *86*-sun-solaris2) OUT="solaris-x86-$CC" ;;
283 *-*-sunos4) OUT="sunos-$CC" ;;
284 *-freebsd) OUT="FreeBSD" ;;
285 *86*-*-netbsd) OUT="NetBSD-x86" ;;
286 sun3*-*-netbsd) OUT="NetBSD-m68" ;;
287 *-*-netbsd) OUT="NetBSD-sparc" ;;
288 *-*-osf) OUT="alpha-$CC" ;;
289 *-*-unixware*) OUT="unixware-2.0" ;;
290 *-sni-sysv4) OUT="SINIX" ;;
291 # these are all covered by the catchall below
292 # *-hpux) OUT="hpux-$CC" ;;
293 # *-aix) OUT="aix-$CC" ;;
294 # *-dgux) OUT="dgux" ;;
295 *) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
298 if [ -z "$OUT" ]; then
302 # run Configure to check to see if we need to specify the
303 # compiler for the platform ... in which case we add it on
304 # the end ... otherwise we leave it off
305 ./Configure 2>&1 | grep '$OUT-$CC' > /dev/null
306 if [ $? = "0" ]; then
312 # at this point we have the answer ... which we could check again
313 # and then fallback to a vanilla SSLeay build but then this script
314 # wouldn't get updated
315 echo Configuring for $OUT
317 if [ "$TEST" = "true" ]; then
318 echo ./Configure $OUT