usage: Print metavariables in SHOUTY letters.
[sw-tools] / sw.in
CommitLineData
3315e8b3 1#! /bin/sh
2
3# -*-sh-*-
4#
9796a787 5# $Id: sw.in,v 1.2 2004/04/08 01:52:19 mdw Exp $
3315e8b3 6#
7# Determine a canonical `sw' architecture name
8#
9# MAKE SURE I GET UPDATED WHEN NEW ARCHITECTURES ARE ADDED!
10#
11# (c) 1999 EBI
12#
13
14#----- Licensing notice -----------------------------------------------------
15#
16# This file is part of sw-tools.
17#
18# sw-tools is free software; you can redistribute it and/or modify
19# it under the terms of the GNU General Public License as published by
20# the Free Software Foundation; either version 2 of the License, or
21# (at your option) any later version.
22#
23# sw-tools is distributed in the hope that it will be useful,
24# but WITHOUT ANY WARRANTY; without even the implied warranty of
25# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26# GNU General Public License for more details.
27#
28# You should have received a copy of the GNU General Public License
29# along with sw-tools; if not, write to the Free Software Foundation,
30# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31
3315e8b3 32# --- Commentary ---
33#
34# This is deliberately *not* the same as Autoconf's `config.guess'. The GNU
35# names are too specific for our purposes, because they encode version
36# numbering information that we don't really want to know about. This
37# operation is deliberately simple, so that new things can be added easily.
38
39# --- Step one: find out about the CPU architecture ---
40
568ab77d 41CPU=`uname -p 2>/dev/null || echo unknown`; CPU=`echo $CPU | tr A-Z a-z`
3315e8b3 42case $CPU in
43 unknown) CPU=`uname -m` ;;
44esac
45
46case $CPU in
47 i?86) CPU=i386 ;;
48esac
49
50# --- Step two: find out about the OS ---
51
52OS=`uname -s`; OS=`echo $OS | tr A-Z a-z`
53
54case $OS in
55 irix*) OS=irix ;;
56 sunos*) OS=solaris ;;
57esac
58
59# --- Write the result ---
60
61arch=$CPU-$OS
62case "$1" in --archname) echo $arch; exit 0;; esac
63
64# --- Run the main `sw' binary ---
65#
66# Ugly hack for broken OSF1 /bin/sh.
67
68prefix=@prefix@
69datadir=@datadir@
70sw=@SW@
71if [ $# = 0 ]; then
72 exec "${datadir}/libexec/${arch}/${sw}"
73else
74 exec "${datadir}/libexec/${arch}/${sw}" "$@"
75fi
76
77#----- That's all, folks ----------------------------------------------------