1CMD=${CMD-/bin/make} 2ARK=${ARK-lib.a} 3# 4# This script will make various version of ksh for different machines 5# You can invoke this command with a few flags and one argument which 6# is the name of the object file for the shell 7# 8JOBLIB= U370= DATA=data FIXDATA=text LFLAGS=-n Options= files= EDIT= \ 9 EMACS=${EMACS-emacs.o} VI=${VI-vi.o} MYIO= JOBS=${JOBS-jobs.o} \ 10 SUID_EXEC=suid_exec 11# check to see if segmentation faults work 12if test -r option.init 13then . ./option.init 14 # check to see if /bin/echo behaves like BSD echo 15else if test -f /bin/echo -a X"`/bin/echo -n`" = X 16 then Options="$Options ECHO_N=-DECHO_N" 17 fi 18 # check for 16-bit machines 19 cat > try.c <<\! 20 main() { int i = 0200000; exit(i!=0); } 21! 22 cc -c try.c 23 # check to see if -z flag works 24 if cc -z -o try try.o 2> /dev/null 25 then LFLAGS=-z 26 else if cc -n -o try try.o 2> /dev/null 27 then LFLAGS=-n 28 else cc -o try try.o 29 fi 30 fi 31 if ./try 32 then LDFLAGS=-i 33 fi 34 # check to see if _sibuf already in library 35 cat > try.c <<\! 36 extern char _sibuf[]; 37 main() { exit(_sibuf[0]); } 38! 39 cc -o try try.c 2> /dev/null || Options="$Options NOBUF=-DNOBUF" 40 rm -f try try.c try.o 41 echo "Options='$Options'" > option.init 42fi 43while true 44do case $1 in 45 -a*) # accounting 46 Options="$Options ACCT=-DACCT" ;; 47 -j*) # job monitor 48 JOBS=jobs.o ;; 49 +j*) # job monitor off 50 JOBS= ;; 51 -e*|+v*) # emacs mode only 52 VI= ;; 53 -v*|+e*) # vi mode only 54 EMACS= ;; 55 -r*) # vi raw only mode 56 Options="$Options VIRAW=-DRAWONLY" ;; 57 -m*) # multibyte version 58 Options="$Options MULTIBYTE=-DMULTIBYTE" ;; 59 -f*) 60 VFORK=1 ;; 61 +f*) 62 VFORK= ;; 63 -s*) 64 SUID_EXEC=suid_exec ;; 65 +s*) 66 SUID_EXEC= ;; 67 -4.2) # BSD 4_2 68 Options="$Options DBSD=-DBSD D4_2=-DBSD_4_2" \ 69 LFLAGS=-z JOBS=jobs.o ;; 70 -*) 71 echo "USAGE: $0 [-e] [+e] [-f] [+f] [-j] [+j] [-m] [-r] [-s] [+s] [-v] [+v] [-4.2] [name]" 72 exit 1 ;; 73 *) 74 break ;; 75 esac 76 shift 77done 78sh=${1-ksh} 79if test -d /dev/fd # new research UNIX feature 80then Options="$Options DEVFD=-DDEVFD" 81fi 82# if test -d /dev/sxt # sxt driver available 83# then Options="$Options SXT=-DSXT" 84# fi 85if test -f /vmunix -o "$SYSTYPE" = bsd4.1 -o "$SYSTYPE" = bsd4.2 # true for BSD unix 86then JOBLIB=-ljobs Options="$Options DBSD=-DBSD" JOBS=jobs.o LFLAGS=-z 87 if test -f /etc/networks #BSD 4.2 88 then Options="$Options D4_2=-DBSD_4_2" JOBLIB= 89 fi 90 if test -d /usr/suntool -o -f /usr/bin/suntools #sun workstations 91 then Options="$Options NOBUF=-DNOBUF" DATA='data$$' 92 fi 93elif test -f /usr/include/sys/vmparam.h -a -f /usr/include/sys/stream.h # true for 8th edition 94then JOBLIB=-ljobs Options="$Options DBSD=-DBSD" JOBS=jobs.o LFLAGS=-z 95elif test -f /venix 96then LFLAGS=-i Options="$Options VIRAW=-DRAWONLY VENIX=-DVENIX" \ 97 JOBS= MYIO=stdio.o 98elif test -f /xenix 99then LFLAGS=-i Options="$Options VIRAW=-DRAWONLY XENIX=-DXENIX" \ 100 JOBS= MYIO=stdio.o 101elif test -f /bin/uts && /bin/uts # uts system 102then if test -x /etc/preroot # true for u370 on uts 103 then FIXDATA=code DATA=idat 104 fi 105elif test -f /bin/u370 && /bin/u370 106 then U370=U370 FIXDATA=code DATA=idat Options="$Options NOBUF=-DNOBUF" 107elif test -f /bin/pdp11 && /bin/pdp11 108then LFLAGS=-i MYIO=stdio.o 109 if test "$EMACS" 110 then Options="$Options VIRAW=-DRAWONLY" #save text space 111 SUID_EXEC= 112 fi 113elif test -f /bin/iAPX286 && /bin/iAPX286 114then LFLAGS=-i MYIO=stdio.o 115 if test "$EMACS" -a "$VI" # no room for both 116 then EMACS= 117 fi 118 if test "$VI" 119 then Options="$Options VIRAW=-DRAWONLY" #save text space 120 fi 121else if uname -m 2> /dev/null > /dev/null 122 then set -- `uname -m` 123 case "$1" in 124 pdp*) 125 LFLAGS=-i 126 ;; 127 ibm-pc*) 128 LFLAGS=-i Options="$Options VIRAW=-DRAWONLY" 129 ;; 130 esac 131 else set -- `uname -r` 132 case "$1" in 133 [23].*) 134 LFLAGS=-n Options="$Options VIRAW=-DRAWONLY" 135 ;; 136 esac 137 fi 138fi 139if test -f /sys/apollo_logo # true for APOLLO DOMAIN 140then FIXDATA= Options="$Options VIRAW=-DRAWONLY NOBUF=-DNOBUF" \ 141 MYIO=apollo.o VFORK=1 142fi 143if test "$EMACS$VI" 144then EDIT=edit.o 145fi 146if test "$EMACS" 147then Options="$Options DESH=-DESH" EMACS=emacs.o 148else Options="$Options DESH= EMACS=" 149fi 150if test "$VI" 151then Options="$Options DVSH=-DVSH" VI=vi.o 152else Options="$Options DVSH= VI=" 153fi 154if test "$JOBS" 155then Options="$Options DJOBS=-DJOBS" JOBS=jobs.o 156else Options="$Options DJOBS= JOBS=" 157fi 158if test "$VFORK" 159then Options="$Options DVFORK=-DVFORK" VFORK=vfork.o 160else Options="$Options DVFORK= VFORK=" 161fi 162if test X"$LFLAGS" = X-i 163then Options="$Options INT16=-DINT16" FIXDATA= 164fi 165# test for Japanese version of shell 166if test -f /usr/lib/dic/euc.dic 167then Options="$Options MULTIBYTE=-DMULTIBYTE" 168fi 169if test "$SUID_EXEC" 170then Options="$Options SUID_EXEC=-DSUID_EXEC" 171else Options="$Options SUID_EXEC=" 172fi 173$CMD JOBLIB=$JOBLIB JOBS=$JOBS U370=$U370 LFLAGS=$LFLAGS ARK=$ARK DATA=$DATA \ 174 FIXDATA="$FIXDATA" $Options EDIT=$EDIT EMACS=$EMACS VI=$VI \ 175 JOBS=$JOBS VFORK=$VFORK MYIO=$MYIO $sh $SUID_EXEC 176