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 is 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.

--------------------
Permissions
--------------------

On a Cray, you must be root to compile Expect.  (See the FAQ for why
this is.)  On all other systems, you do not have to be root.

--------------------
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.16	(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.  (Note that this one
step must be done in the foreground because configure performs various
tests on your controlling tty.  If you want to do this step in the
background in the future, automate it using Expect!)

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.  Most
people will not need to make any changes.

To build only the stand-alone Expect program, run "make expect".  This
is appropriate if you still haven't decided whether to install Expect,
are still curious about it, and want to do the minimum possible in
order to experiment with it.  

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 the README file in the example directory).

"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.

--------------------
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 are
likely to 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 --verbose flag.

	configure --verbose

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.
CFLAGS		Flags to C compiler
CPPFLAGS	Flags to C preprocessor
LDFLAGS		Flags to linker
LIBS		Libraries

Some 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=c89 CFLAGS=-O2 LIBS=-lposix ./configure

Although configure will do some searching for Tcl (and all of this
discussion holds true for Tk as well), configure likes to find the Tcl
source directory in the parent directory of Expect and will use that
Tcl if it exists.  To make sure Tcl can be found this way (if it is
located somewhere else), create a symbolic link in Expect's parent
directory to where the Tcl directory is.

By default, configure uses the latest Tcl it can find.  You can
override this by creating a symbolic link of "tcl" which points to the
release you want.

If you can't or don't want to create symbolic links, you can instead
indicate where Tcl and Tk are by using the following environment variables:
 
with_tclinclude         Directory containing Tcl include files
with_tcllib             Directory containing Tcl library
with_tkinclude          Directory containing Tk include files
with_tklib              Directory containing Tk library

Normally, configure automatically finds your X includes and libraries.
If it cannot, you can help it using the following configure flags.

--x-includes=DIR        X include files are in DIR
--x-libraries=DIR       X library files are in DIR

--------------------
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-independent
files (e.g., scripts, include files) in a different place than
architecture-dependent 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 (see the README file 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.

--------------------
Uninstalling
--------------------

"make uninstall" removes all the files that "make install" creates
(excluding those in the current directory).

--------------------
Cleaning Up
--------------------

Several "clean" targets are available to reduce space consumption of
the Expect source.  The two most useful are as follows:

"make clean" deletes all files from the current directory that were
created by "make"

"make distclean" is like "make clean", but it also deletes files
created by "configure"

Other targets can be found in the Makefile.  They follow the GNU
Makefile conventions.

