# Copyright (c) 1993 Eric P. Allman
# Copyright (c) 1993 The Regents of the University of California.
# %sccs.include.redist.sh%
# @(#)makesendmail 8.26 (Berkeley) %G%
# A quick-and-dirty script to compile sendmail in the presence of
# multiple architectures and Makefiles.
if [ "x${1-""}" = "x-m" ]
# show Makefile name only
# Do heuristic guesses for machines that do not have uname
if [ -d /LocalApps
-a ! -f /bin
/uname
-a ! -f /usr
/bin
/uname
]
rel
=`strings /mach | grep 'Mach.*:' | sed -e 's/.* Mach //' -e 's/:.*//'`
elif [ -f /usr
/sony
/bin
/machine
-a -f /etc
/osversion
]
# probably a Sony NEWS 4.x
rel
=`awk '{ print $3}' /etc/osversion`
arch
=`/usr/sony/bin/machine`
elif [ -d /usr
/omron
-a -f /bin
/luna
]
if [ -f /bin
/luna1
] && /bin
/luna1
elif [ -f /bin
/luna2
] && /bin
/luna2
elif [ -f /bin
/luna88k
] && /bin
/luna88k
if [ ! "$arch" -a ! "$os" -a ! "$rel" ]
arch
=`uname -m | sed -e 's/ //g'`
os
=`uname -s | sed 's/\//-/g'`
# tweak machine architecture
9000/*) arch
=`echo $arch | sed -e 's/9000.//' -e 's/..$/xx/'`;;
# tweak operating system type and release
HP-UX
) rel
=`echo $rel | sed -e 's/^[^.]*\.0*//'`;;
# get "base part" of operating system release
rbase
=`echo $rel | sed -e 's/\..*//'`
# heuristic tweaks to clean up names
# might be Altos System V
if [ -r /unix
-a -r /usr
/lib
/libseq.a
-a -r /lib
/cpp
]
# might be a DYNIX/ptx 2.x system, which has a broken uname
if strings /lib
/cpp |
grep _SEQUENT_
> /dev
/null
if [ -d /usr
/nec
-a "$os" = "UNIX_System_V" ]
# see if there is a "user suffix" specified
if [ "${SENDMAIL_SUFFIX-}x" = "x" ]
sfx
=".${SENDMAIL_SUFFIX}"
echo "Configuration: os=$os, rel=$rel, rbase=$rbase, 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.
$rbase.x.
$arch$sfx ]; then
obj
=obj.
$os.
$rbase.x.
$arch$sfx
elif [ -r obj.
$os.
$rel$sfx ]; then
elif [ -r obj.
$os.
$rbase.x
$sfx ]; then
elif [ -r obj.
$os.
$arch$sfx ]; then
elif [ -r obj.
$rel.
$arch$sfx ]; then
elif [ -r obj.
$rbase.x.
$arch$sfx ]; then
obj
=obj.
$rbase.x.
$arch$sfx
elif [ -r obj.
$os$sfx ]; then
elif [ -r obj.
$arch$sfx ]; then
elif [ -r obj.
$rel$sfx ]; then
elif [ -r obj
$sfx ]; then
# 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
elif [ -r Makefiles
/Makefile.
$arch$sfx ]; then
makefile
=Makefile.
$arch$sfx
elif [ -r Makefiles
/Makefile.
$arch ]; then
elif [ -r Makefiles
/Makefile.
$rel$sfx ]; then
makefile
=Makefile.
$rel$sfx
elif [ -r Makefiles
/Makefile.
$rel ]; then
elif [ -r Makefiles
/Makefile.
$rel$sfx ]; then
makefile
=Makefile.
$rel$sfx
echo "Cannot determine how to support $arch.$os.$rel"
echo "Will run in virgin $obj using $makefile"
echo "Creating $obj using $makefile"
(cd $obj; ln -s ..
/*.
[ch158
] ..
/sendmail.hf .
; ln -s ..
/Makefiles
/$makefile Makefile
)
echo "Making dependencies in $obj"
(cd $obj; ${MAKE-make} depend
)
makefile
=`ls -l $obj/Makefile | sed 's/.* //'`
echo "ERROR: $obj exists but has no Makefile"
makefile
=`echo $makefile | sed 's/...Makefiles.//'`
echo "Will run in existing $obj using $makefile"
echo "Will run in existing $obj using custom $makefile"