usage: Print metavariables in SHOUTY letters.
[sw-tools] / sw.in
1 #! /bin/sh
2
3 # -*-sh-*-
4 #
5 # $Id: sw.in,v 1.2 2004/04/08 01:52:19 mdw Exp $
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
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
41 CPU=`uname -p 2>/dev/null || echo unknown`; CPU=`echo $CPU | tr A-Z a-z`
42 case $CPU in
43 unknown) CPU=`uname -m` ;;
44 esac
45
46 case $CPU in
47 i?86) CPU=i386 ;;
48 esac
49
50 # --- Step two: find out about the OS ---
51
52 OS=`uname -s`; OS=`echo $OS | tr A-Z a-z`
53
54 case $OS in
55 irix*) OS=irix ;;
56 sunos*) OS=solaris ;;
57 esac
58
59 # --- Write the result ---
60
61 arch=$CPU-$OS
62 case "$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
68 prefix=@prefix@
69 datadir=@datadir@
70 sw=@SW@
71 if [ $# = 0 ]; then
72 exec "${datadir}/libexec/${arch}/${sw}"
73 else
74 exec "${datadir}/libexec/${arch}/${sw}" "$@"
75 fi
76
77 #----- That's all, folks ----------------------------------------------------