Initial revision
[sw-tools] / sw.in
CommitLineData
3315e8b3 1#! /bin/sh
2
3# -*-sh-*-
4#
5# $Id: sw.in,v 1.1 1999/06/02 16:53:32 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#----- Revision history -----------------------------------------------------
33#
34# $Log: sw.in,v $
35# Revision 1.1 1999/06/02 16:53:32 mdw
36# Initial revision
37#
38
39# --- Commentary ---
40#
41# This is deliberately *not* the same as Autoconf's `config.guess'. The GNU
42# names are too specific for our purposes, because they encode version
43# numbering information that we don't really want to know about. This
44# operation is deliberately simple, so that new things can be added easily.
45
46# --- Step one: find out about the CPU architecture ---
47
48CPU=`uname -p`; CPU=`echo $CPU | tr A-Z a-z`
49case $CPU in
50 unknown) CPU=`uname -m` ;;
51esac
52
53case $CPU in
54 i?86) CPU=i386 ;;
55esac
56
57# --- Step two: find out about the OS ---
58
59OS=`uname -s`; OS=`echo $OS | tr A-Z a-z`
60
61case $OS in
62 irix*) OS=irix ;;
63 sunos*) OS=solaris ;;
64esac
65
66# --- Write the result ---
67
68arch=$CPU-$OS
69case "$1" in --archname) echo $arch; exit 0;; esac
70
71# --- Run the main `sw' binary ---
72#
73# Ugly hack for broken OSF1 /bin/sh.
74
75prefix=@prefix@
76datadir=@datadir@
77sw=@SW@
78if [ $# = 0 ]; then
79 exec "${datadir}/libexec/${arch}/${sw}"
80else
81 exec "${datadir}/libexec/${arch}/${sw}" "$@"
82fi
83
84#----- That's all, folks ----------------------------------------------------