#######################################
This is the Installation file of FUDGIT
#######################################

An explanation of the Makefile flags can be found at the end
of this file.

Installation:
    - Read this file! Some OS related comments will be found below.
    - Edit some lines of fudgit.h for the location of the help file,
        default pager, etc...
    - Edit the master Makefile for the location of the help file,
        optimization flags, pop function or macros.


    Optional:
    - Edit the minit.c file to include your built-in macros and aliases.
    - Edit the math.c, init.c files to add more built-in math functions.

    Then type:

    % make OS

    where OS is one of:

        aix datagen hpux irix4 linux next osf ultrix sun3 sun4

    and then type:

    % make install

    In case of compilation problems:
    - If the problem is due to the dynamic loading feature, set
        the DL variable to "DL=NO DLLIB= DLAR=" so that the dl
        features is not compiled. Your operating system might
        not support (some OS features are sometimes not installed
        because all the OS (man pages, dictionary, etc.) simply
        does not fit on the disk) all the options required to have
        dynamic loading.
    - Edit the makefile corresponding to your OS to see if it suits
        your needs. They are located in the src/ directory and are
        named Makefile.OS where OS stands as above. Do not try to
        compile the readline package with the optimizer -O since it
        does not well behave in this case. The rest of the code can be
        optimized however (and it is by default).

    - Do not strip the executable if your OS supports the dynamic
        loader.

    - Send comments or suggestions to <isaac@physics.mcgill.ca>.
        If you improve the code or port it to another platform let me
        know. If you use it on a regular basis and would like to have
        any patch or later release let me know. If you find any bug
        too.

****************** Therefore, step by step:

1- Edit the Makefile to give values for LIBDIR and BINDIR. Also
   read the comments below for achitecture-dependent problems.  You
   should have a look at the only configuration file src/fudgit.h and
   make changes if necessary. For some reasons, FUDGIT must be linked
   by GNU ld(1) link editor in order to be able to use dynamic loading
   features on SUNOS.

   The MACROPOP option tells FUDGIT to use macros for pop()'ing and
   push()'ing on its stack. Use only if you need fast code over well
   written scripts. I don't recommand it for beginners. The speed
   factor obtained depends on the code and varies from 1.3 to 1.9.

   The VI_MODE option includes the code required by vi-style line editing.
   Enable only if some users are going to use it. The vi mode is enabled
   by including
   set editing-mode vi
   in the user's  ~/.inputrc file. The default is emacs style. Read
   the appendices of FUDGIT documentation.

2- Type make with the proper architecture name. 'make' typed with
   no target will list supported architectures.

3- Type 'make install'. This will build the help file and copy
   the executable and help file to the proper directories.
   DO NOT STRIP THE EXECUTABLE if the dynamic loader could
   compile on your OS. (At time of writing, only IRIX, SUNOS
   and ULTRIX supported it).

4- Print a copy of the manual docs/fudgit.ps. The Postscript
   manual is created by the 'make manual' command issued from
   any of the main or the 'docs' directory. European users should
   probably include a4 in the documentstyle before compiling.

5- Send problems, comments, suggestions to:

       <isaac@physics.mcgill.ca>

   At least, send me an e-mail postcard if you use it.

   A note to hackers: Setting ts=4 in vi will make my code more
   legible.

************** Here are some OS related comments:

----- SUN3 and SUN4

To compile on SUNOS 3.5 type:

    % make sun3

and then

    % make install

after having properly set the LIBDIR variable in the master Makefile.

Change sun3 to sun4 to compile on a SUN4. sun3 can only compile
with gcc since the code is full ANSI.

For sun4 only:

In order to be able to use the dynamic loading feature of FUDGIT,
the executable fudgit must be linked by the GNU ld(1) link editor.
Edit the master Makefile to use gcc if you have it before compiling
or after all the objects are built (i.e. make sun4 with cc and the
remove fudgit executable, edit the Makefile to put gcc and make sun4
again). If you don't have gcc, you should do one of the following:

1- install GNU gcc, (better later than never);

2- ask for a compiled version of FUDGIT from a friend having a machine
with the same OS having GNU gcc;

3- not use the `install' command of FUDGIT.

 DO NOT STRIP THE EXECUTABLE if you want to use dynamic loading.

 I've been reported that SPARC 2 could require the DALIGN flag due
 to a different alignment between double and int. Read the
 src/Makefile.sun4 file on how to define this variable.

 If you have problem getting the dynamic loading feature compiled
 just turn it off using the instructions in the master Makefile.

 -------

 SUNOS 3.5 does not seem to fully support readline as is it.
 The bug is that ioctl calls report that the file descriptor
 is not appropriate for this kind of ioctl call. Any clue?
 Macro IOCTL_DEBUG can be defined while compiling readline
 in order to trace the deficiency. 
 
 The port SUN4 has been made blindly since I have no access to a SUN4.
 There was a bug with strod() in SUNOS 3.5. Is it still there in later
 versions (e.g. SUNOS 4.1)? Search for "strod" in file command.c to
 know more.

----- ULTRIX

To compile on ULTRIX type:

    % make ultrix

and then

    % make install

after having properly set the LIBDIR variable in the master Makefile.

 DO NOT STRIP THE EXECUTABLE if you want to use dynamic loading.
 Dynamic loading is only supported on vax machines running
 ULTRIX (no mips, since they have coff object format).

 If you have problem getting the dynamic loading feature compiled
 just turn it off using the instructions in the master Makefile.

----- IRIX4

 The source compiles on IRIX 3.3.1 and higher as it is.
 (FUDGIT was first developped on IRIX so it is fully tested on it).

 We have the -D_BSD_COMPAT in the makefile so
 that the signal() functions be of the proper kind.
 Just type:

    % make irix4

 and then

    % make install

 after having properly set the LIBDIR variable in the master Makefile.
 The program has been developped primarily on IRIX so that the code
 has been heavily tested on it. DO NOT STRIP THE EXECUTABLE.
 The macro SAME_STPROC should be defined in src/Makefile.irix4
 if the version of your operating system IRIX == 4.0.5. (see `uname(1)')

 The executable can be compiled by either cc or gcc.

 If you have problem getting the dynamic loading feature compiled
 just turn it off using the instruction in the master Makefile.


----- HPUX

 To compile on HPUX type:

    % make hpux

 and then

    % make install

 after having properly set the LIBDIR variable in the master Makefile.
 The math library is fairly incomplete on HPUX. An extra file
 hpuxmath.c defines basic math functions as sinh. The precision
 on these functions  is not good, precisely because math function
 log1p is missing. I wonder why the minimal BSD math library is
 not on these machines...

 I've been reported some memory alignment problems on HP750.
 The problem is that simple commands like 

 fudgit> let x=2

 leads to a program crash due to a bus error. To get around this
 problem, define DALIGN in src/Makefile.hpux. This forces the code to
 use bcopy() to transfer doubles on a string of int (pointers) while
 reading and writing. The resulting code is slightly slower, but
 stable.

 Some flavors of HPUX need -lmalloc some don't. If it complains about
 not being able to find malloc library just comment it in or out in
 src/Makefile.hpux.

 The math library uses HUGE instead of Infinity and does not have NaN
 values in conjunction with error flags. Since I have only remote access
 to HPUX, parts or src/math.c:errorcheck() should be rewritten (#ifdef
 HPUX) to account for this peculiar behavior. Anybody interested?

 HPUX does not supports dynamic loading.

 The ansi version of Fudgit has been tested on HPUX 8.07. Some fiddling
 might be required to comply with other (too many) versions.

----- AIX

 To compile on AIX type:

    % make aix

 and then

    % make install

 after having properly set the LIBDIR variable in the master Makefile.

 This package requires termcap. The termcap library needs /etc/termcap.
 On AIX (3.1), it happened that readline could not find a terminal
 entry. This is due to the absence of an entry for your terminal type
 in the file /etc/termcap, or, worse, an absence of the file itself!
 Make sure that /etc/termcap is on your system. From what I could see,
 the file is often in /lib/libtermcap/termcap.src while the library
 searches for /etc/termcap. If this is the case, just make a soft link
 (as root)! i.e.:

 % ln -s /lib/libtermcap/termcap.src /etc/termcap
 
 AIX does not supports dynamic loading.

----- LINUX 

 To compile on LINUX type:

    % make linux

 and then

    % make install

 after having properly set the LIBDIR variable in the master Makefile.
 Linux does not supports dynamic loading. Also, the `show memory' function
 is not available. Comment out the lexical analyser flag in the Makefile.

----- NeXT 

 To compile on NeXT type:

    % make next

 and then

    % make install

 after having properly set the LIBDIR variable in the master Makefile.
 Next does not supports dynamic loading. Also, the `show memory' function
 is not available.

----- GNUPLOT

 A comment about GNUPLOT

 By default, GNUPLOT versions below 3.2 exit on error while called in
 non-interactive mode. In order to use gnuplot without having it
 exiting at each mistyped character, the code 'plot.c' has to be
 modified to change: (near line 260)

    if (!interactive)
        done(IO_ERROR)

 for    
    if (!interactive && argc != 1)
        done(IO_ERROR)

 and recompile. Also, it is sometimes advisable to double the line size from
 1024 to 2048 if you use a lot of replots (and # of tokens accordingly).
 See plot.h in the source code of gnuplot.

 If you have GNUPLOT 3.2 the code takes care of not exiting
 if no input file has been given on the command line.
 So no modification is required for GNUPLOT 3.2 unless
 you do a lot of `replot's ( > 15 files on the same graphs)
 in which case I recommend you to double the line size to 2048,
 along with related quantities (e.g. number of tokens).

########################################################################
Hacker's guide to the flags understood by Fudgit code :

Math functions:
NOGAMMA: Your system has no gamma(3M) function.
NOTRUNC: Your system has no trunc(3M) function.
NORINT: Your system has no rint(3M) function.
NOCBRT: Your system has no cbrt(3M) function.
NOHYP_TRIGO: Your system has no hyperbolic trigonometric functions.
NODRAND48: Your system has no drand48(). Use rand() instead.

Varios:
NOMALLINFO: Your system has no mallinfo(3X) function.
NOSETPGID: Your system only has setpgrp() and not setpgid().

Signals:
VOID_SIGHANDLER: Your system's signal() returns a pointer to a function
    returning a void.
RESTART_SIGHANDLER: Your system (probably a sysV variant) requires
    to restart the signal after a catch.
NOWAITPID: Your system does not support the waitpid() posix command.
WAIT4: Your system supports wait4. Define only if NOWAITPID is defined.

Special:
DALIGN: You system requires double memory alignment.
MACROPOP: No check is made on Fudgit stack for underflow.
    It is quite stable and faster if defined.
USG: Only required in readline. Should be defined on sysV systems. 

Compiler:
NOALERTCHAR: Your compiler does not recognize \a as a bell 07.
const=: Define 'const' identifier as null if your compiler
    does not support it.

Include files:
NOSTDLIB_H: Your system does not have a <stdlib.h>
NOUNISTD_H: Your system does not have a <unistd.h>
NOMALLOC_H: Your system does not have a <malloc.h>

Line editing:
VI_MODE: Define to -DVI_MODE if you want to support vi style line editing.
