### Compiling Source Distribution

If you have not taken a precompiled version, you will require:

- GNU make - this should be named `gmake` to make sure that FSL uses this rather than any other "make" in your path.
- GNU install (part of the GNU core utils project) - this should be named `ginstall` to make sure that FSL uses this rather than any other "install" in your path.
- GCC C/C++ compiler (versions from gcc-3.4 to gcc-4.1 seem to work fine in general).

In addition, the following are required (Note: sometimes these binaries can be taken from one of the other FSL binary distributions if the operating system and machines are similar - e.g. certain varieties of linux on PC machines):

- Tcl and Tk version 8.4.14 - configure both with configure --prefix=$FSLDIR before making and installing.

Note that if you are building these yourself, you will want to delete the words `tcl` and `tk` from the build script in the `extras` directory of the FSL sources. Otherwise the build may overwrite your newly created binaries for these packages.

Then do the following check (this if for the bash shell; if you are using tcsh amend appropriately):

1. Set the main FSL environment variable:

       export FSLDIR=<??wherever fsl is unpacked??>

   e.g. export FSLDIR=/usr/local/fsl
2. Then source the FSL environment setup script:

       . ${FSLDIR}/etc/fslconf/fsl.sh

3. Then check if your machine/compiler is supported by default:

       ls $FSLDIR/config/$FSLMACHTYPE

If the above directory does not exist (the `ls` returns an error):

- Select the closest match from the directories in `$FSLDIR/config` and do the following:

      cp -r $FSLDIR/config/closestmatch $FSLDIR/config/$FSLMACHTYPE

- Depending on how different your machine and compiler are from the closest match, you may need to edit the files inside the `$FSLDIR/config/$FSLMACHTYPE` directory which set the local paths and variables for things like install commands, compiler flags, etc.

Once this test is done then the sources can be built simply by doing:

    cd $FSLDIR
    ./build

If you want to re-make a particular package in `$FSLDIR/src` (e.g. flirt) then first set the `FSLDEVDIR` environment variable to the same as FSLDIR and then just type

    make install

inside the relevant directory.

### Using the compiled binaries

Before use you will need to configure your environment to allow the FSL binaries to be located by the system. Do this as per the instructions in the Linux installation guide.

### Compiling FSLView

For instructions on compiling FSLView, see here.