0
|
1 #! /bin/sh
|
|
2 # Installation script for less.
|
|
3 # This script prompts the operator for various information
|
|
4 # and constructs a makefile.
|
|
5
|
|
6 echo "This script will build a makefile for less."
|
|
7 echo "If you already have a file called \"makefile\" it will be overwritten,"
|
|
8 echo "as will the file \"defines.h\"."
|
|
9 echo "Press RETURN to continue."
|
|
10 read ans
|
|
11
|
|
12 echo "I will ask you some questions about your system."
|
|
13 echo "If you do not know the answer to any question,"
|
|
14 echo "just press RETURN and I will choose a default for you."
|
|
15 echo "Press RETURN now."
|
|
16 read ans
|
|
17
|
|
18 ECHO=./vecho
|
|
19 if [ ! -f $ECHO ]
|
|
20 then
|
|
21 echo "One moment..."
|
|
22 cc -o $ECHO vecho.c
|
|
23 echo ""
|
|
24 fi
|
|
25
|
|
26 $ECHO "Most Unix systems are derived from either System V"
|
|
27 $ECHO "or Berkeley BSD 4.1, 4.2, 4.3, etc."
|
|
28 $ECHO ""
|
|
29 $ECHO "Is your system closest to:"
|
|
30 $ECHO " 1. System V"
|
|
31 $ECHO " 2. BSD 4.1"
|
|
32 $ECHO " 3. BSD 4.2 or later"
|
|
33 $ECHO " 4. Xenix"
|
|
34 $ECHO "Enter a number, or just RETURN if you don't know: \c"
|
|
35 read ans
|
|
36 xenix=0
|
|
37 case "X$ans" in
|
|
38 X1) sys=sys5; sysname="System V" ;;
|
|
39 X2) sys=bsd; bsd41=1; sysname="BSD 4.1" ;;
|
|
40 X3) sys=bsd; bsd41=0; sysname="BSD 4.2" ;;
|
|
41 X4) sys=sys5; xenix=1; sysname="Xenix" ;;
|
|
42 *) sys=unknown ;;
|
|
43 esac
|
|
44 $ECHO ""
|
|
45
|
|
46 DATE=`date`
|
|
47 cat >makefile <<EOF
|
|
48 # Makefile for "less"
|
|
49 # Generated $DATE by $0.
|
|
50 EOF
|
|
51
|
|
52 cat >>makefile <<"EOF"
|
|
53 #
|
|
54 # Invoked as:
|
|
55 # make all
|
|
56 # or make install
|
|
57 # Plain "make" is equivalent to "make all".
|
|
58 #
|
|
59 # If you add or delete functions, remake funcs.h by doing:
|
|
60 # make newfuncs
|
|
61 # This depends on the coding convention of function headers looking like:
|
|
62 # " \t public <function-type> \n <function-name> ( ... ) "
|
|
63 #
|
|
64 # Also provided:
|
|
65 # make lint # Runs "lint" on all the sources.
|
|
66 # make clean # Removes "less" and the .o files.
|
|
67 # make clobber # Pretty much the same as make "clean".
|
|
68
|
|
69 SHELL = /bin/sh
|
|
70
|
|
71 EOF
|
|
72
|
|
73 cat >defines.h <<EOF
|
|
74 /* Definition file for less */
|
|
75 /* Generated $DATE by $0. */
|
|
76
|
|
77 EOF
|
|
78
|
|
79 cat >>defines.h <<EOF
|
|
80 /*
|
|
81 * Define XENIX if running under XENIX 3.0.
|
|
82 */
|
|
83 #define XENIX $xenix
|
|
84
|
|
85 EOF
|
|
86 $ECHO ""
|
|
87
|
|
88
|
|
89
|
|
90 if [ "X$sys" = "Xunknown" ]
|
|
91 then
|
|
92 alldefault=0
|
|
93 else
|
|
94 def=yes
|
|
95 alldefault=1
|
|
96 $ECHO "Do you want to use ALL the defaults for $sysname?"
|
|
97 $ECHO " Enter \"yes\" if you have a STANDARD $sysname."
|
|
98 $ECHO " Enter \"no\" if you want to change any of the defaults. [$def] \c"
|
|
99 read ans
|
|
100 case "X$ans" in
|
|
101 X[yY]*) alldefault=1 ;;
|
|
102 X[nN]*) alldefault=0 ;;
|
|
103 esac
|
|
104 $ECHO ""
|
|
105 fi
|
|
106
|
|
107 if [ $alldefault = 0 ]
|
|
108 then
|
|
109 alloptional=0
|
|
110 else
|
|
111 def=yes
|
|
112 alloptional=1
|
|
113 $ECHO "Do you want to use all the optional features of less?"
|
|
114 $ECHO " Less has several features which you may or may not"
|
|
115 $ECHO " wish to include, such as shell escapes."
|
|
116 $ECHO " Enter \"yes\" if you want to include ALL the optional features."
|
|
117 $ECHO " Enter \"no\" if you want to select individual features. [$def] \c"
|
|
118 read ans
|
|
119 case "X$ans" in
|
|
120 X[yY]*) alloptional=1 ;;
|
|
121 X[nN]*) alloptional=0 ;;
|
|
122 esac
|
|
123 $ECHO ""
|
|
124 fi
|
|
125
|
|
126
|
|
127
|
|
128 def=yes
|
|
129 x=1
|
|
130 if [ $alldefault = 0 ]
|
|
131 then
|
|
132 $ECHO "Does your C compiler support the \"void\" type? [$def] \c"
|
|
133 read ans
|
|
134 case "X$ans" in
|
|
135 X[yY]*) x=1 ;;
|
|
136 X[nN]*) x=0 ;;
|
|
137 esac
|
|
138 $ECHO ""
|
|
139 fi
|
|
140 cat >>defines.h <<EOF
|
|
141 /*
|
|
142 * VOID is 1 if your C compiler supports the "void" type,
|
|
143 * 0 if it does not.
|
|
144 */
|
|
145 #define VOID $x
|
|
146
|
|
147 EOF
|
|
148
|
|
149
|
|
150
|
|
151 def=yes
|
|
152 x="void *"
|
|
153 if [ $alldefault = 0 ]
|
|
154 then
|
|
155 $ECHO "Does your C compiler support the \"void *\" type? [$def] \c"
|
|
156 read ans
|
|
157 case "X$ans" in
|
|
158 X[yY]*) x="void *" ;;
|
|
159 X[nN]*) x="char *" ;;
|
|
160 esac
|
|
161 $ECHO ""
|
|
162 fi
|
|
163 cat >>defines.h <<EOF
|
|
164 /*
|
|
165 * VOID_POINTER is the definition of a pointer to any object.
|
|
166 */
|
|
167 #define VOID_POINTER $x
|
|
168
|
|
169 EOF
|
|
170
|
|
171
|
|
172
|
|
173 def=long
|
|
174 if [ $alldefault = 0 ]
|
|
175 then
|
|
176 $ECHO "What type is the \"offset\" argument to lseek? [$def] \c"
|
|
177 read ans
|
|
178 if [ "X$ans" != "X" ]
|
|
179 then
|
|
180 def=$ans
|
|
181 fi
|
|
182 $ECHO ""
|
|
183 fi
|
|
184 cat >>defines.h <<EOF
|
|
185 /*
|
|
186 * offset_t is the type which lseek() returns.
|
|
187 * It is also the type of lseek()'s second argument.
|
|
188 */
|
|
189 #define offset_t $def
|
|
190
|
|
191 EOF
|
|
192
|
|
193
|
|
194
|
|
195
|
|
196 def=yes; x=1
|
|
197 if [ $alldefault = 0 ]
|
|
198 then
|
|
199 $ECHO "Most Unix systems provide the stat() function."
|
|
200 $ECHO "Does your system have stat()? [$def] \c"
|
|
201 read ans
|
|
202 case "X$ans" in
|
|
203 X[yY]*) x=1 ;;
|
|
204 X[nN]*) x=0 ;;
|
|
205 esac
|
|
206 $ECHO ""
|
|
207 fi
|
|
208 cat >>defines.h <<EOF
|
|
209 /*
|
|
210 * STAT is 1 if your system has the stat() call.
|
|
211 */
|
|
212 #define STAT $x
|
|
213
|
|
214 EOF
|
|
215
|
|
216
|
|
217
|
|
218
|
|
219 def=yes; x=1
|
|
220 if [ $alldefault = 0 ]
|
|
221 then
|
|
222 $ECHO "Most Unix systems provide the perror() function."
|
|
223 $ECHO "Does your system have perror()? [$def] \c"
|
|
224 read ans
|
|
225 case "X$ans" in
|
|
226 X[yY]*) x=1 ;;
|
|
227 X[nN]*) x=0 ;;
|
|
228 esac
|
|
229 $ECHO ""
|
|
230 fi
|
|
231 cat >>defines.h <<EOF
|
|
232 /*
|
|
233 * PERROR is 1 if your system has the perror() call.
|
|
234 * (Actually, if it has sys_errlist, sys_nerr and errno.)
|
|
235 */
|
|
236 #define PERROR $x
|
|
237
|
|
238 EOF
|
|
239
|
|
240
|
|
241
|
|
242
|
|
243 def=yes; x=1
|
|
244 if [ $alldefault = 0 ]
|
|
245 then
|
|
246 $ECHO "Most Unix systems provide the time() function."
|
|
247 $ECHO "Does your system have time()? [$def] \c"
|
|
248 read ans
|
|
249 case "X$ans" in
|
|
250 X[yY]*) x=1 ;;
|
|
251 X[nN]*) x=0 ;;
|
|
252 esac
|
|
253 $ECHO ""
|
|
254 fi
|
|
255 cat >>defines.h <<EOF
|
|
256 /*
|
|
257 * GET_TIME is 1 if your system has the time() call.
|
|
258 */
|
|
259 #define GET_TIME $x
|
|
260
|
|
261 EOF
|
|
262
|
|
263 if [ $x = 0 ]
|
|
264 then
|
|
265 $ECHO "What is the APPROXIMATE performance of your"
|
|
266 $ECHO "machine, as a percentage of a Vax 11/750?"
|
|
267 $ECHO "(Enter 100 if your machine is as fast as a Vax,"
|
|
268 $ECHO " 50 if it is half as fast, 200 if it is twice as fast, etc.)"
|
|
269 $ECHO "The accuracy of this information is not critical."
|
|
270 while :
|
|
271 do
|
|
272 $ECHO "Percent of Vax 11/750 [100]: \c"
|
|
273 read ans
|
|
274 if [ "X$ans" = "X" ]
|
|
275 then
|
|
276 ans=100
|
|
277 fi
|
|
278 longloop=`expr "$ans" "*" 3`
|
|
279 if [ $? = 0 ]
|
|
280 then
|
|
281 break
|
|
282 fi
|
|
283 $ECHO "Enter a number please!"
|
|
284 done
|
|
285 $ECHO ""
|
|
286
|
|
287 cat >>defines.h <<EOF
|
|
288 /*
|
|
289 * LONGLOOP is the number of lines we should process in the line number
|
|
290 * scan before displaying a warning that it will take a while.
|
|
291 */
|
|
292 #define LONGLOOP ($longloop)
|
|
293 EOF
|
|
294 fi
|
|
295
|
|
296
|
|
297
|
|
298
|
|
299 if [ "$sys" = "bsd" ]
|
|
300 then
|
|
301 def=no; x=0
|
|
302 else
|
|
303 def=yes; x=1
|
|
304 fi
|
|
305 if [ $alldefault = 0 ]
|
|
306 then
|
|
307 $ECHO "Most System V systems have termio.h, while most"
|
|
308 $ECHO "Berkeley-derived systems have sgtty.h."
|
|
309 $ECHO "Does your system have termio.h? [$def] \c"
|
|
310 read ans
|
|
311 case "X$ans" in
|
|
312 X[yY]*) x=1 ;;
|
|
313 X[nN]*) x=0 ;;
|
|
314 esac
|
|
315 $ECHO ""
|
|
316 fi
|
|
317 cat >>defines.h <<EOF
|
|
318 /*
|
|
319 * TERMIO is 1 if your system has /usr/include/termio.h.
|
|
320 * This is normally the case for System 5.
|
|
321 * If TERMIO is 0 your system must have /usr/include/sgtty.h.
|
|
322 * This is normally the case for BSD.
|
|
323 */
|
|
324 #define TERMIO $x
|
|
325
|
|
326 EOF
|
|
327
|
|
328
|
|
329
|
|
330
|
|
331 if [ "$sys" = "bsd" -a "$bsd41" = "0" ]
|
|
332 then
|
|
333 def=yes; x=1
|
|
334 else
|
|
335 def=no; x=0
|
|
336 fi
|
|
337 if [ $alldefault = 0 ]
|
|
338 then
|
|
339 $ECHO "Most BSD 4.2 and 4.3 systems have both _setjmp() and setjmp()."
|
|
340 $ECHO "Most System V and BSD 4.1 systems have only setjmp()."
|
|
341 $ECHO "Does your system have both _setjmp() and setjmp()? [$def] \c"
|
|
342 read ans
|
|
343 case "X$ans" in
|
|
344 X[yY]*) x=1 ;;
|
|
345 X[nN]*) x=0 ;;
|
|
346 esac
|
|
347 $ECHO ""
|
|
348 fi
|
|
349 cat >>defines.h <<EOF
|
|
350 /*
|
|
351 * HAS__SETJMP is 1 if your system has the _setjmp() call.
|
|
352 * This is normally the case only for BSD 4.2 and up,
|
|
353 * not for BSD 4.1 or System 5.
|
|
354 */
|
|
355 #define HAS__SETJMP $x
|
|
356
|
|
357 EOF
|
|
358
|
|
359
|
|
360
|
|
361
|
|
362 if [ "$sys" = "bsd" -a "$bsd41" = "0" ]
|
|
363 then
|
|
364 def=yes; x=1
|
|
365 else
|
|
366 def=no; x=0
|
|
367 fi
|
|
368 if [ $alldefault = 0 ]
|
|
369 then
|
|
370 $ECHO "Most BSD 4.2 and 4.3 systems have the sigsetmask() call."
|
|
371 $ECHO "Most System V and BSD 4.1 systems do not."
|
|
372 $ECHO "Does your system have sigsetmask()? [$def] \c"
|
|
373 read ans
|
|
374 case "X$ans" in
|
|
375 X[yY]*) x=1 ;;
|
|
376 X[nN]*) x=0 ;;
|
|
377 esac
|
|
378 $ECHO ""
|
|
379 fi
|
|
380 cat >>defines.h <<EOF
|
|
381 /*
|
|
382 * SIGSETMASK is 1 if your system has the sigsetmask() call.
|
|
383 * This is normally the case only for BSD 4.2,
|
|
384 * not for BSD 4.1 or System 5.
|
|
385 */
|
|
386 #define SIGSETMASK $x
|
|
387
|
|
388 EOF
|
|
389
|
|
390
|
|
391
|
|
392
|
|
393 if [ "$sys" = "sys5" -a "$xenix" = "0" ]
|
|
394 then
|
|
395 def=yes; x=1
|
|
396 else
|
|
397 def=no; x=0
|
|
398 fi
|
|
399 if [ $alldefault = 0 ]
|
|
400 then
|
|
401 $ECHO "Some SCO System V systems need sys/ptem.h included to get"
|
|
402 $ECHO "the size of the screen (struct winsize)."
|
|
403 $ECHO "Does your system need sys/ptem.h? [$def] \c"
|
|
404 read ans
|
|
405 case "X$ans" in
|
|
406 X[yY]*) x=1 ;;
|
|
407 X[nN]*) x=0 ;;
|
|
408 esac
|
|
409 $ECHO ""
|
|
410 fi
|
|
411 cat >>defines.h <<EOF
|
|
412 /*
|
|
413 * NEED_PTEM_H is 1 if your system needs sys/ptem.h to declare struct winsize.
|
|
414 * This is normally the case only for SCOs System V.
|
|
415 */
|
|
416 #define NEED_PTEM_H $x
|
|
417
|
|
418 EOF
|
|
419
|
|
420
|
|
421 if [ "$sys" = "bsd" ]
|
|
422 then
|
|
423 def=2; REGCMP=0;RECOMP=1
|
|
424 else
|
|
425 def=1; REGCMP=1;RECOMP=0
|
|
426 fi
|
|
427 if [ $alldefault = 0 ]
|
|
428 then
|
|
429 $ECHO "Most System V systems have the regcmp() function."
|
|
430 $ECHO "Most Berkeley-derived systems have the re_comp() function."
|
|
431 $ECHO "Does your system have:"
|
|
432 $ECHO " 1. regcmp"
|
|
433 $ECHO " 2. re_comp"
|
|
434 $ECHO " 3. neither [$def] \c"
|
|
435 read ans
|
|
436 case "X$ans" in
|
|
437 X1) REGCMP=1;RECOMP=0 ;;
|
|
438 X2) REGCMP=0;RECOMP=1 ;;
|
|
439 X3) REGCMP=0;RECOMP=0 ;;
|
|
440 esac
|
|
441 $ECHO ""
|
|
442 fi
|
|
443 cat >>defines.h <<EOF
|
|
444 /*
|
|
445 * REGCMP is 1 if your system has the regcmp() function.
|
|
446 * This is normally the case for System 5.
|
|
447 * RECOMP is 1 if your system has the re_comp() function.
|
|
448 * This is normally the case for BSD.
|
|
449 * If neither is 1, pattern matching is supported, but without metacharacters.
|
|
450 */
|
|
451 #define REGCMP $REGCMP
|
|
452 #define RECOMP $RECOMP
|
|
453
|
|
454 EOF
|
|
455
|
|
456
|
|
457
|
|
458
|
|
459 def=yes
|
|
460 x=1
|
|
461 if [ $alloptional = 0 ]
|
|
462 then
|
|
463 $ECHO "Do you wish to allow shell escapes? [$def] \c"
|
|
464 read ans
|
|
465 case "X$ans" in
|
|
466 X[yY]*) x=1 ;;
|
|
467 X[nN]*) x=0 ;;
|
|
468 esac
|
|
469 $ECHO ""
|
|
470 fi
|
|
471 cat >>defines.h <<EOF
|
|
472 /*
|
|
473 * SHELL_ESCAPE is 1 if you wish to allow shell escapes.
|
|
474 * (This is possible only if your system supplies the system() function.)
|
|
475 */
|
|
476 #define SHELL_ESCAPE $x
|
|
477
|
|
478 EOF
|
|
479
|
|
480
|
|
481
|
|
482 def=yes
|
|
483 x=1
|
|
484 edname="vi"
|
|
485 if [ $alloptional = 0 ]
|
|
486 then
|
|
487 $ECHO "Do you wish to allow editor escapes? [$def] \c"
|
|
488 read ans
|
|
489 case "X$ans" in
|
|
490 X[nN]*) x=0; edname="" ;;
|
|
491 X[yY]*) x=1
|
|
492 $ECHO "What is the pathname of the default editor? [$edname] \c"
|
|
493 read ans
|
|
494 if [ "x$ans" != "x" ]
|
|
495 then
|
|
496 edname=$ans
|
|
497 fi
|
|
498 ;;
|
|
499 esac
|
|
500 $ECHO ""
|
|
501 fi
|
|
502 cat >>defines.h <<EOF
|
|
503 /*
|
|
504 * EDITOR is 1 if you wish to allow editor invocation (the "v" command).
|
|
505 * (This is possible only if your system supplies the system() function.)
|
|
506 * EDIT_PGM is the name of the (default) editor to be invoked.
|
|
507 */
|
|
508 #define EDITOR $x
|
|
509 #define EDIT_PGM "$edname"
|
|
510
|
|
511 EOF
|
|
512
|
|
513
|
|
514
|
|
515
|
|
516 def=yes
|
|
517 x=1
|
|
518 if [ $alloptional = 0 ]
|
|
519 then
|
|
520 $ECHO "Do you wish to support \"tag\" files? [$def] \c"
|
|
521 read ans
|
|
522 case "X$ans" in
|
|
523 X[yY]*) x=1 ;;
|
|
524 X[nN]*) x=0 ;;
|
|
525 esac
|
|
526 $ECHO ""
|
|
527 fi
|
|
528 cat >>defines.h <<EOF
|
|
529 /*
|
|
530 * TAGS is 1 if you wish to support tag files.
|
|
531 */
|
|
532 #define TAGS $x
|
|
533
|
|
534 EOF
|
|
535
|
|
536
|
|
537
|
|
538 def=yes
|
|
539 x=1
|
|
540 if [ $alloptional = 0 ]
|
|
541 then
|
|
542 $ECHO "Do you wish to allow user-defined key definitions? [$def] \c"
|
|
543 read ans
|
|
544 case "X$ans" in
|
|
545 X[yY]*) x=1 ;;
|
|
546 X[nN]*) x=0 ;;
|
|
547 esac
|
|
548 $ECHO ""
|
|
549 fi
|
|
550 USERFILE=$x
|
|
551 cat >>defines.h <<EOF
|
|
552 /*
|
|
553 * USERFILE is 1 if you wish to allow a .less file to specify
|
|
554 * user-defined key bindings.
|
|
555 */
|
|
556 #define USERFILE $x
|
|
557
|
|
558 EOF
|
|
559
|
|
560
|
|
561
|
|
562 def=yes
|
|
563 x=1
|
|
564 if [ $alldefault = 0 ]
|
|
565 then
|
|
566 $ECHO "If your system provides the popen() function and"
|
|
567 $ECHO "the \"echo\" shell command, you may allow shell metacharacters"
|
|
568 $ECHO "to be expanded in filenames."
|
|
569 $ECHO "Do you wish to allow shell metacharacters in filenames? [$def] \c"
|
|
570 read ans
|
|
571 case "X$ans" in
|
|
572 X[yY]*) x=1 ;;
|
|
573 X[nN]*) x=0 ;;
|
|
574 esac
|
|
575 $ECHO ""
|
|
576 fi
|
|
577 cat >>defines.h <<EOF
|
|
578 /*
|
|
579 * GLOB is 1 if you wish to have shell metacharacters expanded in filenames.
|
|
580 * This will generally work if your system provides the "popen" function
|
|
581 * and the "echo" shell command.
|
|
582 */
|
|
583 #define GLOB $x
|
|
584
|
|
585 /*
|
|
586 * PIPEC is 1 if you wish to have the "|" command
|
|
587 * which allows the user to pipe data into a shell command.
|
|
588 */
|
|
589 #define PIPEC $x
|
|
590
|
|
591 EOF
|
|
592
|
|
593
|
|
594
|
|
595 def=yes
|
|
596 x=1
|
|
597 if [ $alloptional = 0 ]
|
|
598 then
|
|
599 $ECHO "Do you wish to allow log files (-l option)? [$def] \c"
|
|
600 read ans
|
|
601 case "X$ans" in
|
|
602 X[yY]*) x=1 ;;
|
|
603 X[nN]*) x=0 ;;
|
|
604 esac
|
|
605 $ECHO ""
|
|
606 fi
|
|
607 cat >>defines.h <<EOF
|
|
608 /*
|
|
609 * LOGFILE is 1 if you wish to allow the -l option (to create log files).
|
|
610 */
|
|
611 #define LOGFILE $x
|
|
612
|
|
613 EOF
|
|
614
|
|
615 cat >>defines.h <<EOF
|
|
616 /*
|
|
617 * ONLY_RETURN is 1 if you want RETURN to be the only input which
|
|
618 * will continue past an error message.
|
|
619 * Otherwise, any key will continue past an error message.
|
|
620 */
|
|
621 #define ONLY_RETURN 0
|
|
622
|
|
623 EOF
|
|
624
|
|
625 cat >>makefile <<EOF
|
|
626
|
|
627 ##########################################################################
|
|
628 # Compilation environment.
|
|
629 ##########################################################################
|
|
630
|
|
631 EOF
|
|
632
|
|
633
|
|
634
|
|
635 if [ "$xenix" = "1" ]
|
|
636 then
|
|
637 LIBS="-ltermlib"
|
|
638 elif [ "$sys" = "bsd" ]
|
|
639 then
|
|
640 LIBS="-ltermcap"
|
|
641 else
|
|
642 LIBS="-lcurses -ltermcap -lPW"
|
|
643 fi
|
|
644 if [ $alldefault = 0 ]
|
|
645 then
|
|
646 $ECHO "To build \"less\", you must link with libraries supplied by your system."
|
|
647 $ECHO "(If this needs to be changed later, edit the makefile"
|
|
648 $ECHO "and change the definition of LIBS.)"
|
|
649 $ECHO "What libraries should be used [$LIBS] \c"
|
|
650 read ans
|
|
651 if [ "X$ans" != "X" ]
|
|
652 then
|
|
653 LIBS="$ans"
|
|
654 fi
|
|
655 $ECHO ""
|
|
656 fi
|
|
657 cat >>makefile <<EOF
|
|
658 # LIBS is the list of libraries needed.
|
|
659 LIBS = $LIBS
|
|
660
|
|
661 EOF
|
|
662
|
|
663
|
|
664
|
|
665 INSTALL_LESS="/usr/local/bin/less"
|
|
666 INSTALL_KEY="/usr/local/bin/lesskey"
|
|
667 INSTALL_HELP="/usr/local/bin/less.hlp"
|
|
668 INSTALL_LESSMAN="/usr/man/man1/less.1"
|
|
669 INSTALL_KEYMAN="/usr/man/man1/lesskey.1"
|
|
670 LESS_MANUAL="less.nro"
|
|
671 KEY_MANUAL="lesskey.nro"
|
|
672 if [ $alldefault = 0 ]
|
|
673 then
|
|
674 $ECHO "What is the name of the \"public\" (installed) version of less?"
|
|
675 $ECHO " [$INSTALL_LESS] \c"
|
|
676 read ans
|
|
677 if [ "X$ans" != "X" ]
|
|
678 then
|
|
679 INSTALL_LESS="$ans"
|
|
680 fi
|
|
681 $ECHO "What is the name of the \"public\" (installed) version of lesskey?"
|
|
682 $ECHO " [$INSTALL_KEY] \c"
|
|
683 read ans
|
|
684 if [ "X$ans" != "X" ]
|
|
685 then
|
|
686 INSTALL_KEY="$ans"
|
|
687 fi
|
|
688 $ECHO "What is the name of the \"public\" (installed) version of the help file?"
|
|
689 $ECHO " [$INSTALL_HELP] \c"
|
|
690 read ans
|
|
691 if [ "X$ans" != "X" ]
|
|
692 then
|
|
693 INSTALL_HELP="$ans"
|
|
694 fi
|
|
695 $ECHO "What is the name of the \"public\" (installed) version of the less manual page?"
|
|
696 $ECHO " [$INSTALL_LESSMAN] \c"
|
|
697 read ans
|
|
698 if [ "X$ans" != "X" ]
|
|
699 then
|
|
700 INSTALL_LESSMAN="$ans"
|
|
701 fi
|
|
702 $ECHO "What is the name of the \"public\" (installed) version of the lesskey manual page?"
|
|
703 $ECHO " [$INSTALL_KEYMAN] \c"
|
|
704 read ans
|
|
705 if [ "X$ans" != "X" ]
|
|
706 then
|
|
707 INSTALL_KEYMAN="$ans"
|
|
708 fi
|
|
709 $ECHO ""
|
|
710 fi
|
|
711
|
|
712 cat >>defines.h <<EOF
|
|
713 /*
|
|
714 * HELPFILE is the full pathname of the help file.
|
|
715 */
|
|
716 #define HELPFILE "$INSTALL_HELP"
|
|
717
|
|
718 EOF
|
|
719
|
|
720 cat >>makefile <<EOF
|
|
721 # INSTALL_LESS is a list of the public versions of less.
|
|
722 # INSTALL_KEY is a list of the public versions of lesskey.
|
|
723 # INSTALL_HELP is a list of the public version of the help file.
|
|
724 # INSTALL_LESSMAN is a list of the public versions of the less manual page.
|
|
725 # INSTALL_KEYMAN is a list of the public versions of the lesskey manual page.
|
|
726 INSTALL_LESS = \$(ROOT)$INSTALL_LESS
|
|
727 INSTALL_KEY = \$(ROOT)$INSTALL_KEY
|
|
728 INSTALL_HELP = \$(ROOT)$INSTALL_HELP
|
|
729 INSTALL_LESSMAN = \$(ROOT)$INSTALL_LESSMAN
|
|
730 INSTALL_KEYMAN = \$(ROOT)$INSTALL_KEYMAN
|
|
731 LESS_MANUAL = $LESS_MANUAL
|
|
732 KEY_MANUAL = $KEY_MANUAL
|
|
733 HELPFILE = $INSTALL_HELP
|
|
734
|
|
735
|
|
736 EOF
|
|
737
|
|
738
|
|
739
|
|
740 cat >>makefile <<"EOF"
|
|
741 # OPTIM is passed to the compiler and the loader.
|
|
742 # It is normally "-O" but may be, for example, "-g".
|
|
743 OPTIM = -O
|
|
744
|
|
745 CFLAGS = $(OPTIM)
|
|
746
|
|
747
|
|
748
|
|
749 ##########################################################################
|
|
750 # Files
|
|
751 ##########################################################################
|
|
752
|
|
753 SRC1 = ch.c cmdbuf.c command.c decode.c help.c input.c
|
|
754 SRC2 = line.c linenum.c main.c edit.c option.c optfunc.c \
|
|
755 opttbl.c os.c
|
|
756 SRC3 = charset.c filename.c lsystem.c output.c position.c ifile.c \
|
|
757 brac.c forwback.c jump.c search.c
|
|
758 SRC4 = mark.c prompt.c screen.c signal.c tags.c ttyin.c version.c
|
|
759
|
|
760 SRC = $(SRC1) $(SRC2) $(SRC3) $(SRC4)
|
|
761
|
|
762 OBJ = brac.o ch.o charset.o cmdbuf.o command.o decode.o edit.o filename.o \
|
|
763 forwback.o help.o input.o jump.o line.o linenum.o \
|
|
764 lsystem.o main.o option.o optfunc.o opttbl.o os.o \
|
|
765 output.o position.o mark.o ifile.o prompt.o screen.o \
|
|
766 search.o signal.o tags.o ttyin.o version.o
|
|
767
|
|
768
|
|
769 ##########################################################################
|
|
770 # Rules for building stuff
|
|
771 ##########################################################################
|
|
772
|
|
773 EOF
|
|
774
|
|
775 if [ "$USERFILE" = "1" ]
|
|
776 then
|
|
777 cat >>makefile <<"EOF"
|
|
778 all: less lesskey
|
|
779 install: install_less install_help install_key install_lman install_kman
|
|
780 EOF
|
|
781 else
|
|
782 cat >>makefile <<"EOF"
|
|
783 all: less
|
|
784 install: install_less install_help install_lman
|
|
785 EOF
|
|
786 fi
|
|
787
|
|
788 cat >>makefile <<"EOF"
|
|
789
|
|
790 less: $(OBJ)
|
|
791 $(CC) $(LDFLAGS) $(OPTIM) -o less $(OBJ) $(LIBS) $(LDLIBS)
|
|
792
|
|
793 lesskey: lesskey.o
|
|
794 $(CC) $(LDFLAGS) $(OPTIM) -o lesskey lesskey.o $(LDLIBS)
|
|
795
|
|
796 install_less: less
|
|
797 for f in $(INSTALL_LESS); do rm -f $$f; cp less $$f; done
|
|
798 touch install_less
|
|
799
|
|
800 install_key: lesskey
|
|
801 for f in $(INSTALL_KEY); do rm -f $$f; cp lesskey $$f; done
|
|
802 touch install_key
|
|
803
|
|
804 install_help: less.hlp
|
|
805 for f in $(INSTALL_HELP); do rm -f $$f; cp less.hlp $$f; done
|
|
806 touch install_help
|
|
807
|
|
808 install_lman: $(LESS_MANUAL)
|
|
809 for f in $(INSTALL_LESSMAN); do rm -f $$f; cp $(LESS_MANUAL) $$f; done
|
|
810 touch install_lman
|
|
811
|
|
812 install_kman: $(KEY_MANUAL)
|
|
813 for f in $(INSTALL_KEYMAN); do rm -f $$f; cp $(KEY_MANUAL) $$f; done
|
|
814 touch install_kman
|
|
815
|
|
816 ##########################################################################
|
|
817 # Maintenance
|
|
818 ##########################################################################
|
|
819
|
|
820 lint:
|
|
821 lint -hp $(SRC)
|
|
822
|
|
823 newfuncs funcs.h:
|
|
824 if [ -f funcs.h ]; then mv funcs.h funcs.h.OLD; fi
|
|
825 awk -f mkfuncs.awk $(SRC) >funcs.h
|
|
826
|
|
827 clean:
|
|
828 rm -f $(OBJ) lesskey.o less lesskey vecho
|
|
829
|
|
830 clobber:
|
|
831 rm -f *.o less lesskey vecho install_less install_key \
|
|
832 install_help install_lman install_kman
|
|
833
|
|
834 shar:
|
|
835 shar -v README CHANGES linstall \
|
|
836 less.nro lesskey.nro \
|
|
837 vecho.c mkfuncs.awk > less1.shr
|
|
838 shar -v less.man lesskey.man \
|
|
839 less.h position.h cmd.h option.h > less2.shr
|
|
840 shar -v lesskey.c $(SRC1) > less3.shr
|
|
841 shar -v $(SRC2) > less4.shr
|
|
842 shar -v $(SRC3) less.hlp > less5.shr
|
|
843 shar -v $(SRC4) funcs.h > less6.shr
|
|
844
|
|
845
|
|
846 ##########################################################################
|
|
847 # Dependencies
|
|
848 ##########################################################################
|
|
849
|
|
850 $(OBJ): less.h funcs.h defines.h position.h
|
|
851 command.o decode.o: cmd.h
|
|
852 option.o opttbl.o optfunc.o: option.h
|
|
853
|
|
854 lesskey.o: less.h funcs.h defines.h cmd.h
|
|
855
|
|
856 EOF
|
|
857 $ECHO ""
|
|
858
|
|
859 $ECHO "The makefile and defines.h have been built."
|
|
860 $ECHO "You should check them to make sure everything is as you want it to be."
|
|
861 $ECHO "When you are satisfied, just type \"make\", and \"less\" will be built."
|