/*******************************************************************************
*
* McStas, neutron ray-tracing package
*         Copyright 1997-2002, All rights reserved
*         Risoe National Laboratory, Roskilde, Denmark
*         Institut Laue Langevin, Grenoble, France
*
* Documentation: INSTALL
*
* %Identification
* Written by: KN
* Date: 1997
* Origin: Risoe
* Release: all McStas
* Version: $Revision: 1.18 $
*
* This file is part of McStas.
* It details the installation procedure
*
*******************************************************************************/

To install from the SVN repository, use e.g.:

  ./configure --enable-mcstas OR ./configure --enable-mcxtrace
  make
  sudo make install



NOTE: This document is obsolete - please refer to the documents in

  install_docs/tex/install.*
  install_docs/html/install.html

McStas uses autoconf to detect the system configuration and create the
proper Makefiles needed for compilation. On Unix-like systems, you
should be able to compile and install McStas using the following steps:

1. Unpack the sources to somewhere convenient and change to the source
   directory:

  gunzip -c mcstas-<release>.tar.gz | tar xf -
  cd mcstas-<release>/

2. Configure and compile McStas:

  ./configure
  make

3. Install McStas:

  make install

You should now be able to use McStas. For some examples to try, see the
examples/ directory.

The installation of McStas in step 3 by default installs in the
/usr/local/ directory, which on most systems requires superuser (root)
privileges. To install in another directory, use the --prefix= option to
configure in step 2. For example,

  ./configure --prefix=/home/joe

will install the McStas programs in /home/joe/bin/ and the library files
needed by McStas in /home/joe/lib/mcstas/.

In case ./configure makes an incorrect guess, some environment variables
can be set to override the defaults:

 - The CC environment variable may be set to the name of the C compiler
   to use (this must be an ANSI C compiler). This will also be used for
   the automatic compilation of McStas simulations in mcgui and mcrun.
 - CFLAGS may be set to any options needed by the compiler (eg. for
   optimization or ANSI C conformance). Also used by mcgui/mcrun.
 - PERL may be set to the path of the Perl interpreter to use.

To use these options, set the variables before running ./configure. Eg.

    setenv PERL /pub/bin/perl5
    ./configure

It may be necessary to remove configure's cache of old choices first:

    rm -f config.cache

If you experience any problems, or have some questions or ideas
concerning McStas, please contact kristian.nielsen@risoe.dk.


Installing on non-Unix systems
==============================

Windows:

McStas can be installed on Windows machines, including all support applications
(scilab, PGPLOT, VRML viewer, C compiler, perl, perl-Tk). The installer is a standard
executable. Launch it and follow the instructions.

Macintosh:

McStas can be installed on Mac OSX machines, including all support applications
(scilab, PGPLOT, PDL, VRML viewer, C compiler, perl, perl-Tk).
We provide a dmg installer containing information on the installation
procedure.


Troubleshooting
===============

[Also see the FAQ at http://mcstas.org/documentation/faq for
up-to-date help on common problems in McStas.]

You should try to make sure that the directory containing the McStas
binaries (mcstas, gscan, mcdisplay, etc.) is contained in the PATH
environment variable. The default directory is /usr/local/bin, which is
usually, but not always, included in PATH. Alternatively, you can
reference the McStas programs using the full path name, ie.

  /usr/local/bin/mcstas my.instr
  perl /usr/local/bin/mcrun -N10 -n1e5 mysim -f output ARG=42
  perl /usr/local/bin/mcdisplay --multi mysim ARG=42

This may also be necessary for the front-end programs if the install
procedure could not determine the location of the perl interpreter on
your system.

If McStas is installed properly, it should be able to find the files it
needs automatically. If not, you should set the MCSTAS environment
variable to the directory containing the runtime files "mcstas-r.c" and
"mcstas-r.h" and the standard components (*.comp). Use one of

  MCSTAS=/usr/local/lib/mcstas; export MCSTAS     # sh, bash
  setenv MCSTAS /usr/local/lib/mcstas             # csh, tcsh

The PGPLOT library, which is used by the mcdisplay frontend, needs the
PGPLOT_DIR environment variable to be set to the directory containing
PGPLOT, eg.

  PGPLOT_DIR=/usr/lib/pgplot; export PGPLOT_DIR   # sh, bash
  setenv PGPLOT_DIR /usr/lib/pgplot               # csh, tcsh

See the PGPLOT documentation for details.
