1#!/bin/sh 2 3# Copyright (c) 1993 Eric P. Allman 4# Copyright (c) 1993 The Regents of the University of California. 5# All rights reserved. 6# 7# %sccs.include.redist.sh% 8# 9# @(#)makesendmail 8.23 (Berkeley) 05/19/95 10# 11 12# 13# A quick-and-dirty script to compile sendmail in the presence of 14# multiple architectures and Makefiles. 15# 16 17# 18# Do heuristic guesses for machines that do not have uname 19# 20if [ -d /LocalApps -a ! -f /bin/uname -a ! -f /usr/bin/uname ] 21then 22 # probably a NeXT box 23 arch=NeXT 24 os=Mach 25 rel=`strings /mach | grep 'Mach.*:' | sed -e 's/.* Mach //' -e 's/:.*//'` 26elif [ -f /usr/sony/bin/machine -a -f /etc/osversion ] 27then 28 # probably a Sony NEWS 4.x 29 os=NEWS-OS 30 rel=`awk '{ print $3}' /etc/osversion` 31 arch=`/usr/sony/bin/machine` 32elif [ -d /usr/omron -a -f /bin/luna ] 33then 34 # probably a Omron LUNA 35 os=LUNA 36 if [ -f /bin/luna1 ] && /bin/luna1 37 then 38 rel=unios-b 39 arch=luna1 40 elif [ -f /bin/luna2 ] && /bin/luna2 41 then 42 rel=Mach 43 arch=luna2 44 elif [ -f /bin/luna88k ] && /bin/luna88k 45 then 46 rel=Mach 47 arch=luna88k 48 fi 49fi 50 51if [ ! "$arch" -a ! "$os" -a ! "$rel" ] 52then 53 arch=`uname -m | sed -e 's/ //g'` 54 os=`uname -s | sed 's/\//-/g'` 55 rel=`uname -r` 56fi 57 58# tweak machine architecture 59case $arch 60in 61 sun4*) arch=sun4;; 62 63 9000/*) arch=`echo $arch | sed -e 's/9000.//' -e 's/..$/xx/'`;; 64esac 65 66# tweak operating system type and release 67case $os 68in 69 DYNIX-ptx) os=PTX;; 70 Paragon*) os=Paragon;; 71 HP-UX) rel=`echo $rel | sed -e 's/^[^.]*\.0*//'`;; 72 AIX) rel=`uname -v`;; 73esac 74 75# get "base part" of operating system release 76rbase=`echo $rel | sed -e 's/\..*//'` 77 78# heuristic tweaks to clean up names 79if [ "$os" = "unix" ] 80then 81 # might be Altos System V 82 case $rel 83 in 84 5.3*) os=Altos;; 85 esac 86fi 87 88if [ -r /unix -a -r /usr/lib/libseq.a -a -r /lib/cpp ] 89then 90 # might be a DYNIX/ptx 2.x system, which has a broken uname 91 if strings /lib/cpp | grep _SEQUENT_ > /dev/null 92 then 93 os=PTX 94 fi 95fi 96 97if [ -d /usr/nec -a "$os" = "UNIX_System_V" ] 98then 99 os=EWS-UX_V 100fi 101 102# see if there is a "user suffix" specified 103if [ "${SENDMAIL_SUFFIX-}x" = "x" ] 104then 105 sfx="" 106else 107 sfx=".${SENDMAIL_SUFFIX}" 108fi 109 110echo "Making sendmail with os=$os, rel=$rel, rbase=$rbase, arch=$arch, sfx=$sfx" 111 112# now try to find a reasonable object directory 113if [ -r obj.$os.$rel.$arch$sfx ]; then 114 obj=obj.$os.$rel.$arch$sfx 115elif [ -r obj.$os.$rbase.x.$arch$sfx ]; then 116 obj=obj.$os.$rbase.x.$arch$sfx 117elif [ -r obj.$os.$rel$sfx ]; then 118 obj=obj.$os.$rel$sfx 119elif [ -r obj.$os.$rbase.x$sfx ]; then 120 obj=obj.$os.$rbase.x$sfx 121elif [ -r obj.$os.$arch$sfx ]; then 122 obj=obj.$os.$arch$sfx 123elif [ -r obj.$rel.$arch$sfx ]; then 124 obj=obj.$rel.$arch$sfx 125elif [ -r obj.$rbase.x.$arch$sfx ]; then 126 obj=obj.$rbase.x.$arch$sfx 127elif [ -r obj.$os$sfx ]; then 128 obj=obj.$os$sfx 129elif [ -r obj.$arch$sfx ]; then 130 obj=obj.$arch$sfx 131elif [ -r obj.$rel$sfx ]; then 132 obj=obj.$rel$sfx 133elif [ -r obj$sfx ]; then 134 obj=obj$sfx 135else 136 # no existing obj directory -- try to create one if Makefile found 137 obj=obj.$os.$rel.$arch$sfx 138 if [ -r Makefiles/Makefile.$os.$rel.$arch$sfx ]; then 139 makefile=Makefile.$os.$rel.$arch$sfx 140 elif [ -r Makefiles/Makefile.$os.$rel.$arch ]; then 141 makefile=Makefile.$os.$rel.$arch 142 elif [ -r Makefiles/Makefile.$os.$rbase.x.$arch$sfx ]; then 143 makefile=Makefile.$os.$rbase.x.$arch$sfx 144 elif [ -r Makefiles/Makefile.$os.$rbase.x.$arch ]; then 145 makefile=Makefile.$os.$rbase.x.$arch 146 elif [ -r Makefiles/Makefile.$os.$rel$sfx ]; then 147 makefile=Makefile.$os.$rel$sfx 148 elif [ -r Makefiles/Makefile.$os.$rel ]; then 149 makefile=Makefile.$os.$rel 150 elif [ -r Makefiles/Makefile.$os.$rbase.x$sfx ]; then 151 makefile=Makefile.$os.$rbase.x$sfx 152 elif [ -r Makefiles/Makefile.$os.$rbase.x ]; then 153 makefile=Makefile.$os.$rbase.x 154 elif [ -r Makefiles/Makefile.$os.$arch$sfx ]; then 155 makefile=Makefile.$os.$arch$sfx 156 elif [ -r Makefiles/Makefile.$os.$arch ]; then 157 makefile=Makefile.$os.$arch 158 elif [ -r Makefiles/Makefile.$rel.$arch$sfx ]; then 159 makefile=Makefile.$rel.$arch$sfx 160 elif [ -r Makefiles/Makefile.$rel.$arch ]; then 161 makefile=Makefile.$rel.$arch 162 elif [ -r Makefiles/Makefile.$rbase.x.$arch$sfx ]; then 163 makefile=Makefile.$rbase.x.$arch$sfx 164 elif [ -r Makefiles/Makefile.$rbase.x.$arch ]; then 165 makefile=Makefile.$rbase.x.$arch 166 elif [ -r Makefiles/Makefile.$os$sfx ]; then 167 makefile=Makefile.$os$sfx 168 elif [ -r Makefiles/Makefile.$os ]; then 169 makefile=Makefile.$os 170 elif [ -r Makefiles/Makefile.$arch$sfx ]; then 171 makefile=Makefile.$arch$sfx 172 elif [ -r Makefiles/Makefile.$arch ]; then 173 makefile=Makefile.$arch 174 elif [ -r Makefiles/Makefile.$rel$sfx ]; then 175 makefile=Makefile.$rel$sfx 176 elif [ -r Makefiles/Makefile.$rel ]; then 177 makefile=Makefile.$rel 178 elif [ -r Makefiles/Makefile.$rel$sfx ]; then 179 makefile=Makefile.$rel$sfx 180 else 181 echo "Cannot determine how to support $arch.$os.$rel" 182 exit 1 183 fi 184 echo "Creating $obj using $makefile" 185 mkdir $obj 186 (cd $obj; ln -s ../*.[ch158] ../sendmail.hf .; ln -s ../Makefiles/$makefile Makefile) 187fi 188echo "Making in $obj" 189cd $obj 190if [ $# = 0 ] 191then 192 exec ${MAKE-make} 193else 194 exec ${MAKE-make} "$@" 195fi 196