| 1 | #! /bin/sh
|
|---|
| 2 | # Attempt to guess a canonical system name.
|
|---|
| 3 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
|---|
| 4 | # 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
|---|
| 5 |
|
|---|
| 6 | timestamp='2003-01-30'
|
|---|
| 7 |
|
|---|
| 8 | # This file is free software; you can redistribute it and/or modify it
|
|---|
| 9 | # under the terms of the GNU General Public License as published by
|
|---|
| 10 | # the Free Software Foundation; either version 2 of the License, or
|
|---|
| 11 | # (at your option) any later version.
|
|---|
| 12 | #
|
|---|
| 13 | # This program is distributed in the hope that it will be useful, but
|
|---|
| 14 | # WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 16 | # General Public License for more details.
|
|---|
| 17 | #
|
|---|
| 18 | # You should have received a copy of the GNU General Public License
|
|---|
| 19 | # along with this program; if not, write to the Free Software
|
|---|
| 20 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|---|
| 21 | #
|
|---|
| 22 | # As a special exception to the GNU General Public License, if you
|
|---|
| 23 | # distribute this file as part of a program that contains a
|
|---|
| 24 | # configuration script generated by Autoconf, you may include it under
|
|---|
| 25 | # the same distribution terms that you use for the rest of that program.
|
|---|
| 26 |
|
|---|
| 27 | # Originally written by Per Bothner <[email protected]>.
|
|---|
| 28 | # Please send patches to <[email protected]>. Submit a context
|
|---|
| 29 | # diff and a properly formatted ChangeLog entry.
|
|---|
| 30 | #
|
|---|
| 31 | # This script attempts to guess a canonical system name similar to
|
|---|
| 32 | # config.sub. If it succeeds, it prints the system name on stdout, and
|
|---|
| 33 | # exits with 0. Otherwise, it exits with 1.
|
|---|
| 34 | #
|
|---|
| 35 | # The plan is that this can be called by configure scripts if you
|
|---|
| 36 | # don't specify an explicit build system type.
|
|---|
| 37 |
|
|---|
| 38 | me=`echo "$0" | sed -e 's,.*/,,'`
|
|---|
| 39 |
|
|---|
| 40 | usage="\
|
|---|
| 41 | Usage: $0 [OPTION]
|
|---|
| 42 |
|
|---|
| 43 | Output the configuration name of the system \`$me' is run on.
|
|---|
| 44 |
|
|---|
| 45 | Operation modes:
|
|---|
| 46 | -h, --help print this help, then exit
|
|---|
| 47 | -t, --time-stamp print date of last modification, then exit
|
|---|
| 48 | -v, --version print version number, then exit
|
|---|
| 49 |
|
|---|
| 50 | Report bugs and patches to <[email protected]>."
|
|---|
| 51 |
|
|---|
| 52 | version="\
|
|---|
| 53 | GNU config.guess ($timestamp)
|
|---|
| 54 |
|
|---|
| 55 | Originally written by Per Bothner.
|
|---|
| 56 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
|---|
| 57 | Free Software Foundation, Inc.
|
|---|
| 58 |
|
|---|
| 59 | This is free software; see the source for copying conditions. There is NO
|
|---|
| 60 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
|---|
| 61 |
|
|---|
| 62 | help="
|
|---|
| 63 | Try \`$me --help' for more information."
|
|---|
| 64 |
|
|---|
| 65 | # Parse command line
|
|---|
| 66 | while test $# -gt 0 ; do
|
|---|
| 67 | case $1 in
|
|---|
| 68 | --time-stamp | --time* | -t )
|
|---|
| 69 | echo "$timestamp" ; exit 0 ;;
|
|---|
| 70 | --version | -v )
|
|---|
| 71 | echo "$version" ; exit 0 ;;
|
|---|
| 72 | --help | --h* | -h )
|
|---|
| 73 | echo "$usage"; exit 0 ;;
|
|---|
| 74 | -- ) # Stop option processing
|
|---|
| 75 | shift; break ;;
|
|---|
| 76 | - ) # Use stdin as input.
|
|---|
| 77 | break ;;
|
|---|
| 78 | -* )
|
|---|
| 79 | echo "$me: invalid option $1$help" >&2
|
|---|
| 80 | exit 1 ;;
|
|---|
| 81 | * )
|
|---|
| 82 | break ;;
|
|---|
| 83 | esac
|
|---|
| 84 | done
|
|---|
| 85 |
|
|---|
| 86 | if test $# != 0; then
|
|---|
| 87 | echo "$me: too many arguments$help" >&2
|
|---|
| 88 | exit 1
|
|---|
| 89 | fi
|
|---|
| 90 |
|
|---|
| 91 | trap 'exit 1' 1 2 15
|
|---|
| 92 |
|
|---|
| 93 | # CC_FOR_BUILD -- compiler used by this script. Note that the use of a
|
|---|
| 94 | # compiler to aid in system detection is discouraged as it requires
|
|---|
| 95 | # temporary files to be created and, as you can see below, it is a
|
|---|
| 96 | # headache to deal with in a portable fashion.
|
|---|
| 97 |
|
|---|
| 98 | # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
|
|---|
| 99 | # use `HOST_CC' if defined, but it is deprecated.
|
|---|
| 100 |
|
|---|
| 101 | # Portable tmp directory creation inspired by the Autoconf team.
|
|---|
| 102 |
|
|---|
| 103 | set_cc_for_build='
|
|---|
| 104 | trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
|
|---|
| 105 | trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
|
|---|
| 106 | : ${TMPDIR=/tmp} ;
|
|---|
| 107 | { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
|
|---|
| 108 | { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
|
|---|
| 109 | { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
|
|---|
| 110 | dummy=$tmp/dummy ;
|
|---|
| 111 | tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
|
|---|
| 112 | case $CC_FOR_BUILD,$HOST_CC,$CC in
|
|---|
| 113 | ,,) echo "int x;" > $dummy.c ;
|
|---|
| 114 | for c in cc gcc c89 c99 ; do
|
|---|
|
|---|