The information in this file is from A. Scottedward Hodel
<A.S.Hodel@Eng.Auburn.EDU>.

* 11/15/2002: Power MachTen is no longer supported by Tenon Intersystems
*   since Mac OS X permits running Octave directly on its BSD-based OS.
*   See http://fink.sourceforge.net for directions on installation of Octave
*   on Macintosh.

I've installed and run Octave 2.0.12 on Power MachTen 4.1.  I've
also installed Octave-2.1.14 on Power MachTen 4.1.1 (the process is slightly 
different).  This note contains instructions on how to port octave to MachTen
4.1/4.1.1.

Many thanks to Tenon Intersystems support for their help in porting to
Machten 4.1.1.

Contents: 
(1) Definitions
(2) Future work
(3) Instructions for installation of Octave 2.0.12 on MachTen 4.1.
(4) Instructions for installation of Octave 2.1.14 on MachTen 4.1.1.

(1) Definitions:
============
Power MachTen: Unix that runs simultaneously with MacOS on Mac computers.
               see http://tenon.com for more information.

Octave:        a Matlab-like programming language that is freely distributable
               under the terms of the gnu copyright rules.  Octave is NOT
               (and will not) be a MATLAB(tm) clone; however, the functionality
               of the program is similar.

               see: http://bevo.che.wisc.edu/octave for more information.
               a control systems toolbox is available at 
               ftp://ftp.eng.auburn.edu/pub/hodel/OCST*

(2) Future work:
=============
Dynamic linking is apparently not yet supported, so .oct files cannot be used 
(yet) in Power MachTen.

(3) To install Octave on MachTen 4.1:
=============
Short instructions:  MachTen automatically defines __MACHTEN_PPC__ on
power MachTen.  The octave configure script sets most everything up properly.
Here's a few details that also need done:

(a) Put libncurses into the Tenon Application Library Folder
(b) Replace the MT /usr/bin/sed with gnu sed (I used 2-0.5).
(c) <sys/signal.h>: Is fixed in MachTen 4.1.1
(d) Set virtual memory to a huge number (I used 200Mb)
(f) make all; it will fail on toplev.cc due to a problem with src/oct-conf.h
(g) Fix src/oct-conf.h and make all again.
(g) make install

Here are the details for the above items:
(a) Be sure that libncurses is in the Tenon Application Library in
    the Extensions folder:

    (i) use resedit.  
    (ii) Open the libncurses file in folder:
          Extensions/Tenon Applications Library/disabled
    (iii) Open the cfrag resource.  Scroll down a bit and you will find the 
        string libcurses.  Change it to libncurses. Save.
    (iv) Change (File Menu/File Information) the file creator to MUMM. Save.
    (v) now move libncurses out of the disabled folder to 
          Extensions/Tenon Applications Library
    (vi) Reboot.  

(b) Replace the MT /usr/bin/sed with gnu sed (I used 2-0.5).  
    This fixes a problem with the kpathsea/klibtool script.

(c) Login as root and apply the following patch to /usr/include/sys/signal.h:
    Otherwise src/sighandlers.cc will not compile properly.  (The change
    is consistent with <sys/signal.h> headers on our sun network as well.)

*** signal.h.old        Thu May  7 13:16:11 1998
--- signal.h    Thu May  7 13:34:27 1998
***************
*** 253,260 ****
  /*
   * Signal vector "template" used in sigaction call.
   */
! #struct       sigaction {
        void    (*sa_handler)();        /* signal handler */
        sigset_t sa_mask;               /* signal mask to apply */
        int     sa_flags;               /* see signal options below */
  };
--- 253,264 ----
  /*
   * Signal vector "template" used in sigaction call.
   */
! struct        sigaction {
! #ifdef __cplusplus
!       void    (*sa_handler)(int);     /* signal handler */
! #else
        void    (*sa_handler)();        /* signal handler */
+ #endif
        sigset_t sa_mask;               /* signal mask to apply */
        int     sa_flags;               /* see signal options below */
  };


(d) Set virtual memory to a huge number (I used 120Mb).  Otherwise compiles
    will fail.

(e) (cd src ; make oct-conf.h)

(f) Fix src/oct-conf.h 

    You'll need to change the line

 #define DEFS "-DOCTAVE_SOURCE=1 -DSEPCHAR=':' -DSEPCHAR_STR=":" 
    to
 #define DEFS "-DOCTAVE_SOURCE=1 -DSEPCHAR=':' -DSEPCHAR_STR=\":\" 

    It should have been done automatically (take a look at UGLY_DEFS in
    the toplevel Makeconf), but for some reason it doesn't go.  Failure to
 edit oct-conf.h results in a compilation error in toplev.cc.

(g) make all
(h) make install

And that should do it.

(4) To install Octave on MachTen 4.1.1:
=============
Short instructions:  MachTen automatically defines __MACHTEN_PPC__ on
power MachTen.  The octave configure script sets most everything up properly.
Here's a few details that also need done:

(a) libncurses, sed, and <sys/signal.h>: are fixed in PowerMachTen 4.1.1 (but not in
 4.1)
(b) Power MachTen uses gcc-2.8.1, which requires more memory than the
    version used in PowerMachTen 4.1.  I set virtual memory to 200 Mb.
(c)  From Tenon technical support: (Thanks!)
    >I think that we have compiling Octave on MachTen.  The problem results
    >from the fact that the stack space on the f771 application is not set. 
    >This results in f771 running out of memory and corrupting the system
    >process manager heap.  To fix this, try:
    >
    >setstackspace 0x100000 /usr/lib/gcc-lib/powerpc-apple/machten4/2.8.1/f771

    For some reason my system didn't follow the soft links to 
    /usr/macppc/lib/gcc-lib/powerpc-apple-machten4/2.8.1/f771.  I was
    able to do the command manually with the above path.

(d) For increased speed in compiling and decreased disk space requirements,
   you may also wish to omit the "-g" flag from compiler options:
   in the configure script: 
    - search for machten (line 2651 in 0ctave-2.1.14).
    - modify so that this section reads
     powerpc-apple-machten*)
        FFLAGS=
        # remove -g to keep binary size down
        CFLAGS=`echo ${CFLAGS} | sed '1,$s/-g//'`
        CXXFLAGS=`echo ${CXXFLAGS} | sed '1,$s/-g//'`
        LDFLAGS=`echo ${LDFLAGS} | sed '1,$s/-g//'`
      ;;

    Also remove -g from: 
      LDFLAGS in readline/examples/Makefile.in

(e) Run configure (use the --prefix flag if desired)

(f) (cd src ; make oct-conf.h)

(g) Fix src/oct-conf.h

    You'll need to change the line

    #define DEFS "-DOCTAVE_SOURCE=1 -DSEPCHAR=':' -DSEPCHAR_STR=":"
    to
    #define DEFS "-DOCTAVE_SOURCE=1 -DSEPCHAR=':' -DSEPCHAR_STR=\":\"

    It should have been done automatically (take a look at UGLY_DEFS in
    the toplevel Makeconf), but for some reason it doesn't go.  Failure to
    edit oct-conf.h results in a compilation error in toplev.cc.

(h) make all

    Be prepared to wait quite awhile.  Most of the time is spent waiting
    for individual ar commands to build the libraries.

(i) make install
