This file is INSTALL.  It contains installation instructions for Expect.

If you do not have Tcl, get it (Expect's README explains how) and
install it.  The rest of these instructions assume that you have Tcl
installed.

If you are installing Expect on a single architecture, or are just
trying it out to see whether it's worth installing, follow the "Simple
Installation" below.  If you are installing Expect on multiple
architectures or the "Simple Installation" instructions are not
sufficient, see "Sophisticated Installations" below.

--------------------
Simple Installation
--------------------

By default, the Tcl source directory is assumed to be in the same
directory as the Expect source directory.  For example, in this
listing, Expect and Tcl are both stored in /usr/local/src.

	/usr/local/src/tcl7.3		(actual version may be different)
	/usr/local/src/expect-5.4	(actual version may be different)

If Tcl is stored elsewhere, create a symbolic link to its real
directory.  For example, from the Expect directory, type:

	ln -s /some/where/else/src/tcl7.3 ..

The same applies for Tk, if you have it.  (Tk is optional.)

Run "./configure".  This will generate a Makefile (from a prototype
called "Makefile.in") appropriate to your system.  

Edit the Makefile and change any definitions as appropriate for your
site.  All the definitions you are likely to want to change are
clearly identified and described at the beginning of the file.

Run "make expect".  This will build a stand-alone Expect program which
you can then experiment with.

To build everything, run "make".  If "configure" found Tk and X on
your system, this will build "expectk" (Expect with Tk) as well as the
library for embedding Expect with Tk (libexptk.a) in your own
programs.

At this point, you can cd to the example directory and try out some of
the examples (see descriptions below).

"make install" will install Expect and optionally Expectk and the
libraries if you have built them.

A handful of people running "pure" 4.2BSD systems have noted that
expect fails to link due to lack of getopt and vprintf.  You can get
these from uunet or any good archive site.

--------------------
Expect scripts included in the "example" directory
--------------------

	kibitz - lets two people control a program at the same time.
		Lots of uses.  I.e., You can help another person remotely.
		Can run an editor and log a transcript of a conversation.
		See man page or SP&E paper.
	xkibitz - similar to kibitz but uses X Window System for handling
		communication.  Also, allows users to be added dynamically.
	dislocate - allow disconnection/reconnection to background processes.
	tknewsbiff - pops up a window (or plays sounds, etc) when news
		arrives in selected newsgroups.
	rogue.exp - finds a good game of rogue.
	chess.exp - has two chess games play each other.
	autopasswd - runs passwd non-interactively (you must be root).
	passmass - sets passwd on many machines simultaneously.
	timed-read - a timed read for the shell
	lpunlock - unhangs a printer which says it is "waiting for lock".
	dvorak - dvorak keyboard
	weather - retrieves weather forecasts.
	timed-run - run a program for only a given amount of time.
	rftp - recursive ftp (assumes UNIX-style ftpd at other end).
	archie - mails back response after talking to archie ftp-catalog.
	gethostbyaddr - translates internet address to name (with a higher
		success rate than nslookup).  Easier to use, too.
	ftp-rfc - retrieve a DoD RFC from uunet via anonymous ftp
	robohunt - plays the game of hunt (from Berkeley)
		It's more of a wild player than good, but amusing to watch.
		Fun to throw against people who don't know about it.
	rlogin-cwd - rlogin giving you same current working directory

To run, for example, chess.exp, type:

	expect chess.exp

If expect is installed and your system supports the #! magic you can
invoke it as just:

	chess.exp

Each of these examples necessarily depends upon other binaries in the
system.  For example, chess.exp depends upon the "usual" UNIX chess
program being present.  If any of these programs are different,
it may cause the associated script to misbehave.

Please use the ".exp" extension on scripts that might otherwise have
names that could be confused with the real program, such as "rogue.exp".
Scripts that have unique names do not need the extension, such as "rftp".

--------------------
Sample Expectk scripts included in the example directory
--------------------

	xpstat - provide an X window front end to the xpilot game.
	tkpasswd - run passwd from Tk (for root only)

--------------------
Sample C and C++ programs that use libexpect.a included in the example
directory
--------------------

	chesslib.c - same thing as chess.exp, but in C.
	chesslib2.c - ditto, but uses popen and stream-style I/O.
	chesslib++.c - ditto, but for C++.

You may change the value of CC or CPLUSPLUS in the Makefile, to
compile under gcc or other compilers.  However, you may have to edit
the lines defining where the libraries are.

--------------------
Sophisticated Installations
--------------------

The following instructions provide some suggestions for handling
complex installations.

--------------------
Changing Defaults
--------------------

Some of the defaults in "configure" can be overridden by environment
variables.  This is a convenience intended for environments that
likely affect any program that you configure and install.

As it runs, configure describes what it is checking.  If you would
like to see what configure decides, use the -v flag.

	configure --v

The following environment variables are supported.  If you use these,
consider adding them to your .login file so that other installation
scripts can make use of them.

CC		C compiler program.
		Default is `cc', or `gcc' if `gcc' is in your PATH.
X11HDIR		Directory containing X11 .h files.
X11LIBS		Directory containing X11 libraries.

These settings can also be given on the command line.  For example,
you could tell configure about a particular C compiler from a
Bourne-compatible shell as follows:

	CC='gcc -traditional' DEFS=-D_POSIX_SOURCE

Configure assumes that the Tcl source directory can be found in the
parent directory of Expect.  Create a symbolic link in Expect's parent
directory to where the Tcl directory is.  By default, configure uses
the latest release of Tcl that it can find.  You can override this by
creating a symbolic link of "tcl" which points to the release you
want.  This all holds true for Tk as well.

--------------------
Multiple-Architecture Installation
--------------------

You might want to compile a software package in a different directory
from the one that contains the source code.  Doing this allows you to
compile the package for several architectures simultaneously from the
same copy of the source code and keep multiple sets of object files on
disk.

To compile the package in a different directory from the one
containing the source code, you must use a version of make that
supports the VPATH variable.  GNU make and most other recent make
programs can do this.

cd to the directory where you want the object files and executables to
go and run configure.  configure automatically checks for the source
code in the directory that configure is in and in ..  If configure
reports that it cannot find the source code, run configure with the
option --srcdir=dir, where dir is the directory that contains the
source code.

You can save some disk space by installing architecture-dependent
files (e.g., scripts, include files) in a different place than
architecture-independent files (e.g., binaries, libraries).  To do
this, edit the Makefile after configure builds it, or have configure
create the Makefile with the right definitions in the first place.  To
have configure do it, use the following options to configure:

	--prefix=indep
	--exec-prefix=dep

where dep is the root of the tree in which to store
architecture-dependent files and indep is the root in which to
store -dependent files.  For example, you might invoke configure this
way:

	configure --prefix=/usr/local/bin --exec-prefix=/usr/local/bin/arch

--------------------
Test Suite
--------------------

Patterned after the Tcl test suite, I have begun building a test suite
in the subdirectory "test".  It is still incomplete however you may
use by typing "make test" in this directory.  You should then see a
printout of the test files processed.  If any errors occur, you'll see
a much more substantial printout for each error.  See the README file
in the "tests" directory for more information on the test suite.

Note that the test suite assumes the existence of certain programs to
use as interactive programs.  If you are missing these or they behave
differently, errors may be reported.  Similarly, the test suite
assumes certain other things about your system, such as the sane stty
parameters.

You may also try some of the programs distribute in the example
directory.  They are a strong indication of whether Expect works or
not.  If you have any problems with them, let me know.
