[ This document consists of the text of the Appendix A of Using csh & tcsh, by Paul DuBois. Copyright (c) 1995 O'Reilly and Associates, Inc. All rights reserved. Permission is granted to copy this document for personal use only. This copyright notice must be retained in all copies. ]
This appendix describes how to obtain, build, test, and install tcsh. As I write, tcsh is at version 6.06. If a more recent version has been released, simply substitute the new version number for 6.06 in the following commands in which it appears.
The first step in installing tcsh is determining if an up-to-date tcsh is already installed on your system. If so, you do not need to do anything except change your login shell to tcsh. (See "Selecting a Shell" in Chapter 1, Introduction.) Otherwise, you must obtain the current version and then install it.
Find out whether tcsh is installed and what its pathname is by asking your system administrator, or by running this command:
% which tcshIf tcsh is present, determine its version number using the following command. Use single quotes as shown, but substitute the actual pathname if it differs from /bin/tcsh:
% /bin/tcsh -c 'echo $version' tcsh 6.00.02 (Cornell) 08/05/91 options 8b,nls,dl,al,dirIf the output of this command indicates that your tcsh is an old version (as it does in the above example), obtain the current version and install it.
The tcsh source distribution is available on the Internet via anonymous FTP. Connect to ftp.deshaw.com, change into the /pub/tcsh directory, and transfer the file tcsh-6.06.tar.gz in binary mode. After you obtain the distribution, uncompress it and extract the files:
% gunzip < tcsh-6.06.tar.gz | tar xf -Or, on System V systems:
% gunzip < tcsh-6.06.tar.gz | tar xof -If you don't have gunzip, specify the filename without the .gz suffix as tcsh-6.06.tar when you get the distribution. The FTP server will uncompress the file for you. Then run one of these commands:
% tar xf tcsh-6.06.tar (For non-System V systems) % tar xof tcsh-6.06.tar (For System V systems)The tar command should produce a directory tcsh-6.06 in your current directory. Change into that directory with cd tcsh-6.06 and you're ready to begin the build process.
If you want to use a World Wide Web browser to obtain the distribution, use the following URL:
ftp://ftp.deshaw.com/pub/tcsh/tcsh-6.06.tar.gzOr, to obtain the uncompressed version:
ftp://ftp.deshaw.com/pub/tcsh/tcsh-6.06.tarAfter you obtain the file, unpack it using the instructions above.
If you cannot reach ftp.deshaw.com, the distribution is also available from ftp.gw.com in the /pub/unix/tcsh directory, and from ftp.primate.wisc.edu in the /pub/csh-tcsh-book directory.
If imake, xmkmf, and the X11 configuration files are installed on your machine, you should be able to build tcsh like this:
% xmkmf Generate Makefile from Imakefile % make depend Generate dependencies (optional) % make Build tcshIf you're not using imake, create a Makefile from the standard template and use it to build tcsh:
% cp Makefile.std Makefile Copy Makefile from standard template % cp config/file config.h Create config.h from appropriate file in config directory % make Build tcshIf the make command succeeds, you should have an executable tcsh, regardless of the method you use. Proceed to the section "Testing and Installing tcsh." Otherwise, use the detailed instructions in the next section to build tcsh.
If the quick build doesn't work or if you want to review and perhaps modify the configuration parameters, follow the instructions given in this section. Read the entire procedure described below before you proceed.
The files that contain information about building tcsh are as follows:
Here is a summary of the steps involved in building tcsh:
% cp file file.orig Save copy of original file % chmod 644 file Make working copy writable so that you can modify itThat way, you still have the original file for reference as you modify your working copy.
Before you build tcsh, think about where you're going to install it. The default installation directory is /usr/local/bin, but you can override it. For example, I install tcsh in /bin, so that I can use it even when the /usr file system is unmounted.
tcsh is best installed in one of the directories in your system's standard search path, to make accessing it easy for everyone on your system. If you don't have permission to install files into any of those directories, ask your system administrator to install tcsh for you.
If you don't want to use the default directory, you should consider the following as you decide where to install tcsh:
However, you might want to configure the two directories to be different. You might want the stability of being able to reference tcsh using a fixed name such as /bin/tcsh, but you might also want the freedom of placing the actual binary wherever you desire, such as /usr/local/new/tcsh. These goals can be reached by using /bin/tcsh as the compiled-in pathname and installing tcsh in /usr/local/new, and then making /bin/tcsh a symbolic link to /usr/local/new/tcsh. Alternatively, you might want to draw a distinction between the compiled-in pathname and the location in which tcsh is actually installed, if your systems run in an environment that uses NFS or AFS to share file systems over a network.
The Makefile directs the build process by generating the commands needed to compile the intermediate object files and the final tcsh executable.
If you are using imake, the Makefile is generated from Imakefile and imake.config by running xmkmf. Examine imake.config to see if you want to make any changes. If you want to change the pathname that gets compiled into tcsh, define TcshPath. For example, to use /bin/tcsh, add the following line:
#define TcshPath /bin/tcshTo change the directory used by the installation commands, define DestBin as follows:
#define DestBin /binThe manual page is installed by default as /usr/local/man/man1/tcsh.1. If you want to change this location, define DestMan as the installation directory and ManSuffix as the extension used for the file in that directory. For example, to install tcsh.man as /usr/man/mann/tcsh.n, add the following lines to imake.config:
#define DestMan /usr/man/mann #define ManSuffix nAfter you've looked through imake.config and made the appropriate changes, create the Makefile and generate the source file dependencies as shown below:\** If you modify either Imakefile or imake.config later, you'll need to rerun xmkmf and make depend to bring the Makefile and the dependencies up to date again.
% xmkmf Generate Makefile % make depend Generate dependencies (optional)If you are not using imake, the configuration process is different. First, create a Makefile with which to work by copying the template Makefile.std:
% cp Makefile.std Makefile Copy working Makefile from Makefile.std % chmod 644 Makefile Make it writableThen, edit Makefile to choose the appropriate configuration parameters for your system. The Makefile has a lot of information about the settings for different systems, and you can also read Ported to see what special flags might be necessary for your machine. (The systems for a given vendor do not necessarily appear together in Ported; be sure to look completely through it to find the best match for your system.)
The most important configuration parameters are listed below. Make sure you look at the possible settings in the Makefile and select those which are most appropriate for your system:
CC
The C compiler
DFLAGS
-D's and -U's to pass to the C compiler
LDFLAGS
Loader (linker) flags
LIBES
Link libraries
CFLAGS
Special flags to pass to the C compiler
For each parameter, there may be several possible settings described in the Makefile. A leading # character is used to make every setting a comment except one, which is the default setting. To select a different setting, put a # in front of the default and remove the leading # from the setting you want to use.
If you are going to install tcsh in a location other than the default location, you need to make two changes to the Makefile. Suppose you want to install tcsh as /bin/tcsh. First, set the pathname that gets compiled into the tcsh binary. Find the DFLAGS line that you are using and add to it a definition for the _PATH_TCSHELL macro. If the DFLAGS line looks like this:
DFLAGS=then change it to appear as shown below (be sure to type the quotes exactly as shown):
DFLAGS= -D_PATH_TCSHELL='"/bin/tcsh"'(If DFLAGS has a non-empty value, simply add -D_PATH_TCSHELL='"/bin/tcsh"' to the end of the existing value.)
Second, set the directory to be used by the installation commands when you install tcsh. Look for the line that sets the DESTBIN variable:
DESTBIN = $(TCSHTOP)/binChange that line to this:
DESTBIN = /binTo change the point at which the manual page is installed, set DESTMAN to the installation directory and MANSECT to the file extension in that directory. To install tcsh.man as /usr/man/mann/tcsh.n, the settings should look like these:
DESTMAN = /usr/man/mann MANSECT = n
config.h contains some general system-dependent configuration flags used at compile time. config.h is from one of the files in the config directory.
If you use imake, you don't need to create config.h. The Makefile generated from the Imakefile includes a command that creates config.h by selecting the proper file from the config directory.
If you're not using imake, examine the config directory and determine which one of the files is most appropriate for your system. Then, copy the file into the main tcsh distribution directory as config.h. For example, the hpux8 file works for both HP-UX 8.xx and 9.xx. On my HP 715 running HP-UX 9.05, I do the following:
% cp config/hpux8 config.h Create config.h from vendor file % chmod 644 config.h Make config.h writableNormally, you won't need to modify config.h, but you should examine it in case there are minor tweaks that would be helpful. (If you do modify config.h first, make a copy of it for reference, because the original will be removed if you run make clean later.)
config_f.h contains several compilation flags that turn on or off various tcsh capabilities. Examine it to see if you want to change any of the flags. For example, if you do not have locale.h on your system and cannot compile in Native Language System (NLS) support, turn on that feature by changing the following line:
#define NLSto this:
#undef NLSIf you want the tcsh command editor to default to the vi key bindings instead of the emacs bindings, change the following line:
#undef VIDEFAULTto this:
#define VIDEFAULT
After you've edited the build files so that they have the correct configuration parameters, generate tcsh as shown below:
% makeIf the make command does not generate an executable tcsh, take a look at the last half of the README file to see if there are known workarounds for the problems that occur. Also, read the FAQ file and examine Ported to see if you overlooked any flags that are needed for building tcsh on your system.
If you're having imake problems, contact me at dubois@primate.wisc.edu.
If tcsh has not been compiled on the kind of system that you have, you may not be able to find the appropriate configuration information for your machine. In that case, try to make educated guesses based on the parameter values from systems that are closest to yours. You may also want to add a new entry to host.defs, which describes how to set some system-related environment variables.
After you're done, please send your changes to tcsh@mx.gw.com so that they can be incorporated into future releases.
After building tcsh, you should test it as shown below:
% ./tcsh Start the tcsh you just built % ...run some commands... See how it works % exit Terminate itPoint eight of the README file suggests some special commands that you can use to exercise tcsh. You should try doing some everyday work with the newly built shell, to see how it performs under ordinary circumstances.
When you're satisfied that tcsh is stable, install the binary and the manual page using the following commands:
% make install Install the tcsh binary % make install.man Install the manual pageIf you encounter problems, try to determine the circumstances under which they occur. Consult the README and FAQ files, and verify by looking in Ported that you compiled tcsh with all special flags needed on your system.
After you have installed tcsh, you're almost finished. The final step is to make sure that tcsh can be used as a login shell. Typically, you select a login shell using a command like chsh or passwd -s. These commands will likely require that tcsh be registered with the system as a trusted shell. Also, your FTP server may reject connections to accounts that have tcsh as the login shell unless tcsh is registered as a trusted shell.
The most common method of informing the system of which shells are trusted is the /etc/shells file. Determine if a getusershell(3) manual page exists to find out if this is true for you. Typically, the trusted shell list is determined as follows:
/bin/sh /bin/csh /bin/ksh /bin/tcshAfter modifying /etc/shells, try changing your login shell to tcsh to verify that the system accepts it. You should also be able to use ftp to connect to your machine with your regular login name and password, as shown:
% ftp yourhost Name: yourname Password: yourpassword
Some systems use a file other than /etc/shells to identify which shells are considered legal, and the file may have a different format. For example, /etc/shells is replaced under AIX by the shell= line in /etc/security/login.cfg. Consult your local documentation for more specific information.