# Installation script for less.
# This script prompts the operator for various information
# and constructs a makefile.
echo "This script will build a makefile for less."
echo "If you already have a file called \"makefile\" it will be overwritten."
echo "Press RETURN to continue."
echo "I will ask you some questions about your system."
echo "If you do not know the answer to any question,"
echo "just press RETURN and I will choose a default for you."
$ECHO "Most Unix systems are derived from either System V"
$ECHO "or Berkeley BSD 4.1, 4.2, 4.3, etc."
$ECHO "Is your system closest to:"
$ECHO " 3. BSD 4.2 or later"
$ECHO "Enter a number, or just RETURN if you don't know: \c"
X1
) sys
=sys5
; sysname
="System V" ;;
X2
) sys
=bsd
; bsd41
=1; sysname
="BSD 4.1" ;;
X3
) sys
=bsd
; bsd41
=0; sysname
="BSD 4.2" ;;
X4
) sys
=sys5
; xenix
=1; sysname
="Xenix" ;;
# Plain "make" is equivalent to "make all".
# If you add or delete functions, remake funcs.h by doing:
# This depends on the coding convention of function headers looking like:
# " \t public <function-type> \n <function-name> ( ... ) "
# make lint # Runs "lint" on all the sources.
# make clean # Removes "less" and the .o files.
# make clobber # Pretty much the same as make "clean".
/* Definition file for less */
/* Generated $DATE by $0. */
* Define XENIX if running under XENIX 3.0.
if [ "X$sys" = "Xunknown" ]
$ECHO "Do you want to use ALL the defaults for $sysname?"
$ECHO " Enter \"yes\" if you have a STANDARD $sysname."
$ECHO " Enter \"no\" if you want to change any of the defaults. [$def] \c"
$ECHO "Do you want to use all the optional features of less?"
$ECHO " Less has several features which you may or may not"
$ECHO " wish to include, such as shell escapes."
$ECHO " Enter \"yes\" if you want to include ALL the optional features."
$ECHO " Enter \"no\" if you want to select individual features. [$def] \c"
$ECHO "Does your C compiler support the \"void\" type? [$def] \c"
* VOID is 1 if your C compiler supports the "void" type,
$ECHO "What type is the \"offset\" argument to lseek? [$def] \c"
* offset_t is the type which lseek() returns.
* It is also the type of lseek()'s second argument.
$ECHO "Most Unix systems provide the stat() function."
$ECHO "Does your system have stat()? [$def] \c"
* STAT is 1 if your system has the stat() call.
$ECHO "Most Unix systems provide the perror() function."
$ECHO "Does your system have perror()? [$def] \c"
* PERROR is 1 if your system has the perror() call.
* (Actually, if it has sys_errlist, sys_nerr and errno.)
$ECHO "Most Unix systems provide the time() function."
$ECHO "Does your system have time()? [$def] \c"
* GET_TIME is 1 if your system has the time() call.
$ECHO "What is the APPROXIMATE performance of your"
$ECHO "machine, as a percentage of a Vax 11/750?"
$ECHO "(Enter 100 if your machine is as fast as a Vax,"
$ECHO " 50 if it is half as fast, 200 if it is twice as fast, etc.)"
$ECHO "The accuracy of this information is not critical."
$ECHO "Percent of Vax 11/750 [100]: \c"
longloop=`expr "$ans" "*" 3`
$ECHO "Enter a number please!"
* LONGLOOP is the number of lines we should process in the line number
* scan before displaying a warning that it will take a while.
#define LONGLOOP ($longloop)
$ECHO "Most System V systems have termio.h, while most"
$ECHO "Berkeley-derived systems have sgtty.h."
$ECHO "Does your system have termio.h? [$def] \c"
* TERMIO is 1 if your system has /usr/include/termio.h.
* This is normally the case for System 5.
* If TERMIO is 0 your system must have /usr/include/sgtty.h.
* This is normally the case for BSD.
if [ "$sys" = "bsd" -a "$bsd41" = "0" ]
$ECHO "Most BSD 4.2 and 4.3 systems have the sigsetmask() call."
$ECHO "Most System V and BSD 4.1 systems do not."
$ECHO "Does your system have sigsetmask()? [$def] \c"
* SIGSETMASK is 1 if your system has the sigsetmask() call.
* This is normally the case only for BSD 4.2,
* not for BSD 4.1 or System 5.
$ECHO "Most System V systems have the regcmp() function."
$ECHO "Most Berkeley-derived systems have the re_comp() function."
$ECHO "Does your system have:"
$ECHO " 3. neither [$def] \c"
* REGCMP is 1 if your system has the regcmp() function.
* This is normally the case for System 5.
* RECOMP is 1 if your system has the re_comp() function.
* This is normally the case for BSD.
* If neither is 1, pattern matching is supported, but without metacharacters.
$ECHO "Do you wish to allow shell escapes? [$def] \c"
* SHELL_ESCAPE is 1 if you wish to allow shell escapes.
* (This is possible only if your system supplies the system() function.)
$ECHO "Do you wish to allow editor escapes? [$def] \c"
X[nN]*) x=0; edname="" ;;
$ECHO "What is the pathname of the default editor? [$edname] \c"
* EDITOR is 1 if you wish to allow editor invocation (the "v" command).
* (This is possible only if your system supplies the system() function.)
* EDIT_PGM is the name of the (default) editor to be invoked.
#define EDIT_PGM "$edname"
$ECHO "Do you wish to support \"tag\" files? [$def] \c"
* TAGS is 1 if you wish to support tag files.
$ECHO "Do you wish to allow user-defined key definitions? [$def] \c"
* USERFILE is 1 if you wish to allow a .less file to specify
* user-defined key bindings.
$ECHO "If your system provides the popen() function and"
$ECHO "the \"$ECHO\" shell command, you may allow shell metacharacters"
$ECHO "to be expanded in filenames."
$ECHO "Do you wish to allow shell metacharacters in filenames? [$def] \c"
* GLOB is 1 if you wish to have shell metacharacters expanded in filenames.
* This will generally work if your system provides the "popen" function
* and the "$ECHO" shell command.
$ECHO "Do you wish to allow log files (-l option)? [$def] \c"
* LOGFILE is 1 if you wish to allow the -l option (to create log files).
* ONLY_RETURN is 1 if you want RETURN to be the only input which
* will continue past an error message.
* Otherwise, any key will continue past an error message.
##########################################################################
# Compilation environment.
##########################################################################
LIBS="-lcurses -ltermcap -lPW"
$ECHO "To build \"less\", you must link with libraries supplied by your system."
$ECHO "(If this needs to be changed later, edit the makefile"
$ECHO "and change the definition of LIBS.)"
$ECHO "What libraries should be used [$LIBS] \c"
# LIBS is the list of libraries needed.
INSTALL_LESS="/usr/local/bin/less"
INSTALL_KEY="/usr/local/bin/lesskey"
INSTALL_HELP="/usr/local/bin/less.help"
INSTALL_LESSMAN="/usr/man/man1/less.1"
INSTALL_KEYMAN="/usr/man/man1/lesskey.1"
$ECHO "What is the name of the \"public\" (installed) version of less?"
$ECHO " [$INSTALL_LESS] \c"
$ECHO "What is the name of the \"public\" (installed) version of lesskey?"
$ECHO " [$INSTALL_KEY] \c"
$ECHO "What is the name of the \"public\" (installed) version of the help file?"
$ECHO " [$INSTALL_HELP] \c"
$ECHO "What is the name of the \"public\" (installed) version of the less manual page?"
$ECHO " [$INSTALL_LESSMAN] \c"
$ECHO "What is the name of the \"public\" (installed) version of the lesskey manual page?"
$ECHO " [$INSTALL_KEYMAN] \c"
# INSTALL_LESS is a list of the public versions of less.
# INSTALL_KEY is a list of the public versions of lesskey.
# INSTALL_HELP is a list of the public version of the help file.
# INSTALL_LESSMAN is a list of the public versions of the less manual page.
# INSTALL_KEYMAN is a list of the public versions of the lesskey manual page.
INSTALL_LESS = \$(ROOT)$INSTALL_LESS
INSTALL_KEY = \$(ROOT)$INSTALL_KEY
INSTALL_HELP = \$(ROOT)$INSTALL_HELP
INSTALL_LESSMAN = \$(ROOT)$INSTALL_LESSMAN
INSTALL_KEYMAN = \$(ROOT)$INSTALL_KEYMAN
LESS_MANUAL = $LESS_MANUAL
# OPTIM is passed to the compiler and the loader.
# It is normally "-O" but may be, for example, "-g".
##########################################################################
##########################################################################
SRC1
= main.c option.c prim.c ch.c position.c input.c linenum.c
SRC2
= screen.c prompt.c line.c signal.c os.c
help.c ttyin.c
command.c
SRC3
= output.c decode.c tags.c version.c
SRC
= $
(SRC1
) $
(SRC2
) $
(SRC3
)
OBJ
= main.o option.o prim.o ch.o position.o input.o output.o \
screen.o prompt.o line.o signal.o os.o
help.o ttyin.o \
decode.o
command.o linenum.o tags.o version.o
##########################################################################
# Rules for building stuff
##########################################################################
install: install_less install_help install_key install_lman install_kman
install: install_less install_help install_lman
$(CC) $(LDFLAGS) $(OPTIM) -o less $(OBJ) $(LIBS) $(LDLIBS)
$(CC) $(LDFLAGS) $(OPTIM) -o lesskey lesskey.o $(LDLIBS)
# help.o depends on makefile for the definition of HELPFILE
$(CC) $(CFLAGS) -c -DHELPFILE=\"$(HELPFILE)\" help.c
for f in $(INSTALL_LESS); do rm -f $$f; cp less $$f; done
for f in $(INSTALL_KEY); do rm -f $$f; cp lesskey $$f; done
for f in $(INSTALL_HELP); do rm -f $$f; cp less.help $$f; done
install_lman: $(LESS_MANUAL)
for f in $(INSTALL_LESSMAN); do rm -f $$f; cp $(LESS_MANUAL) $$f; done
install_kman: $(KEY_MANUAL)
for f in $(INSTALL_KEYMAN); do rm -f $$f; cp $(KEY_MANUAL) $$f; done
##########################################################################
##########################################################################
awk -f mkfuncs.awk $(SRC) >funcs.h
rm -f $(OBJ) lesskey.o less lesskey vecho
rm -f *.o less lesskey vecho install_less install_key \
install_help install_lman install_kman
shar -v linstall less.h position.h funcs.h cmd.h \
vecho.c lesskey.c less.nro lesskey.nro lesskey.man > less.shar.a
shar -v $(SRC1) > less.shar.b
shar -v $(SRC2) > less.shar.c
shar -v $(SRC3) less.man README less.help *.awk >less.shar.d
##########################################################################
##########################################################################
$(OBJ): less.h funcs.h defines.h position.h
command.o decode.o: cmd.h
lesskey.o: less.h funcs.h defines.h cmd.h
$ECHO "The makefile has been built."
$ECHO "You should check it to make sure everything is as you want it to be."
$ECHO "When you are satisfied with the makefile, just type \"make\""
$ECHO "and \"less\" will be built."