@c -*-texinfo-*-
@node HOWTO Setting the CRYSTAL environment variable, , HOWTO Create RPM, Making Own Projects
@subsection Setting the CRYSTAL environment variable

This section describes how to set the @samp{CRYSTAL} environment variable under
a variety of operating systems.

@subsubheading Windows 95/98/ME

First, locate the file @file{autoexec.bat}.  This can be found on your system
drive i.e. the @file{C:\} drive most commonly.  Open the file with Notepad.
Insert the following, making sure to change the string to correspond to the
location of the @file{CS} directory on your computer.

@example
SET CRYSTAL=C:\projects\CS
@end example

After adding the above simply click @emph{File} and @emph{Save}.  Close Notepad
and reboot your computer.

@subsubheading Windows NT4/2000/XP

The instructions for NT based Windows system may vary slightly but is
essentially the same for adding a new environment variable to a system.

First, open the @emph{Control Panel}.  Now locate the @emph{System} utility and
click on the icon.  You will now be presented with a dialog box.  Click on the
@emph{Advanced} tab, then on the button @emph{Environment Variables}.

The @emph{Environment Variables} dialog box should now be visible.  You should
notice that there are two sections for adding environment variables, @emph{User}
and @emph{System}.  We classify @samp{CRYSTAL} as a system variable but adding
it as a user variable will work just as well.

To create the @samp{CRYSTAL} environment variable first click on the @emph{New}
button.  You will be presented with a dialog for inserting the necessary
information.  In the text box @emph{Variable name} insert @samp{CRYSTAL} and in
the @emph{Variable value} text box type the path to your @samp{CS} dir (i.e.
@samp{C:\projects\CS}).

Now hit the @emph{Ok} buttons until you are back at the @emph{Control Panel}.

If you have any command lines sessions open you will need to close and restart
them for the variable to take effect.  Rebooting should not be necessary.

@subsubheading Unix (@sc{gnu}/Linux, @sc{bsd}, Darwin, etc.)

There are several ways of setting environment variables in Unix.  There are two
common types of Unix shells, the Bourne shell (and its variants, such as Bash),
and the C-shell (and its variants, such as Tcsh).  Setting environment
variables in Bourne shells is done in two steps.  First set the variable, and
then export it so that it is available to programs run by the shell.  For
example, if Crystal Space is installed in @file{/usr/local/CS} the correct
commands would be:

@example
CRYSTAL="/usr/local/CS"
export CRYSTAL
@end example

Some Bourne shells (such as Bash) allow the two steps to be combined, so that
the following single command may also work:

@example
export CRYSTAL="/usr/local/CS"
@end example

For C-shell, you instead use the @samp{setenv} command.  For example:

@example
setenv CRYSTAL "/usr/local/CS"
@end example

If you do not want to type these commands each time you start up a shell, you
should insert them into one of the shell startup files that are automatically
invoked when the shell launches.  For Bourne shell, you can place the commands
in a file named @file{.profile} in your home directory.  Bash users can insert
them into the file @file{.bash_profile}, or alternately @file{/etc/profile} if
you want to set the @samp{CRYSTAL} environment variable for all users.  C-shell
users can insert the @samp{setenv} command into the @file{.cshrc} file in their
home directory (or, the file @file{.tcshrc} for Tcsh users).

If you are modifying a global startup file, such as @file{/etc/profile}, be
sure to read the comments in the since some configuration tools of
@sc{gnu}/Linux distributions override the settings.  In this case the
distributions often created other files that are called automatically and are
not touched by the configuration tools.

@subsubheading MacOS/X

Rather than setting an environment variable, MacOS/X users should set up the
@samp{CrystalSpaceRoot} default in order to allow Crystal Space applications to
be launched from the Finder.  As with the @samp{CRYSTAL} environment variable,
the @samp{CrystalSpaceRoot} default should point at the root of the Crystal
Space directory hierarchy, such as @samp{/usr/local/CS}.  See the build
instructions for MacOS/X for a more detailed description.
@xref{MacOS/X Running Programs}.
