Compiling and installing LyX
============================

Original document by Pascal Andre (andre@via.ecp.fr). 
Updated by David L. Johnson (dlj0@lehigh.edu) and Jean-Marc Lasgouttes
(Jean-Marc.Lasgouttes@inria.fr).

There are three ways to compile and install LyX on your system. You
can either use the configure script, customize your own Imakefile from
the given Imakefile.std, or (if imake is broken for your system)
customize the given Makefile.std.

The first is the only method that is really supported. Use the other
ones at your own risk.

Note that you need the latest version 0.81 of the XForms library.  You
can get it from

    http://bragg.phys.uwm.edu/xforms
    ftp://laue.phys.uwm.edu/pub/xforms/
    ftp://ftp.cs.ruu.nl/pub/XFORMS
    ftp://ftp.via.ecp.fr/pub/xforms/

NOTE: The older version 0.75 of xforms (and the test versions 0.80*)
are *not* supported anymore.

Also note that the current (as of 07/05/96) Xforms library is
incompatible with some libXpm versions older than 4.7.

If you compile LyX with gcc, you should not need to have libg++
installed on most system. See however the note in the section
`Problems'.

Creating the Makefile
---------------------

LyX can be configured using GNU autoconf utility which attempts to
guess your configuration.  The standard way to use it is described in
the file INSTALL.autoconf. In most cases you will be able to create
the Makefile by typing

  ./configure

For more complicated cases, LyX configure takes the following specific
flags:

  o --with-two-colors=(yes/no) that forces LyX to use two colors pixmaps
    (bitmaps) instead of the full-colored standard ones. Defaults to no.

  o --with-debug that specifies whether you want to have debug information
    by default on standard error. Default is no. 

  o --without-latex-config that disables the automatic detection of your
    latex installation at install time. This detection is automatically 
    disabled if latex cannot be found.

  o --with-extra-lib=DIRECTORY that specifies the path where LyX will find
    extra libraries (Xpm, xforms) it needs. Defaults to NONE (i.e. search 
    in standard places). You can specify several directories, separated
    by spaces, by quoting the argument. 

  o --with-extra-inc=DIRECTORY that gives the place where LyX will find
    xforms headers. Defaults to NONE (i.e. search in standard places).
    You can specify several directories, separated by spaces, by quoting 
    the argument.

Moreover, it honors the following generic ones:

  o --prefix=DIRECTORY that specifies the root directory to use for
    installation. [defaults to where lyx has already been installed or
    /usr/local]

  o --libdir=DIRECTORY that gives the directory where all extra LyX 
    files (lyxrc, documentation, templates and layouts definitions) will be 
    installed. [defaults to ${prefix}/lib/lyx]

  o --bindir=DIRECTORY that gives the directory where the lyx binary
    will be installed. [defaults to ${prefix}/bin]

  o --mandir=DIRECTORY that gives the directory where the man pages will go.
    [defaults to ${prefix}/man]


If you do not like the default compile flags used (-g -O on gcc), you can 
set CXXFLAGS variable to a better value as follows:

  o CXXFLAGS='-O2' (sh, bash)
  o setenv CXXFLAGS '-O2' (csh, tcsh)

If you encounter other problems, please read the section 'Problems' at
the end of this file. IMPORTANT: if you change something to your
configuration because configure did not find something, remember to do
`make clean' before recompiling.

In particular, the following options could be useful in some
desesperate cases:

  o --with-sun-headers that provides prototypes to replace functions
    not correctly defined in SunOS4 header files. Its only effect is
    to suppress a few warnings. Since it is autodetected by default,
    you should not need to use this switch.
 
  o --with-broken-const attempts to fix a bug in gcc 2.7.x (see the
    section 'Problems').

  o --without-liberty suppresses the detection of the -liberty library
    (see the section 'Problems').

Compiling and installing LyX
----------------------------

Once you've got the Makefile created, you just have to type:

  make all
  make install

All should be OK ;)


If configure fails for some strange reason
------------------------------------------

Just use the Imakefile.std. Copy it to Imakefile, modify it to your
own wishes, check the contents of config.h and type:

  xmkmf -a
  make 
  make install
  make install.man

If imake fails for some strange reason
--------------------------------------

Just use the Makefile.std. Copy it to Makefile, modify it to your own
wishes, check the contents of config.h and type:

  make 
  make install

Stripping LyX
-------------

A LyX binary for linux is about 470k when compiled without
debug-informations and with dynamic libraries. If yours is much bigger
you probably compiled it with debug-informations (-g). If you don't
want to debug LyX just enter

          strip lyx

before installing.


BTW: in the images subdirectory there is also a small icon "lyx.xpm", that 
can be used to display lyx-documents in filemanagers.

Problems
--------

  o If you have problems indicating that configure cannot find a part of
    the xforms or Xpm library, use the --with-extra-lib and --with-extra-inc 
    options of configure.  This may not completely satisfy configure, in that
    it expects the xpm.h header file under X11.  If yours cannot be placed
    there, change the line
    	#include <X11/xpm.h>
    in math_symbols.C to point to the correct place.

  o According to John Collins <collins@phys.psu.edu>, you may find on SunOS
    4.1.3 two sets of X libraries, and they are of course incompatible :-)
    One is the set provided as part of OpenWindows, and one is the standard
    X distribution (e.g., X11R5).  If you encounter problems (or if, for
    some obscure reasons configure cannot find your X libraries) you can
    use the following options:

     o --x-libraries=DIRECTORY that indicates where the X libraries reside.

     o --x-includes=DIRECTORY that indicate where the X include files reside.

    The standard X11R5 libraries should work when the OpenWindows ones
    don't.

  o Some systems (in particular SunOS 4.x) lack functions that LyX
    needs (i.e. strerror()). To fix this, configure tries to link
    against the -liberty library, if it is available. If you
    experience problems with missing symbols at link time, you could
    try to install libiberty.a, which comes with several GNU packages
    (in particular libg++). In any case, please report your problems
    to lyx@via.ecp.fr. 

    The option --without-liberty disable the detection of -liberty. It
    is meant for debugging purpose only.

  o There is a bug in gcc 2.7.x in the handling of const which can
    cause various unpredictable problems. If you experience weird
    crashes with a LyX compiled by gcc 2.7.[012], try to configure
    with the --with-broken-const flag and recompile. If this improves
    things, please report it to the mailing list.

    This bug is currently not autodetected, but any code to do so
    would be welcome.


