1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
|
#!/bin/sh
# Copyright (c) 1993, 1996-1997 Eric P. Allman
# Copyright (c) 1993 The Regents of the University of California.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed by the University of
# California, Berkeley and its contributors.
# 4. Neither the name of the University nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# @(#)makesendmail 8.45 (Berkeley) 4/12/97
#
#
# A quick-and-dirty script to compile sendmail in the presence of
# multiple architectures and Makefiles.
#
if [ "x${1-""}" = "x-m" ]
then
# show Makefile name only
mflag=1
else
mflag=""
fi
#
# Do heuristic guesses !ONLY! for machines that do not have uname
#
if [ -d /NextApps -a ! -f /bin/uname -a ! -f /usr/bin/uname ]
then
# probably a NeXT box
arch=`hostinfo | sed -n 's/.*Processor type: \([^ ]*\).*/\1/p'`
os=NeXT
rel=`hostinfo | sed -n 's/.*NeXT Mach \([0-9\.]*\).*/\1/p'`
elif [ -f /usr/sony/bin/machine -a -f /etc/osversion ]
then
# probably a Sony NEWS 4.x
os=NEWS-OS
rel=`awk '{ print $3}' /etc/osversion`
arch=`/usr/sony/bin/machine`
elif [ -d /usr/omron -a -f /bin/luna ]
then
# probably a Omron LUNA
os=LUNA
if [ -f /bin/luna1 ] && /bin/luna1
then
rel=unios-b
arch=luna1
elif [ -f /bin/luna2 ] && /bin/luna2
then
rel=Mach
arch=luna2
elif [ -f /bin/luna88k ] && /bin/luna88k
then
rel=Mach
arch=luna88k
fi
fi
if [ ! "$arch" -a ! "$os" -a ! "$rel" ]
then
arch=`uname -m | sed -e 's/ //g'`
os=`uname -s | sed -e 's/\//-/g' -e 's/ //g'`
rel=`uname -r | sed -e 's/(/-/g' -e 's/)//g'`
fi
#
# Tweak the values we have already got. PLEASE LIMIT THESE to
# tweaks that are absolutely necessary because your system uname
# routine doesn't return something sufficiently unique. Don't do
# it just because you don't like the name that is returned. You
# can combine the architecture name with the os name to create a
# unique Makefile name.
#
# tweak machine architecture
case $arch
in
sun4*) arch=sun4;;
9000/*) arch=`echo $arch | sed -e 's/9000.//' -e 's/..$/xx/'`;;
DS/907000) arch=ds90;;
esac
# tweak operating system type and release
node=`uname -n | sed -e 's/\//-/g' -e 's/ //g'`
if [ "$os" = "$node" -a "$arch" = "i386" -a "$rel" = 3.2 -a "`uname -v`" = 2 ]
then
# old versions of SCO UNIX set uname -s the same as uname -n
os=SCO_SV
fi
if [ "$os" = "$node" -a "$rel" = 4.0 -a "$arch" = "3360,3430-R" ]
then
# AT&T/NCR Machines also set uname -s == uname -n
if [ -d /usr/sadm/sysadm/add-ons/WIN-TCP ]
then
os=NCR.MP-RAS.2.x
else
os=NCR.MP-RAS.3.x
fi
fi
case $os
in
DYNIX-ptx) os=PTX;;
Paragon*) os=Paragon;;
HP-UX) rel=`echo $rel | sed -e 's/^[^.]*\.0*//'`;;
AIX) rel=`uname -v`
if [ "$rel" = "2" ]
then
arch=""
fi;;
BSD-386) os=BSD-OS;;
SCO_SV) os=SCO; rel=`uname -X | sed -n 's/Release = 3.2v//p'`;;
UNIX_System_V) if [ "$arch" = "ds90" ]
then
os="UXPDS"
rel=`uname -v | sed -e 's/\(V.*\)L.*/\1/'`
fi;;
SINIX-?) os=SINIX;;
esac
# get "base part" of operating system release
rroot=`echo $rel | sed -e 's/\.[^.]*$//'`
rbase=`echo $rel | sed -e 's/\..*//'`
if [ "$rroot" = "$rbase" ]
then
rroot=$rel
fi
# heuristic tweaks to clean up names -- PLEASE LIMIT THESE!
if [ "$os" = "unix" ]
then
# might be Altos System V
case $rel
in
5.3*) os=Altos;;
esac
elif [ -r /unix -a -r /usr/lib/libseq.a -a -r /lib/cpp ]
then
# might be a DYNIX/ptx 2.x system, which has a broken uname
if strings /lib/cpp | grep _SEQUENT_ > /dev/null
then
os=PTX
fi
elif [ -d /usr/nec ]
then
# NEC machine -- what is it running?
if [ "$os" = "UNIX_System_V" ]
then
os=EWS-UX_V
elif [ "$os" = "UNIX_SV" ]
then
os=UX4800
fi
elif [ "$arch" = "mips" ]
then
case $rel
in
4_*)
if [ `uname -v` = "UMIPS" ]
then
os=RISCos
fi;;
esac
fi
# see if there is a "user suffix" specified
if [ "${SENDMAIL_SUFFIX-}x" = "x" ]
then
sfx=""
else
sfx=".${SENDMAIL_SUFFIX}"
fi
echo "Configuration: os=$os, rel=$rel, rbase=$rbase, rroot=$rroot, arch=$arch, sfx=$sfx"
# now try to find a reasonable object directory
if [ -r obj.$os.$rel.$arch$sfx ]; then
obj=obj.$os.$rel.$arch$sfx
elif [ -r obj.$os.$rroot.$arch$sfx ]; then
obj=obj.$os.$rroot.$arch$sfx
elif [ -r obj.$os.$rbase.x.$arch$sfx ]; then
obj=obj.$os.$rbase.x.$arch$sfx
elif [ -r obj.$os.$rel$sfx ]; then
obj=obj.$os.$rel$sfx
elif [ -r obj.$os.$rbase.x$sfx ]; then
obj=obj.$os.$rbase.x$sfx
elif [ -r obj.$os.$arch$sfx ]; then
obj=obj.$os.$arch$sfx
elif [ -r obj.$rel.$arch$sfx ]; then
obj=obj.$rel.$arch$sfx
elif [ -r obj.$rbase.x.$arch$sfx ]; then
obj=obj.$rbase.x.$arch$sfx
elif [ -r obj.$os$sfx ]; then
obj=obj.$os$sfx
elif [ -r obj.$arch$sfx ]; then
obj=obj.$arch$sfx
elif [ -r obj.$rel$sfx ]; then
obj=obj.$rel$sfx
elif [ -r obj$sfx ]; then
obj=obj$sfx
else
# no existing obj directory -- try to create one if Makefile found
obj=obj.$os.$rel.$arch$sfx
if [ -r Makefiles/Makefile.$os.$rel.$arch$sfx ]; then
makefile=Makefile.$os.$rel.$arch$sfx
elif [ -r Makefiles/Makefile.$os.$rel.$arch ]; then
makefile=Makefile.$os.$rel.$arch
elif [ -r Makefiles/Makefile.$os.$rroot.$arch$sfx ]; then
makefile=Makefile.$os.$rroot.$arch$sfx
elif [ -r Makefiles/Makefile.$os.$rroot.$arch ]; then
makefile=Makefile.$os.$rroot.$arch
elif [ -r Makefiles/Makefile.$os.$rbase.x.$arch$sfx ]; then
makefile=Makefile.$os.$rbase.x.$arch$sfx
elif [ -r Makefiles/Makefile.$os.$rbase.x.$arch ]; then
makefile=Makefile.$os.$rbase.x.$arch
elif [ -r Makefiles/Makefile.$os.$rel$sfx ]; then
makefile=Makefile.$os.$rel$sfx
elif [ -r Makefiles/Makefile.$os.$rel ]; then
makefile=Makefile.$os.$rel
elif [ -r Makefiles/Makefile.$os.$rroot$sfx ]; then
makefile=Makefile.$os.$rroot$sfx
elif [ -r Makefiles/Makefile.$os.$rroot ]; then
makefile=Makefile.$os.$rroot
elif [ -r Makefiles/Makefile.$os.$rbase.x$sfx ]; then
makefile=Makefile.$os.$rbase.x$sfx
elif [ -r Makefiles/Makefile.$os.$rbase.x ]; then
makefile=Makefile.$os.$rbase.x
elif [ -r Makefiles/Makefile.$os.$arch$sfx ]; then
makefile=Makefile.$os.$arch$sfx
elif [ -r Makefiles/Makefile.$os.$arch ]; then
makefile=Makefile.$os.$arch
elif [ -r Makefiles/Makefile.$rel.$arch$sfx ]; then
makefile=Makefile.$rel.$arch$sfx
elif [ -r Makefiles/Makefile.$rel.$arch ]; then
makefile=Makefile.$rel.$arch
elif [ -r Makefiles/Makefile.$rroot.$arch$sfx ]; then
makefile=Makefile.$rroot.$arch$sfx
elif [ -r Makefiles/Makefile.$rroot.$arch ]; then
makefile=Makefile.$rroot.$arch
elif [ -r Makefiles/Makefile.$rbase.x.$arch$sfx ]; then
makefile=Makefile.$rbase.x.$arch$sfx
elif [ -r Makefiles/Makefile.$rbase.x.$arch ]; then
makefile=Makefile.$rbase.x.$arch
elif [ -r Makefiles/Makefile.$os$sfx ]; then
makefile=Makefile.$os$sfx
elif [ -r Makefiles/Makefile.$os ]; then
makefile=Makefile.$os
elif [ -r Makefiles/Makefile.$arch$sfx ]; then
makefile=Makefile.$arch$sfx
elif [ -r Makefiles/Makefile.$arch ]; then
makefile=Makefile.$arch
elif [ -r Makefiles/Makefile.$rel$sfx ]; then
makefile=Makefile.$rel$sfx
elif [ -r Makefiles/Makefile.$rel ]; then
makefile=Makefile.$rel
elif [ -r Makefiles/Makefile.$rel$sfx ]; then
makefile=Makefile.$rel$sfx
else
echo "Cannot determine how to support $arch.$os.$rel"
exit 1
fi
if [ "$mflag" ]
then
echo "Will run in virgin $obj using $makefile"
exit 0
fi
echo "Creating $obj using $makefile"
mkdir $obj
(cd $obj; ln -s ../*.[ch158] ../sendmail.hf .; ln -s ../Makefiles/$makefile Makefile)
echo "Making dependencies in $obj"
(cd $obj; ${MAKE-make} depend)
fi
if [ "$mflag" ]
then
makefile=`ls -l $obj/Makefile | sed 's/.* //'`
if [ -z "$makefile" ]
then
echo "ERROR: $obj exists but has no Makefile"
exit 1
fi
case $makefile
in
../Makefiles/*)
makefile=`echo $makefile | sed 's/...Makefiles.//'`
echo "Will run in existing $obj using $makefile"
;;
*)
echo "Will run in existing $obj using custom $makefile"
;;
esac
exit 0
fi
echo "Making in $obj"
cd $obj
if [ $# = 0 ]
then
exec ${MAKE-make}
else
exec ${MAKE-make} "$@"
fi
|