                              The FOX GUI Library Installation
                              ================================



Systems Which are Supported or Known to work:
=============================================

  o Linux (gcc, INTEL C++), x86, IA64 (Itanium), x86-64 (Opteron).
  o Windows XP, 2K, NT, Windows 9x, (VC++, Cygwin, MinGW,
    Borland C++, Digital Mars C++, OpenWatcom C++, ... )
  o Digital Unix/COMPAQ Tru64  OSF1 3.2, 4.0x, 5.0x (gcc and DEC cxx).
  o SGI IRIX 5.3, 6.1, 6.2, 6.4, 6.5 (gcc and MIPS Pro C++)
  o SUN Solaris, SunOS (gcc, SUN WorkShop Compiler, SUN Forte C++)
  o HP-UX PA-RISC 9.x, 10.x and B.11.00, (gcc and aCC).
  o HP-UX B.11.22 Intel Itanium (IA64) using aCC.
  o AIX 4.2, 4.3
  o FreeBSD
  o Sequent DYNIX/ptx 4.4.7
  o IBM VisualAge C++ 3.5 (Windows)
  o Apple MAC OS-X.  You will need an X-Server, either Apple's or XFree.



Building Documentation.
=======================

You will need the "doxygen" documentation extraction tool.  You can get it
from:

        http://www.stack.nl/~dimitri/doxygen/index.html

Many current linux distributions already include this tool as an optional
package.

To generate documentation, unpack the FOX tarball and go to directory "doc."
Then issue the command:

        make docs

If doxygen is installed properly, it will churn for a while and then generate
hyperlinked documentation from the header files' document comments.  You will
find this reference documentation in the "doc/ref" directory.




For most UNIX systems.
======================

For most unix systems you can configure simply as:


        ./configure


You can disable OpenGL support by configuring as:


        ./configure --with-opengl=no


After configure runs its course, simply type ``make'' to build the library,
and ``make install'' to install it.

FOX should compile on most UNIX platforms; we have tested the following:
SGI, IBM, HP, SUN, DEC, LINUX, all with gcc; however, FOX uses a fairly
conservative subset of C++, and should be no problem to port to other, more
primitive, C++ compilers.

On some machines, the X11 header files are still K&R C, instead of ANSI-C.
You might try define add "-fpermissive" to the CXXFLAGS environment variable
prior to running configure (this is the flag for GCC; other compilers may
have similar option for old K&R C).

When programming against FOX, you should only have to include "fx.h", and
for 3D programs, "fx3d.h".  To use keyboard symbols, include "fxkeys.h" also.
Specifically, to remain portable application programs should NOT include any X
window header files.

You may of course need other system headers ("stdio.h", "gl.h", etc).



Enabling XFT Support.
=====================

On Linux systems, you can turn off XFT anti-aliased font support.


        ./configure --with-xft=no


For portability reasons, the default of this settings is off.



XCursor Support.
================

FOX supports Xcursor support where available.  This is normally turned on,
allowing full alpha-blended cursor support. However, you can disable if
desired:


        ./configure --with-xcursor=no

This will cause to revert to vanilla black/white cursor support only; note
that your color cursors will still work: they will be thresholded to black
and white depending on brightness.



Building for Debug or Release.
==============================

Normal builds [w/o any special arguments to configure] will include assert and
trace statements into the library, but no debug symbols.  This mode compiles
the fastest and allows for tracing of the FOX library.  This mode is the
recommended way to develop FOX applications, as it allows for resource tracing
and internal consistency checks.

Building for debug will add debug symbols as needed by your debugger.  It also
includes assert and tracing into the library.  This setting is recommended if
you need to debug the FOX library itself.  Full debug executables are build by
configuring with:


        ./configure --enable-debug



Release builds strip all debug information, asserts, and tracing, and generates
optimized code.  The resulting library is the smallest/fastest, and this is the
recommended setting for production code.  To build for release, use:


        ./configure --enable-release




Building Shared or Non-Shared Libraries.
========================================

You can build FOX either as shared library, static library, or both.  The
default is both.  To build static library only [this may be necessary on
certain systems where shared library support is lacking]:

        ./configure --disable-shared

to build shared library only:

        ./configure  --disable-static



Thread-safe support.
====================

It is highly recommended to build FOX with thread-safe API's wherever
possible; this is accomplished using:


        ./configure --enable-threadsafe

Enabling thread-safe will cause FOX to use the thread-safe equivalent
API's for some common C library functions like getpwuid(), readdir()
and so on.




Image File Format Support.
==========================

FOX needs external libraries for JPEG, TIFF, and PNG image format. On
some systems, such as Linux, *BSD, these are likely already installed
on your system.  On Windows or older UNIX systems, they need to be
compiled and installed first.  See below on how to override default
locations on UNIX systems.

The JPEG support is provided by jpegsrc.v6b.tar.gz, the PNG support
by libpng-1.2.5.tar.gz (or a newer version).  The TIFF support is
in tiff-v3.5.7.tar.gz (or later).  All these files are available on
ftp.fox-toolkit.org.

After these libraries have been compiled and installed, compile FOX
with HAVE_TIFF_H=1, HAVE_PNG_H=1, HAVE_JPEG_H=1.

The TIFF library may also need the JPEG library (JPEG is one of the
tags supported in the TIFF format), so compile the JPEG library first.
TIFF also needs the GNU compression library zlib (available as
zlib-1.1.4.tar.gz (or later) on ftp.fox-toolkit.org).


Compression Library Support.
============================

Compressed FXStream support is enabled by installing zlib-1.1.4.tar.gz
and bzip2-1.0.2.tar.gz (or later), then compiling FOX with HAVE_ZLIB_H=1
and HAVE_BZ2LIB_H=1, respectively.  You do not need to install them on
Linux, *BSD, but you probably do on Windows and older UNIX systems.




Overriding Libraries.
=====================

The default libraries determined by configurations are not always the ones you
want to use; therefore, there is a mechanism to override the default choices
of the configuration system.

The override is done simply by setting environment variables prior to running
configure; make sure config.cache is removed if you've ran configure before.

Configure allows for the following overrides:


        Environment Variable    Default value if not set
        ====================    ========================

        LIBJPEG                 -ljpeg
        LIBPNG                  -lpng
        LIBTIFF                 -ltiff
        LIBZ                    -lz
        LIBBZ2                  -lbz2
        LIBGL                   -lopengl32      (win32)
        LIBGLU                  -lglu32         (win32)
        LIBGL                   -lGL            (unix)
        LIBGLU                  -lGLU           (unix)



On SGI IRIX 6.x
===============


On SGI Systems where MIPS Pro C++ compiler is used instead of GCC, you will
need to set the environment variable CXX to:

        CC -n32

and then run:

        ./configure --x-libraries=/usr/lib32


or, you can also build FOX for the 64 bit model, and set CXX to:


        CC -64


and run configure with:

        ./configure --x-libraries=/usr/lib64


The first argument is only needed if you also have MESA on your system.
FOX searches for the png library [for Portable Network Graphics, the successor
of GIF],  but the library it finds, even though it has the same name, is not
the right one.  You will need to disable this feature, or download the PNG
library from http://www.graphicswiz.com/png/ and compile it, and pass the
appropriate flags for your compiler to find the new version.
If compiling without PNG, pass the flag:  --disable-png; likewise, you
can disable JPEG with the flag: --disable-jpeg.


SGI Altix
=========

Using Intel C++ compiler on IA64-based Altix system, drop optimization level
to -O1:

        setenv CXX "icpc -O1"
        setenv CC "icc -O1"


Full optimization with icc compiler appears to generate incorrect code.


Using gcc 2.95.2 on IRIX 6.x (Thanks to Theo Venker)
====================================================

You won`t believe the solution: rename FXApp.cpp to FXApp.C and everything
is fine. The manual page of g++ says that it accepts C++ suffixes .C, .cc,
.cxx, .cpp, and .c++, and it does, but for .cpp and .c++ it compiles with
-D__LANGUAGE_C -D_LANGUAGE_C -DLANGUAGE_C whereas the others suffixes
use -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS. This is clearly a
bug in g++. I decided to wait for the next g++ release, so I didn`t
report this to the g++ maintainers. May be you will.

The work-arround is:

        export CC="g++ -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS"

and then run configure.




Building 64-bit code on Linux for x86-64 (AMD Opteron, Athlon64)
================================================================

Linux for AMD Opteron supports execution of both 32 and 64 bit code
on the same system; consequenly, two sets of libraries are installed.
To configure properly, you will need to let ld search the right set
of directories.  Here's how:


        export LDFLAGS="-L/usr/lib64 -L/usr/X11R6/lib64 -L/lib64"
        ./configure <other options>


No other issues are known at this time.




On Alpha Processor based Workstations (COMPAQ/DEC OSF1)
=======================================================


If you use DEC's "cxx" instead of GNU gcc, you will need to make sure the
you add the flag option -D_XOPEN_SOURCE_EXTENDED to the compiler; this
will allow usage of a wider set of POSIX functions; GCC seems to have
this flag on by default, but the standard C++ compiler on OSF1 does not;
thanks to thomas.goessler@avl.com for pointing this out.

When compiling with gcc on Digital Unix, you may want to enable gradual
underflow support for IEEE754 conformant floating point operations:


        export CXX="gcc -mieee"
        ./configure ....


If this flag is NOT set, floating point operations which yield underflows
will cause a floating point exception (SIGFPE).

Many perfectly correct programs may generate underflows when working
with small numbers (~1e-38 single precision, ~1e-308 double precision);
working with these numbers may involve so-called denormalized floating
point numbers, i.e. numbers where the mantissa can no longer be shifted
to be within [0.5,1.0> range due to the exponent becoming 0.

The ALPHA CPU does not include hardware do manipulate these numbers and
will generate a trap when trying to manipulate these numbers; passing
the "-mieee" flag will incorporate a software handler to ensure IEEE754
conformant floating arithmetic.




Compiling FOX on the SUN
============================================

To use the SUN WorkShop Compiler compilers, simply configure
FOX as follows:

  > cd fox
  > env CC=cc CXX=CC LD=CC ./configure



Explanation:

The SUN compilers require 'CC' to be used instead of 'ld' for creating the
shared object library. This is to ensure that template instances will be
included in the library. To build a static library 'CC -xar' should be
used instead of 'ar' but there is no simple way to do this, due to
limitations in 'libtool'.

To get around this problem, the configure script invokes 'CC' with the
argument '-instances=global', thus including template instances in the
object file instead of using a template repository. This works fine and
'ar' can be used to build a static object library.
Thanks to: Daniel Gehriger <gehriger@epfl.ch>



Compiling FOX using the HP/UX C++ Compiler
==========================================

You may want to use GNU make instead of HP's make (/usr/bin/make). The default
version of make doesn't seem to process the dependencies for PathFinder
correctly and thus doesn't generate the reswrapped icon header files. Since
PathFinder is built after the library and all the test programs, this isn't
a huge problem -- it just means that the build will stop at that point with
an error message.

Configure the build by typing:

    env CC="cc +DA2.0W" CXX="aCC +DA2.0W +W740,749,863" ./configure

The "+DA2.0W" flag tells it to compile as 64 bit. The "+W740,749,863" option
suppresses a few warning messages that we believe are safe to ignore ;)



Compiling FOX using the HP/UX Itanium^2 aCC C++ Compiler
========================================================

Assuming the aCC is installed in the recommended place:


    export CXX="aCC -fast -mt +DD64 -DHAVE_VSSCANF=1 -DHPOGL_SUPPRESS_FAST_API=1
                   -I/opt/aCC/include -I/opt/graphics/OpenGL/include -L/lib/hpux64
                   -L/usr/lib/hpux64 -L/opt/graphics/OpenGL/lib/hpux64"


You may want to build the image support libraries also if you need them.



Windows 95/98/ME/NT/XP Builds
=============================

We currently build FOX on a regular basis using Microsoft Visual C++ 6.0.
There is also support for Mingw32, the latest net release of Cygwin (v1.1)
and Borland C++. We have heard of mixed success with building under Symantec's
C++ 7.5 compiler.

A few things to keep in mind:

 1. If you want to include OpenGL support be sure to define the HAVE_OPENGL
    symbol on the compiler's command line, and to link your executables to
    the opengl32.lib and glu32.lib libraries.

 2. The native Windows version of FOX relies on an undocumented API called
    _TrackMouseEvent() which is found in comctl32.dll. You should be sure
    to link your FOX applications with the comctl32.lib import library.
    Note that for this function is only available for comctl32.dll
    versions 4.70 or later; the latest version of this DLL can be downloaded
    from Microsoft's web site:

	http://www.microsoft.com/msdownload/ieplatform/ie/comctrlx86.asp

    If you are running Windows 98, Windows NT 4.0 SP3, or have installed
    Internet Explorer 4.0 or later, you *probably* already have the latest
    version of this DLL already.

 3. The FOX registry mechanism uses the regular Windows registry under the
    hood; those functions are found in advapi32.lib which is not always a
    standard library. If you get some unresolved symbols at link time (esp.
    with names beginning with "Reg") try adding advapi32.lib to the list
    of libraries.

 4. To build or use FOX as a DLL, the symbol FOXDLL must be defined; for
    building the core FOX library, FOXDLL_EXPORTS must also be defined.
    If FOXDLL_EXPORTS must NOT be not defined when you are just using FOX
    as a DLL.

 5. It is recommended that extension DLL's are compiled with FOXDLL but
    that you define your own symbol to signify export; for example, the
    CHART library is build with CHARTDLL_EXPORTS; since the CHART library
    USES FOX, it must import the core FOX library, yet export its own
    functions.



Building with Microsoft Visual C++
==================================

We now have a project workspace and project files set up for Win32 builds
under Visual C++ 6.0. To use these, perform the following steps:

  1. Download the latest fox.tar.gz from the web site;

  2. Unzip & untar in your favorite place;

  3. Start Visual C++ and open the fox/windows/vcpp/win32.dsw workspace;

  4. Choose a project and build it. The project corresponding to the library
     itself is named "fox", and all of the other projects list it as a
     dependency. So if you choose, say, "glviewer" to build, it should first
     build the library and then build the glviewer test program.


Building with Borland C++ Compilers
===================================

The Borland makefiles are now tested semi-regularly against the free
command-line compiler tools (compiler version 5.5) distributed by
Borland/Inprise. We believe that they should also be usable for any recent
Borland C++ compilers (e.g. Borland C++ Builder 3 or later).

To build the FOX library, utility programs and example programs, change to the
fox-0.99.xxx\windows\borland subdirectory and type "make". It should compile
without a hitch, with the possible exception of building the OpenGL test
programs in the "tests" subdirectory:

 + If you're using the free command-line compiler tools, you want to be sure
   that the %BCCDIR%\Lib\PSDK directory appears in the linker configuration
   file (%BCCDIR%\Bin\ilink32.cfg). If it isn't there, the linker won't know
   where to find the opengl32.lib and glu32.lib import libraries.

 + If you're using an older Borland compiler, you similarly want to be sure
   to have the updated OpenGL SDK for Win32 (including the OpenGL 1.2 header
   files and import libraries).

If for some reason you don't have the correct header files and import libraries
for OpenGL, and if OpenGL support isn't important for your project anyways,
just modify the "Makefile.bc" in the fox-0.99.xxx\tests subdirectory so that
it doesn't try to build the "glviewer.exe" or "gltest.exe" examples.


Building FOX as a DLL
=====================

The FOX library can also be built as a DLL for Windows; this is done by
selecting the "foxdll" project and building it. Building this project
causes the import libraries and DLLs to be placed in fox/lib.
The filenames are foxdll.lib and foxdll.dll for the Release build, or
foxdlld.lib and foxdlld.dll for the Debug build.

To compile your own FOX applications so that they use the FOX DLL instead of
the static FOX library, be sure to define the FOXDLL symbol in your compiler
flags. Also note that the DLL must be in your search path for the program to
run!


Building FOX using OpenWatcom C++
=================================

The OpenWatcom C++ compiler can be downloaded free of charge from:


         http://www.openwatcom.org.


To use the OpenWatcom "patch" with a fresh copy of FOX vx.y.zz, please make
sure you've installed OpenWatcom C++ v1.0 and executed the SETVARS.BAT file
found in the OpenWatcom installation directory.
The Makefile.wc files rely on a Watcom environment variable, %WATCOM%, to
determine the location of the COMCTL32.LIB file.  Use the Makefile provided
in windows/watcom/Makefile.
Thanks to mikael@lyngvig.org for this port.



Building FOX using MinGW
========================

Please see the standard FOX documentation file, "Developing Win32 GUI
Applications Using FOX", available in this distribution as the file
"doc/win32.html".



Building FOX using Cygwin 1.1
=============================

FOX can also be built against the latest net release of Cygwin, available
for download from here:

	http://sourceware.cygnus.com/cygwin/mirrors

It absolutely will not compile with previous releases of Cygwin (i.e.
Cygwin B20.1 or earlier), at least not without a lot of headaches. The
win32api header files distributed with earlier versions of Cygwin were not
up-to-date enough for FOX.

It should compile out-of-the-box by typing:

	./configure --disable-shared
	make



Building FOX on QNX
===================


For those interested in using FOX with QNX, before running configure for
FOX on QNX it might be a good idea to run:

        automake --add-missing
        libtoolize -f

Doing so will ensure that the configuration files needed to detect QNX
are present.  

Also, for now it is probably best to disable shared libraries when
building FOX on QNX.  Programs linked with the FOX shared library will
not run, but instead will segfault.  I plan on looking into a fix for
this eventually.  

Dustin Graves <dgraves@computer.org>



Building on MAC OS-X
====================


When building on Mac OS-X, the following might help:


        CXX="c++ -I/sw/include -L/sw/lib
        ./configure <otheroptions>


This might help; no guarantees, I can not test this myself....
For more information, see:

        http://freeride.rubyforge.org/wiki/wiki.pl?MacOSXInstall




Image Formats in File Browser
=============================

By default, all available image formats are supported in the File and
Directory Browsers.  Some of these image formats require external
library support and consequently the size of your application executables
may be reduced by limiting the supported formats to those supported in
the core library; the image formats supported in the core library do
not require external libraries and therefore supporting them does not
incur any additional "code bloat".

To support only the core image formats, pass the compiler flag:


        -DCORE_IMAGE_FORMATS=1


Another flag is the default icon search path, i.e. where the file browser will
normally look to find and load icons bound to file extensions.
The path below will cause the system to look in three different directories:


    -DDEFAULICONPATH="~/.foxicons:/usr/local/share/icons:/usr/share/icons"


This would be a common setting for LINUX.  Note that this is only the default;
the actual search path can by set at any time by means of the FOX registry setting:


    [SETTINGS]
    iconpath="/home/extraicondir:/usr/share/icons"

