patch for NeXT
[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.18 (Berkeley) %G%
#
#
# A quick-and-dirty script to compile sendmail in the presence of
# multiple architectures and Makefiles.
#
if [ -d /LocalApps -a ! -f /bin/uname -a ! -f /usr/bin/uname ]
then
# probably a NeXT box
arch=NeXT
os=Mach
rel=`strings /mach | grep 'Mach.*:' | sed -e 's/.* Mach //' -e 's/:.*//'`
else
arch=`uname -m | sed -e 's/ //g'`
os=`uname -s | sed 's/\//-/g'`
rel=`uname -r`
fi
# tweak machine architecture
case $arch
in
sun4*) arch=sun4;;
9000/*) arch=`echo $arch | sed -e 's/9000.//' -e 's/..$/xx/'`;;
esac
# tweak operating system type
case $os
in
DYNIX-ptx) os=PTX;;
Paragon*) os=Paragon;;
esac
# tweak operating system release
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
# see if there is a "user suffix" specified
if [ "${SENDMAIL_SUFFIX-}x" = "x" ]
then
sfx=""
else
sfx=".${SENDMAIL_SUFFIX}"
fi
# 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.$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.$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.$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.$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
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