BSD 4_3 development
[unix-history] / usr / contrib / icon / Icon-setup
CommitLineData
d88663f0
C
1modfiles="tran/Makefile iconx/Makefile bin/Makefile h/config.h \
2 samples/Test test/Test port/Runtest port/Trantest port/Linktest \
3 libtest/Proctest src/cmd/Makefile \
4 src/lib/Makefile samples/Test test/Test \
5 icon-pi Pimakefile"
6editor="ed - "
7iroot=`pwd`
8echo Icon root directory is $iroot .
9echo Getting generic copies of all files ...
10for i in $modfiles
11do
12 cp $i.gen $i
13done
14rm -f functions/ranlib operators/ranlib lib/ranlib rt/ranlib pilib/ranlib
15wholist=
16ldlist=
17hoststr=
18somehost=
19hzrate=60
20nofp=
21sys=
22fork=fork
23interpex=
24ibin="$iroot/bin"
25echo "#define OPTIONS \"$*\"" >>h/config.h
26echo Scanning arguments ...
27while test $1
28do
29 case $1 in
30 -pdp11)
31 if test -n "$sys"
32 then
33 echo "Only one of -vax, -pdp11, or -port is allowed."
34 echo "Try again."
35 exit
36 fi
37 sys=pdp11
38 wholist="$wholist PDP11"
39 ldlist="$ldlist -i";;
40 -vax)
41 if test -n "$sys"
42 then
43 echo "Only one of -vax, -pdp11, or -port is allowed."
44 echo "Try again."
45 exit
46 fi
47 sys=vax
48 wholist="$wholist VAX";;
49 -port)
50 if test -n "$sys"
51 then
52 echo "Only one of -vax, -pdp11, or -port is allowed."
53 echo "Try again."
54 exit
55 fi
56 sys=port
57 wholist="$wholist PORT";;
58 -xpx)
59 xpx=yes
60 wholist="$wholist XPX";;
61 -nofp)
62 wholist="$wholist NOFP"
63 nofp=yes;;
64 -interpex)
65 interpex=yes
66 wholist="$wholist DIREX";;
67 -host)
68 somehost=x
69 shift
70 case $1 in
71 gethost*)
72 wholist="$wholist GETHOST";;
73 uname)
74 wholist="$wholist UNAME";;
75 whoami)
76 wholist="$wholist WHOHOST";;
77 *)
78 hoststr=$1;;
79 esac;;
80 -hz)
81 shift
82 hzrate=$1;;
83 -vfork)
84 fork=vfork;;
85 -usg)
86 UsG=yes;;
87 -az)
88 ArizonA=yes;;
89 -ibin)
90 shift
91 ibin=$1;;
92 -iconx)
93 shift
94 IconX=$1;;
95 -sets)
96 wholist="$wholist SETS";;
97 -debug)
98 wholist="$wholist DEBUG";;
99
100 *)
101 echo Bad option \"$1\"
102 exit;;
103 esac
104 shift
105done
106if test -z "$sys"
107then
108 echo You must specify -vax, -pdp11, or -port. Try again.
109 exit
110fi
111if test -z "$somehost"
112then
113 echo You must specify a value for -host. Try again.
114 exit
115fi
116IconX=${IconX-"$ibin/iconx"}
117if test -n "$interpex"
118then
119 echo -n $IconX >/tmp/$$
120 set xx `/bin/ls -l /tmp/$$`
121 rm -f /tmp/$$
122 if test $5 -gt 29
123 then
124 echo "The pathname for iconx, \"$IconX\", is too long."
125 echo " It must not exceed 29 characters (it is currently $5)"
126 echo " or execution of the interpretable files will mysteriously"
127 echo " fail. See Section 3.1 in the installation document and"
128 echo " the -iconx option of icon-setup, and try again."
129 exit
130 fi
131fi
132if test -r /usr/include/sys/time.h
133then
134 echo '#define SYSTIME' >>h/config.h
135fi
136echo Editing files ...
137for i in h/config.h
138do
139 for def in $wholist
140 do
141 echo "#define $def" >>$i
142 done
143 echo "#define IntBin \"$ibin\"" >>$i
144 echo "#define Iconx \"$IconX\"" >> $i
145 echo "#define IconxHdr \"$ibin/iconx.hdr\"" >>$i
146 echo "#define FORK $fork" >>$i
147 if test -n "$UsG"
148 then
149 echo "#define index strchr" >>$i
150 echo "#define rindex strrchr" >>$i
151 fi
152 if test -n "$ArizonA"
153 then
154 echo "#define AZ" >> $i
155 fi
156done
157for i in h/config.h
158do
159 echo "#define HZ $hzrate" >>$i
160 if test -n "$hoststr"
161 then
162 echo "#define HOSTSTR \"$hoststr\"" >>$i
163 fi
164done
165for i in iconx/Makefile tran/Makefile Pimakefile
166do
167 $editor $i <<EOF >/dev/null
168 /LDFLAGS/s/LDFLAGS=/LDFLAGS=$ldlist/
169 w
170 q
171EOF
172done
173$editor Pimakefile <<EOF >/dev/null
174/QFORK/
175.s:QFORK:$fork:p
176w
177q
178EOF
179if test -n "$nofp"
180then
181 $editor iconx/Makefile <<EOF >/dev/null
182 /-lc$/s/$/ -lfpsim/
183 w
184 q
185EOF
186fi
187if test $sys = "pdp11"
188then
189 $editor bin/Makefile <<EOF >/dev/null
190 /cc -O -N/s/-N//
191 w
192 q
193EOF
194fi
195for i in port/Runtest port/Trantest port/Linktest libtest/Proctest \
196 src/cmd/Makefile src/lib/Makefile \
197 samples/Test test/Test
198do
199 $editor $iroot/$i <<EOF >/dev/null
200 /PATH/
201 .s:PATH:$ibin:p
202 w
203 q
204EOF
205done
206if test -n "$UsG"
207then
208 echo Making dummy ranlib programs for System III/V compatibility ...
209 for i in functions operators lib rt pilib
210 do
211 echo ...$i/ranlib
212 cat >$i/ranlib <<EOF
213EOF
214 chmod 755 $i/ranlib
215 done
216fi
217for i in icon-pi Pimakefile
218do
219 $editor $iroot/$i <<EOF >/dev/null
220 /PATH/
221 .s:PATH:$iroot:p
222 w
223 q
224EOF
225done
226echo Setup is complete.