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