@c Copyright (C) 1992 John W. Eaton
@c This is part of the Octave manual.
@c For copying conditions, see the file gpl.texi.

@c The text of this file will eventually appear in the file INSTALL
@c in the Octave distribution, as well as in the Octave manual.

@ifclear INSTALLONLY
@node Installation, Trouble, Command Line Editing, Top
@chapter Installing Octave
@end ifclear
@cindex installing Octave

Here is the procedure for installing Octave from scratch on a Unix
system.  For instructions on how to install the binary distributions of
Octave, see @ref{Binary Distributions}.

@itemize @bullet
@item
Run the shell script @samp{configure}.  This will determine the features
your system has (or doesn't have) and create a file named Makefile from
each of the files named Makefile.in.

See the file INSTALL for more information about the command line options
used by configure.  That file also contains instructions for compiling
in a directory other than where the source is located.

@item
Run make.

You will need the latest version of GNU make.  Modifying Octave's
Makefiles to work with other @samp{make} programs is probably not worth
your time.  We recommend you get and compile GNU make instead.

For plotting, you will need to have gnuplot installed on your system.
Gnuplot is a command-driven interactive function plotting program.
Gnuplot is copyrighted, but freely distributable.  The `gnu' in gnuplot
is a coincidence---it is not related to the GNU project or the FSF in
any but the most peripheral sense.

You will probably also need the GNU C and C++ compiler (gcc) and the GNU
C++ class library (libg++).

GNU make, gcc, and libg++, and gnuplot are all available from many
anonymous ftp archives, including ftp.che.utexas.edu, ftp.uu.net,
prep.ai.mit.edu, and wuarchive.wustl.edu.

If you don't have a Fortran compiler, or if your Fortran compiler
doesn't work like the traditional Unix f77, you will need to have the
Fortran to C translator f2c.  You can get f2c from any number of
anonymous ftp archives.  The most recent version of f2c is always
available from research.att.com.

On an otherwise idle SPARCstation II, it will take somewhere between 60
and 90 minutes to compile everything, depending on whether you are
compiling the Fortran libraries with f2c or using the Fortran compiler
directly.  You will need about 25 megabytes of disk storage to work with
(considerably less if you don't compile with debugging symbols).  To do
that, use the command

@example
make CFLAGS=-O CXXFLAGS=-O LDFLAGS=
@end example

@noindent
instead of just @samp{make}.

@item
If all goes well, run @samp{make install}.

This will install a copy of octave, its libraries, and its documentation
in the destination directory.  As distributed, the octave binary is
installed in the directory @file{/usr/local/bin}, other related files are
installed in the directory @file{/usr/local/lib/octave}, and the Info
file in the directory @file{/usr/local/lib/info}. You can specify a
top-level directory other than @file{/usr/local} by running configure
with the @samp{--prefix=dir} option.  See the file INSTALL for more
information.

@item
Octave has been compiled and tested with gcc-2.4.2 and libg++-2.3.1 on a
SPARCstation 2 running SunOS 4.1.2, an IBM RS/6000 running AIX 3.2, and
a DECstation 5000/240 running Ultrix 4.2a.  It is probably not very hard
to port it to other Unix-like systems that run GCC.
@end itemize

@menu
* Binary Distributions::        
@end menu

@node Binary Distributions,  ,  , Installation
@section Binary Distributions

This section constains instructions for creating a and installing a
binary distribution.

@menu
* Installing Octave from a Binary Distribution::  
* Creating a Binary Distribution::  
@end menu

@node Installing Octave from a Binary Distribution, Creating a Binary Distribution,  , Binary Distributions
@subsection Installing Octave from a Binary Distribution

@itemize @bullet
@item
To install Octave from a binary distribution, execute the command

@example
sh ./doinstall.sh
@end example

@noindent
in the top level directory of the distribution.

Binary distributions are normally compiled assuming that Octave will
be installed in subdirectories of @file{/usr/local}.  If this is not
possible, or you would prefer to install it in a different directory,
use an optional argument to the doinstall.sh script to specify the top
level directory:

@example
sh ./doinstall.sh /some/other/directory
@end example

@noindent
Octave will then be installed in the following directories:

@example
@var{prefix}/bin                   -- Octave shell script and binary
@var{prefix}/octave/lib/@var{version}     -- M-files
@var{prefix}/info                  -- Info files
@end example

@noindent
where @var{prefix} defaults to @file{/usr/local}, and @var{version}
stands for the current version number of the interpreter.

If these directories don't exist, the script @file{doinstall.sh} will
create them for you.
@end itemize

@node Creating a Binary Distribution,  , Installing Octave from a Binary Distribution, Binary Distributions
@subsection Creating a Binary Distribution

Here is how to build a binary distribution for others.

@itemize @bullet
@item
Build Octave in same directory as source.  This is required since the
@samp{binary-dist} targets in the Makefiles will not work if you compile
outside the source tree.

@item
Use @samp{CFLAGS=-O CXXFLAGS=-O LDFLAGS=} as arguments for Make because
most people who get the binary distributions are probably not going to
be interested in debugging Octave.

@item
Type @samp{make binary-dist}.  This will build everything and then pack
it up for distribution.
@end itemize
