work around HP-UX shell bug
[unix-history] / usr / src / usr.sbin / sendmail / src / makesendmail
#!/bin/sh
# Copyright (c) 1993 Eric P. Allman
# Copyright (c) 1993 The Regents of the University of California.
# All rights reserved.
#
# %sccs.include.redist.sh%
#
# @(#)makesendmail 8.13 (Berkeley) %G%
#
#
# A quick-and-dirty script to compile sendmail in the presence of
# multiple architectures and Makefiles.
#
# determine machine architecture
arch=`uname -m | sed -e 's/ //g'`
case $arch
in
sun4*) arch=sun4;;
9000/*) arch=`echo $arch | sed -e 's/9000.//' -e 's/..$/xx/'`;;
esac
# determine operating system type
os=`uname -s`
case $os
in
DYNIX/ptx) os=PTX;;
Paragon*) os=Paragon;;
esac
# determine operating system release
rel=`uname -r`
rbase=`echo $rel | sed 's/\..*//''`
# heuristic tweaks to clean up names
if [ "$os" = "unix" ]
then
# might be Altos System V
case $rel
in
5.3*) os=Altos;;
esac
fi
if [ -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
fi
# now try to find a reasonable object directory
if [ -r obj.$os.$arch.$rel ]; then
obj=obj.$os.$arch.$rel
elif [ -r obj.$os.$arch.$rbase.x ]; then
obj=obj.$os.$arch.$rbase.x
elif [ -r obj.$os.$rel ]; then
obj=obj.$os.$rel
elif [ -r obj.$os.$rbase.x ]; then
obj=obj.$os.$rbase.x
elif [ -r obj.$os.$arch ]; then
obj=obj.$os.$arch
elif [ -r obj.$arch.$rel ]; then
obj=obj.$arch.$rel
elif [ -r obj.$arch.$rbase.x ]; then
obj=obj.$arch.$rbase.x
elif [ -r obj.$os ]; then
obj=obj.$os
elif [ -r obj.$arch ]; then
obj=obj.$arch
elif [ -r obj.$rel ]; then
obj=obj.$rel
else
# no existing obj directory -- try to create one if Makefile found
obj=obj.$os.$arch.$rel
if [ -r Makefiles/Makefile.$os.$arch.$rel ]; then
makefile=Makefile.$os.$arch.$rel
elif [ -r Makefiles/Makefile.$os.$arch.$rbase.x ]; then
makefile=Makefile.$os.$arch.$rbase.x
elif [ -r Makefiles/Makefile.$os.$rel ]; then
makefile=Makefile.$os.$rel
elif [ -r Makefiles/Makefile.$os.$rbase.x ]; then
makefile=Makefile.$os.$rbase.x
elif [ -r Makefiles/Makefile.$os.$arch ]; then
makefile=Makefile.$os.$arch
elif [ -r Makefiles/Makefile.$arch.$rel ]; then
makefile=Makefile.$arch.$rel
elif [ -r Makefiles/Makefile.$arch.$rbase.x ]; then
makefile=Makefile.$arch.$rbase.x
elif [ -r Makefiles/Makefile.$os ]; then
makefile=Makefile.$os
elif [ -r Makefiles/Makefile.$arch ]; then
makefile=Makefile.$arch
elif [ -r Makefiles/Makefile.$rel ]; then
makefile=Makefile.$rel
else
echo "Cannot determine how to support $arch.$os.$rel"
exit 1
fi
echo "Creating $obj using $makefile"
mkdir $obj
(cd $obj; ln -s ../*.[ch158] ../sendmail.hf .; ln -s ../Makefiles/$makefile Makefile)
fi
echo "Making in $obj"
cd $obj
if [ $# = 0 ]
then
exec ${MAKE-make}
else
exec ${MAKE-make} "$@"
fi