~ubuntu-branches/ubuntu/maverick/exim4/maverick-updates

« back to all changes in this revision

Viewing changes to scripts/os-type

  • Committer: Bazaar Package Importer
  • Author(s): Michael Bienia
  • Date: 2010-01-01 16:28:19 UTC
  • mfrom: (2.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20100101162819-htn71my7yj4v1vkr
Tags: 4.71-3ubuntu1
* Merge with Debian unstable (lp: #501657). Remaining changes:
  + debian/patches/71_exiq_grep_error_on_messages_without_size.dpatch:
    Improve handling of broken messages when "exim4 -bp" (mailq) reports
    lines without size info.
  + Don't declare a Provides: default-mta; in Ubuntu, we want postfix to be
    the default.
  + debian/control: Change build dependencies to MySQL 5.1.
  + debian/{control,rules}: add and enable hardened build for PIE
    (Debian bug 542726).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
# $Cambridge: exim/exim-src/scripts/os-type,v 1.6 2009/11/13 12:18:35 nm4 Exp $
 
3
 
 
4
# Shell script to determine the operating system type. Some of the heuristics
 
5
# herein have accumulated over the years and may not strictly be needed now,
 
6
# but they are left in under the principle of "If it ain't broke, don't fix
 
7
# it."
 
8
 
 
9
# For some OS there are two variants: a full name, which is used for the
 
10
# build directory, and a generic name, which is used to identify the OS-
 
11
# specific scripts, and which can be the same for different versions of
 
12
# the OS. Solaris 2 is one such OS. The option -generic specifies the
 
13
# latter type of output.
 
14
 
 
15
# If EXIM_OSTYPE is set, use it. This allows a manual override.
 
16
 
 
17
case "$EXIM_OSTYPE" in ?*) os="$EXIM_OSTYPE";; esac
 
18
 
 
19
# Otherwise, try to get a value from the uname command. Use an explicit
 
20
# option just in case there are any systems where -s is not the default.
 
21
 
 
22
case "$os" in '') os=`uname -s`;; esac
 
23
 
 
24
# Identify Glibc systems under different names.
 
25
 
 
26
case "$os" in GNU) os=GNU;; esac
 
27
case "$os" in GNU/*|Linux) os=Linux;; esac
 
28
 
 
29
# It is believed that all systems respond to uname -s, but just in case
 
30
# there is one that doesn't, use the shell's $OSTYPE variable. It is known
 
31
# to be unhelpful for some systems (under IRIX is it "irix" and under BSDI
 
32
# 3.0 it may be "386BSD") but those systems respond to uname -s, so this
 
33
# doesn't matter.
 
34
 
 
35
case "$os" in '') os="$OSTYPE";; esac
 
36
 
 
37
# Failed to find OS type.
 
38
 
 
39
case "$os" in
 
40
'') echo "" 1>&2
 
41
    echo "*** Failed to determine the operating system type." 1>&2
 
42
    echo "" 1>&2
 
43
    echo UnKnown
 
44
    exit 1;;
 
45
esac
 
46
 
 
47
# Clean out gash characters
 
48
 
 
49
os=`echo $os | sed 's,[^-+_.a-zA-Z0-9],,g'`
 
50
 
 
51
# A value has been obtained for the os. Some massaging may be needed in
 
52
# some cases to get a uniform set of values. In earlier versions of this
 
53
# script, $OSTYPE was looked at before uname -s, and various shells set it
 
54
# to things that are subtly different. It is possible that some of this may
 
55
# no longer be needed.
 
56
 
 
57
case "$os" in
 
58
aix*)       os=AIX;;
 
59
AIX*)       os=AIX;;
 
60
bsdi*)      os=BSDI;;
 
61
BSDOS)      os=BSDI;;
 
62
BSD_OS)     os=BSDI;;
 
63
CYGWIN*)    os=CYGWIN;;
 
64
dgux)       os=DGUX;;
 
65
freebsd*)   os=FreeBSD;;
 
66
gnu)        os=GNU;;
 
67
Irix5)      os=IRIX;;
 
68
Irix6)      os=IRIX6;;
 
69
IRIX64)     os=IRIX6;;
 
70
irix6.5)    os=IRIX65;;
 
71
IRIX)       version=`uname -r`
 
72
            case "$version" in
 
73
            5*)  os=IRIX;;
 
74
            6.5) version=`uname -R | awk '{print $NF}'`
 
75
                 version=`echo $version | sed 's,[^-+_a-zA-Z0-9],,g'`
 
76
                 os=IRIX$version;;
 
77
            6*)  os=IRIX632;;
 
78
            esac;;
 
79
HI-OSF1-MJ) os=HI-OSF;;
 
80
HI-UXMPP)   os=HI-OSF;;
 
81
hpux*)      os=HP-UX;;
 
82
linux)      os=Linux;;
 
83
linux-*)    os=Linux;;
 
84
Linux-*)    os=Linux;;
 
85
netbsd*)    os=NetBSD;;
 
86
NetBSD*)    os=NetBSD;;
 
87
openbsd*)   os=OpenBSD;;
 
88
osf1)       os=OSF1;;
 
89
qnx*)       os=QNX;;
 
90
solaris*)   os=SunOS5;;
 
91
sunos4*)    os=SunOS4;;
 
92
UnixWare)   os=Unixware7;;
 
93
Ultrix)     os=ULTRIX;;
 
94
ultrix*)    os=ULTRIX;;
 
95
esac
 
96
 
 
97
# In the case of SunOS we need to distinguish between SunOS4 and Solaris (aka
 
98
# SunOS5); in the case of BSDI we need to distinguish between versions 3 and 4;
 
99
# in the case of HP-UX we need to distinguish between version 9 and later.
 
100
 
 
101
case "$os" in
 
102
SunOS)  case `uname -r` in
 
103
        5*)     os="${os}5";;
 
104
        4*)     os="${os}4";;
 
105
        esac;;
 
106
 
 
107
BSDI)   case `uname -r` in
 
108
        3*)     os="${os}3";;
 
109
        4.2*)   os="${os}4.2";;
 
110
        4*)     os="${os}4";;
 
111
        esac;;
 
112
 
 
113
HP-UX)  case `uname -r` in
 
114
        A.09*)  os="${os}-9";;
 
115
        esac;;
 
116
esac
 
117
 
 
118
# Need to distinguish Solaris from the version on the HAL (64bit sparc,
 
119
# CC=hcc -DV7). Also need to distinguish different versions of the OS
 
120
# for building different binaries.
 
121
 
 
122
case "$os" in
 
123
SunOS5) case `uname -m` in
 
124
        sun4H)  os="${os}-hal";;
 
125
            *)  os="${os}-`uname -r`";;
 
126
        esac
 
127
        ;;
 
128
 
 
129
# In the case of Linux we used to distinguish which libc was used so that
 
130
# the old libc5 was supported as well as the current glibc. This support
 
131
# was giving some people problems, so it was removed in June 2005, under
 
132
# the assumption that nobody would be using libc5 any more (it is over seven
 
133
# years old).
 
134
 
 
135
# In the case of NetBSD we need to distinguish between a.out, ELF
 
136
# and COFF binary formats.  However, a.out and COFF are the same
 
137
# for our purposes, so both of them are defined as "a.out".
 
138
# Todd Vierling of Wasabi Systems reported that NetBSD/sh3 (the
 
139
# only NetBSD port that uses COFF binary format) will switch to
 
140
# ELF soon.
 
141
 
 
142
NetBSD) if echo __ELF__ | ${CC-cc} -E - | grep -q __ELF__ ; then
 
143
        # Non-ELF system
 
144
        os="NetBSD-a.out"
 
145
        fi
 
146
        ;;
 
147
 
 
148
esac
 
149
 
 
150
# If a generic OS name is requested, some further massaging is needed
 
151
# for some systems.
 
152
 
 
153
if [ "$1" = '-generic' ]; then
 
154
  case "$os" in
 
155
  SunOS5*) os=SunOS5;;
 
156
  BSDI*)   os=BSDI;;
 
157
  IRIX65*) os=IRIX65;;
 
158
  esac
 
159
fi
 
160
 
 
161
# OK, the script seems to have worked. Pass the value back.
 
162
 
 
163
echo "$os"
 
164
 
 
165
# End of os-type