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. If you want shared libs on Linux, you must be root in order to run ldconfig. See the ldconfig man page for more info. -------------------- 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/tcl8.0 (actual version may be different) /usr/local/src/expect-5.24 (actual version may be different) If Tcl is stored elsewhere, the easiest way to deal with this is to create a symbolic link to its real directory. For example, from the Expect directory, type: ln -s /some/where/else/src/tcl8.0 .. 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. (This 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!) Most people will not need to make any changes to the generated Makefile and can go on to the next step. If you want though, you can 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. To build only the stand-alone Expect program, run "make expect". This is appropriate even 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). Once expect is built, you can cd to the example directory and try out some of the examples (see the README file in the example directory). Note that if Tcl has not yet been installed, this won't work. In this case, see the instructions "Trying Expect Without Installing Tcl" below. "make install" will install Expect. If you built Expectk, that will be installed as well. So will the documentation and some of the most useful examples. If you want shared libs on Linux, you must now su to root and run ldconfig on the shared library. See the ldconfig man page for more info. 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. -------------------- Trying Expect Without Installing Tcl -------------------- Once expect is built, you can try it out. If Tcl has not been installed (but it has been compiled), you will need to define the environment variable TCL_LIBRARY. It should name the directory contain the Tcl libraries. For example, if you are using csh with Tcl 8.0.3: $ setenv TCL_LIBRARY ../tcl8.0.3/library Now you can run expect. The same advice applies to Tk. If it is available but has not been installed, you can try out expectk but only after defining TK_LIBRARY. For example, if you are using csh with Tk 8.0.3: $ setenv TK_LIBRARY ../tk8.0.3/library Now you can run expectk. -------------------- Sophisticated Installations -------------------- The following instructions provide some suggestions for handling complex installations. -------------------- Changing Defaults -------------------- The configure script allows you to customize the Expect configuration for your site; for details on how you can do this, type "./configure -help" or refer to the autoconf documentation (not included here). Expect's configure supports the following flags in addition to the standard ones: --verbose Cause configure to describe what it is checking and what it decides. --enable-shared Compile Expect as a shared library if it can figure out how to do that on this platform. (You must have already compiled Tcl with this flag.) --disable-load This switch is ignored so that you can configure Expect with the same configure command as Tcl. If you want to disable dynamic loading, configure Tcl with this flag and then reconfigure Expect. --enable-gcc This switch is ignored so that you can configure Expect with the same configure command as Tcl. If you want to enable gcc, configure Tcl with it and then reconfigure Expect. Expect will inherit the definition that way. It is not safe to modify the Makefile to use gcc by hand. If you do this, then information related to dynamic linking will be incorrect. --enable-threads This switch is ignored so that you can configure Expect with the same configure command as Tcl. --with-tcl=... Specifies the directory containing Tcl's configure file (tclConfig.sh). --with-tclinclude=... Specifies the directory containing Tcl's private include files (such as tclInt.h) --with-tk=... Specifies the directory containing Tk's configure file (tkConfig.sh). --with-tkinclude=... Specifies the directory containing Tk's private include files (such as tkInt.h) 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. 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 CFLAGS Flags to C compiler CPPFLAGS Flags to C preprocessor LDFLAGS Flags to linker LIBS Libraries CONFIG_SHELL Shell for configure and Make Settings can also be given on the command line. For example, you could tell configure about flags from a Bourne-compatible shell as follows: 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_tcl Directory containing Tcl configure file (tclConfig.h) with_tclinclude Directory containing Tcl include files with_tkinclude Directory containing Tk include files with_tk Directory containing Tk binary library (tkConfig.h) -------------------- 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.