changeset 5:9c27e323492f

[project @ 1993-08-08 01:29:13 by jwe] Initial revision
author jwe
date Sun, 08 Aug 1993 01:32:33 +0000
parents b4df021f796c
children 73cca179ce1f
files Makeconf.in config.guess configure.in doinstall.sh f2c-compat.sh flibs.sh mkpath.c octMakefile.in octave-mode.el octave.sh
diffstat 10 files changed, 1645 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
new file mode 100644
--- /dev/null
+++ b/Makeconf.in
@@ -0,0 +1,114 @@
+#
+# Common configuration rules for all of octave's Makefiles.
+#
+# John W. Eaton
+# jwe@che.utexas.edu
+# Department of Chemical Engineering
+# The University of Texas at Austin
+
+SHELL = /bin/sh
+
+#### Start of system configuration section. ####
+
+LEX = @LEX@
+LFLAGS = @LFLAGS@
+LEXLIB = @LEXLIB@
+
+YACC = @YACC@
+YFLAGS = -dv
+
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+
+RANLIB = @RANLIB@
+
+RUNTEST = @RUNTEST@
+
+DEFAULT_PAGER = @DEFAULT_PAGER@
+
+# Fortran to C translator and associated flags.
+
+F2C = @F2C@
+F2CFLAGS = @F2CFLAGS@
+
+# Fortran compiler flags.
+
+FFLAGS = @FFLAGS@
+
+# cc and associated flags.
+
+INCFLAGS = -I. -I$(srcdir)
+LIBFLAGS = -L$(TOPDIR)
+DEFS = @DEFS@
+
+CC = @CC@
+CFLAGS = @CFLAGS@
+ALL_CFLAGS = $(INCFLAGS) $(DEFS) $(CFLAGS)
+
+ifeq ($(CXX), )
+  CXX = $(C++)
+endif
+
+CXXFLAGS = @CXXFLAGS@   # GNU Make 3.63 and beyond
+C++FLAGS = $(CXXFLAGS)  # backward compatibility
+ALL_CXXFLAGS = $(INCFLAGS) $(DEFS) $(CXXFLAGS)
+
+LDFLAGS = @LDFLAGS@
+ALL_LDFLAGS = $(LIBFLAGS) $(LDFLAGS)
+
+FLIBS = @FLIBS@
+
+# A shell command to extract the version number from version.h.
+getversion = sed -e '/version_string/!d' -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q 
+
+# The version number.  TOPDIR is something like `.' or `..' or `../..'
+# and gets us back up to the top level of the source tree.
+version = `$(getversion) $(srcdir)/$(TOPDIR)/src/version.h`
+
+# Common prefix for installation directories.
+# NOTE: This directory must exist when you start installation.
+prefix = /usr/local
+
+# Directory in which to put host dependent programs and libraries
+exec_prefix = $(prefix)
+
+# Where to install the executables.
+bindir = $(exec_prefix)/bin
+
+# Where to put libraries like libcruft.a, liboctave.a, and libreadline.a
+libdir = $(exec_prefix)/lib
+
+# Where octave will look for M-files
+libsubdir = $(libdir)/octave/$(version)
+
+# Where to put the manual pages.
+mandir = $(prefix)/man/man1
+# Extension (not including `.') for the installed manual page filenames.
+manext = 1
+
+# Where to put the info files.
+infodir = $(prefix)/info
+
+# Where to put extra data files, system-wide startup files, etc.
+datadir = $(prefix)/lib/octave
+
+# Where to put installed include files.
+includedir = $(prefix)/include
+
+# The type of computer we are running on.
+target_host_type = @target_host_type@
+
+# The following pattern rules and the substitution functions require
+# GNU make.  If you don't have it, get it!
+
+@DEFAULT_DOT_C_FROM_DOT_F@
+
+@DEFAULT_DOT_O_FROM_DOT_F@
+
+# How to make .o files from .c files:
+
+.c.o:
+	$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
+
+.cc.o:
+	$(CXX) -c $(CPPFLAGS) $(ALL_CXXFLAGS) $<
new file mode 100755
--- /dev/null
+++ b/config.guess
@@ -0,0 +1,204 @@
+#!/bin/sh
+# This script attempts to guess a canonical system name.
+#   Copyright (C) 1992, 1993 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it prints an error message on stderr, and
+# exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit system type (host/target name).
+#
+# Only a few systems have been added to this list; please add others
+# (but try to keep the structure clean).
+#
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    alpha:OSF1:1.*:*)
+	echo alpha-dec-osf${UNAME_RELEASE}
+        exit 0 ;;
+    sun4*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    sun4*:SunOS:6*:*)
+	# According to config.sub, this is the proper way to canonicalize
+	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+	# it's likely to be more like Solaris than SunOS4.
+	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    sun4*:SunOS:*:*)
+	echo sparc-sun-sunos${UNAME_RELEASE}
+	exit 0 ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit 0 ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit 0 ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit 0 ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit 0 ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit 0 ;;
+    *:IRIX:*:*)
+	echo mips-sgi-irix${UNAME_RELEASE}
+	exit 0 ;;
+    i[34]86:AIX:*:*)
+	echo i386-ibm-aix
+	exit 0 ;;
+    *:AIX:2:3)
+	echo rs6000-ibm-aix3.2
+	exit 0 ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit 0 ;;
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit 0 ;;
+    9000/31?:HP-UX:*:*)
+	echo m68000-hp-hpux
+	exit 0 ;;
+    9000/3??:HP-UX:*:*)
+	echo m68k-hp-hpux
+	exit 0 ;;
+    9000/7??:HP-UX:*:* | 9000/8?7:HP-UX:*:* )
+	echo hppa1.1-hp-hpux
+	exit 0 ;;
+    9000/8??:HP-UX:*:*)
+	echo hppa1.0-hp-hpux
+	exit 0 ;;
+    9000/8??:4.3bsd:*:* | 9000/8?7:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit 0 ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit 0 ;;
+    C1*:ConvexOS:*:*)
+	echo c1-convex-bsd
+        exit 0 ;;
+    C2*:ConvexOS:*:*)
+	echo c2-convex-bsd
+        exit 0 ;;
+    CRAY*X-MP:UNICOS:*:*)
+	echo xmp-cray-unicos
+        exit 0 ;;
+    CRAY*Y-MP:UNICOS:*:*)
+	echo ymp-cray-unicos
+        exit 0 ;;
+    CRAY-2:UNICOS:*:*)
+	echo cray2-cray-unicos
+        exit 0 ;;
+    i[34]86:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux
+	exit 0 ;;
+    i[34]86:UNIX_SV:4.*:*)
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
+	else
+		echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}
+	fi
+	exit 0 ;;
+    i[34]86:*:3.2:*)
+	if /bin/uname -X 2>/dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+		echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-unknown-sysv3.2
+	fi
+	exit 0 ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit 0 ;;
+     M680[234]0:*:R3V[567]*:*)
+	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+esac
+
+echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+cat >dummy.c <<EOF
+main()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+#else
+  printf("m68k-sony-newsos\n"); exit(0);
+#endif
+#endif
+
+#if defined(hp300) && !defined(hpux)
+  printf("m68k-hp-bsd\n"); exit(0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf("ns32k-encore-sysv\n"); exit(0);
+#else
+#if defined (CMU)
+  printf("ns32k-encore-mach\n"); exit(0);
+#else
+  printf("ns32k-encore-bsd\n"); exit(0);
+#endif
+#endif
+#endif
+
+#if defined(__386BSD__) || (defined(__bsdi__) && defined(__i386__))
+  printf("i386-unknown-bsd\n"); exit(0);
+#endif
+
+#if defined(sequent)
+#if defined(i386)
+  printf("i386-sequent-dynix\n"); exit(0);
+#endif
+#if defined (ns32000)
+  printf("ns32k-sequent-dynix\n"); exit(0);
+#endif
+#endif
+
+#if defined(_SEQUENT_)
+  printf("i386-sequent-ptx\n"); exit(0);
+#endif
+
+#if defined(NeXT)
+  printf("m68k-next-bsd\n"); exit(0);
+#endif
+
+  exit (1);
+}
+EOF
+
+${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+rm -f dummy.c dummy
+
+echo '(Unable to guess system type)' 1>&2
+
+exit 1
new file mode 100644
--- /dev/null
+++ b/configure.in
@@ -0,0 +1,412 @@
+dnl Process this file with autoconf to produce a configure script.
+dnl
+AC_INIT([[src]]/octave.cc)dnl
+
+# See if we were given the target host type.  If not, guess.
+
+if test $# -gt 0; then
+  TARGET=`eval echo $\{\`echo $#\`\}`
+  case $TARGET in
+    -*) target_host_type= ;;
+    *) target_host_type=$TARGET ;;
+  esac
+fi
+
+if test -z "$target_host_type" -o "$target_host_type" = unknown; then
+  target_host_type=`sh $srcdir/config.guess`
+  if test -z "$target_host_type"; then
+    echo "warning: unable to guess system type"
+    target_host_type=unknown
+  fi
+fi
+
+case "$target_host_type" in
+  unknown)
+    echo "configuring Octave for an unknown system type"
+  ;;
+  *)
+    echo "configuring Octave for a $target_host_type"
+  ;;
+esac
+AC_SUBST(target_host_type)dnl
+
+# Set up to handle --with-FOO options.
+
+AC_WITH(f2c, use_f2c=true, use_f2c=false)dnl
+AC_WITH(dld, use_dld=true, use_dld=false)dnl
+
+DYNAMIC_LD_OBJ=
+DLD_DIR=
+LIBDLD=
+DLD_OBJECTS='$(DLD_OBJECTS)'
+LD_STATIC_FLAG=
+if $use_dld; then
+  DYNAMIC_LD_OBJ='dynamic-ld.o'
+  DLD_DIR=dld
+  LIBDLD='../libdld.a'
+  DLD_OBJECTS= : # don't link them in if doing dynamic linking
+  DEFS="$DEFS -DWITH_DLD=1"
+  LD_STATIC_FLAG=-static
+fi
+AC_SUBST(DYNAMIC_LD_OBJ)dnl
+AC_SUBST(DLD_DIR)dnl
+AC_SUBST(LIBDLD)dnl
+AC_SUBST(DLD_OBJECTS)dnl
+AC_SUBST(LD_STATIC_FLAG)dnl
+
+echo "checking for npsol"
+if test -f $srcdir/libcruft/npsol/npsol.f; then
+  :
+else
+  DEFS="$DEFS -DNPSOL_MISSING=1"
+fi
+
+echo "checking for qpsol"
+if test -f $srcdir/libcruft/qpsol/qpsol.f; then
+  :
+else
+  DEFS="$DEFS -DQPSOL_MISSING=1"
+fi
+
+echo "checking for fsqp"
+if test -f $srcdir/libcruft/fsqp/fsqpd.f; then
+  :
+else
+  DEFS="$DEFS -DFSQP_MISSING=1"
+fi
+
+AC_PROG_CC
+AC_GCC_TRADITIONAL
+AC_AIX
+
+# Do special things for gcc.
+
+case "$CC" in
+  gcc*)
+    CFLAGS="-g -O -Wall"
+    LDFLAGS="-g -O"
+    gcc_version=`gcc -v 2>&1 | grep "^gcc version" | sed 's/^gcc version *//'`
+    case "$gcc_version" in
+      1.*)
+        cat << EOF
+warning: gcc version $gcc_version is likely to cause problems --
+         you should probably consider getting version 2.x
+EOF
+        ;;
+    esac
+    ;;
+  *)
+    CFLAGS="-g"
+    LDFLAGS="-g"
+    ;;
+esac
+AC_SUBST(CFLAGS)dnl
+AC_SUBST(LDFLAGS)dnl
+
+AC_PROGRAM_CHECK(GXX, g++, g++, [])dnl
+if test "$GXX" = g++ ; then
+  CXXFLAGS="-g -O -Wall"
+  gxx_version=`g++ -v 2>&1 | grep "^g.. version" | sed 's/^g.. version *//'`
+  case "$gxx_version" in
+    1.*)
+      cat << EOF
+warning: g++ version $gxx_version is likely to cause problems --
+         you should probably consider getting version 2.x
+EOF
+      ;;
+    esac
+else
+  cat << EOF
+warning: Octave has only been tested with g++, and I can't
+         seem to find it.
+EOF
+fi
+AC_SUBST(CXXFLAGS)dnl
+
+# If we haven't been forced to use f2c, try to find a Fortran compiler
+# under any one of several common Un*x Fortran compiler names. 
+# Put fc last to avoid confusion with some vendor's /bin/sh fc
+# builtin.
+#
+#    g77 : GNU Fortran (someday...)
+#    xlf : IBM / AIX
+#   cf77 : Cray / Unicos
+#     fc : Convex
+#
+# I don't think the Cray compiler will ever work like f2c...
+
+if $use_f2c; then
+  true
+else
+  F77=
+  AC_PROGRAMS_CHECK(F77, g77 xlf cf77 f77 fc)dnl
+
+  # If it looks like we have a Fortran compiler, try to determine
+  # whether it might be compatible with f2c.
+
+  if test -n "$F77"; then
+    echo "checking $F77/f2c compatibility"
+    export F77
+    export CC
+    tmpdef=`sh $srcdir/f2c-compat.sh $srcdir/flibs.sh`
+    status=$?
+    if test $status -eq 0; then
+      if test "$tmpdef" = '-DF77_APPEND_UNDERSCORE=1'; then
+        DEFS="$DEFS $tmpdef"
+      fi
+    else
+      F77=
+    fi
+  fi
+fi
+
+# If we can't find a Fortran compiler, or if it looks like it isn't
+# compatible with f2c, try to find f2c.
+
+if test -z "$F77"; then
+  AC_PROGRAM_CHECK(F2C, f2c, f2c, [])dnl
+fi
+
+F2CFLAGS=
+FFLAGS="-O"
+if test -n "$F77"; then
+  export F77
+  FLIBS=`sh $srcdir/flibs.sh`
+  DOT_O_DOT_F_C1=
+  DOT_O_DOT_F_C2=
+  DOT_O_DOT_F_C3=
+  DOT_O_DOT_F_C4=
+  DEFAULT_DOT_C_FROM_DOT_F=
+  DEFAULT_DOT_O_FROM_DOT_F=
+elif test -n "$F2C" || $use_f2c; then
+  AC_HAVE_LIBRARY(f2c, FLIBS=-lf2c, [])dnl
+  if test -z "$FLIBS" ; then
+    AC_HAVE_LIBRARY(F77, FLIBS=-lF77, [])dnl
+    if test -n "$FLIBS" ; then
+      AC_HAVE_LIBRARY(I77, FLIBS="$FLIBS -lI77", [])dnl
+    fi
+  fi
+  if test -z "$FLIBS" ; then
+    cat << EOF
+warning: I found f2c but I couldn't find libf2c.a, or
+         libF77.a and libI77.a
+EOF
+  fi
+DEFAULT_DOT_C_FROM_DOT_F='# A rule for making C source from Fortran source.\
+# If we are using f2c we should also turn off the default rule for\
+# making objects from .f files so that we do not invoke the fortran\
+# compiler by mistake.\
+\
+\%.c : \%.f\
+	cat $< | $(F2C) $(F2CFLAGS) > $(@F)'
+  DEFAULT_DOT_O_FROM_DOT_F='\%.o : \%.f'
+  DEFS="$DEFS -DF77_APPEND_UNDERSCORE=1"
+else
+  cat << EOF
+warning: in order to build octave, you must have a compatible
+         Fortran compiler or f2c installed and in your path.
+         See the file INSTALL for more information.
+         Continuing anyway...
+EOF
+fi
+
+AC_SUBST(FFLAGS)dnl
+AC_SUBST(FLIBS)dnl
+AC_SUBST(F2C)dnl
+AC_SUBST(F2CFLAGS)dnl
+AC_SUBST(DEFAULT_DOT_C_FROM_DOT_F)dnl
+AC_SUBST(DEFAULT_DOT_O_FROM_DOT_F)dnl
+
+AC_PROG_INSTALL
+AC_PROG_RANLIB
+AC_STDC_HEADERS
+AC_UNISTD_H
+AC_DIR_HEADER
+
+# For now, don't define LEXLIB to be -lfl -- we don't use anything in
+# it, and it might not be installed.
+#
+# Also make sure that we generate an interactive scanner if we are
+# using flex.
+
+AC_PROG_LEX
+case "$LEX" in
+  flex*)
+    LFLAGS="-t -I"
+    LEXLIB=
+  ;;
+  *)
+    LFLAGS="-t"
+    cat << EOF
+warning: I didn't find flex, but that's only a problem
+         if you need to reconstruct lex.cc
+EOF
+  ;;
+esac
+AC_SUBST(LFLAGS)dnl
+
+AC_PROG_YACC
+case "$YACC" in
+  bison*)
+  ;;
+  *)
+    cat << EOF
+warning: I didn't find bison, but that's only a problem
+         if you need to reconstruct parse.cc
+EOF
+  ;;
+esac
+
+# Define VOID_SIGHANDLER for readline.
+
+AC_RETSIGTYPE
+case "$RETSIGTYPE" in
+  int)
+  ;;
+  *)
+    VOID_SIGHANDLER="-DVOID_SIGHANDLER=1"
+  ;;
+esac
+AC_SUBST(VOID_SIGHANDLER)dnl
+
+AC_HAVE_HEADERS(termio.h)dnl
+case "$DEFS" in
+  *HAVE_TERMIO_H*)
+  ;;
+  *)
+    AC_HAVE_HEADERS(sgtty.h)dnl
+    case "$DEFS" in
+      *HAVE_SGTTY_H*)
+      ;;
+      *)
+        echo "I couldn't find either termio.h or sgtty.h!"
+        exit 1
+        ;;
+    esac
+    ;;
+esac
+
+# Hack for readline's sysdep.h
+
+case "$target_host_type" in
+  *next*)
+    echo "using BSD version of readline/sysdep.h on the NeXT"
+    rm -f readline/sysdep.h
+    cp readline/sysdep-obsd.h readline/sysdep.h
+  ;;
+esac
+
+# Check to see if we have IEEE math functions, and if so, which ones.
+#
+# Also check for some additional trig functions that aren't ANSI but
+# are often available.  If they are missing, we try to replace them
+# with functions from the BSD/NET2 math library.
+
+XLIBS="$LIBS"
+LIBS="$XLIBS -lm"
+AC_HAVE_FUNCS(finite isnan isinf)dnl
+AC_REPLACE_FUNCS(acosh asinh atanh)dnl
+LIBS="$XLIBS"
+
+if test -n "$LIBOBJS"; then
+  for func in $LIBOBJS
+  do
+    case "$func" in
+      *acosh.o*)
+	DEFS="$DEFS -DACOSH_MISSING=1"
+	;;
+      *asinh.o*)
+	DEFS="$DEFS -DASINH_MISSING=1"
+	;;
+      *atanh.o*)
+	DEFS="$DEFS -DATANH_MISSING=1"
+	;;
+    esac
+  done
+
+  case $LIBOBJS in
+    *acosh.o* | *asinh.o*)
+      AC_REPLACE_FUNCS(copysign)dnl
+      ;;
+  esac
+
+  case $LIBOBJS in
+    *acosh.o* | *asinh.o* | *atanh.o*)
+      AC_REPLACE_FUNCS(log1p)dnl
+      ;;
+  esac
+
+  case $LIBOBJS in
+    *log1p*)
+      AC_REPLACE_FUNCS(log__L)dnl
+      ;;
+  esac
+
+  case $LIBOBJS in
+    *log1p*)
+      AC_REPLACE_FUNCS(finite)dnl
+      ;;
+  esac
+
+  case $LIBOBJS in
+    *copysign* | *finite* | *log1p*)
+      AC_REPLACE_FUNCS(logb scalb)dnl
+      ;;
+  esac
+fi
+
+AC_PROGRAM_CHECK(GNUPLOT_BINARY, gnuplot, gnuplot, [])dnl
+if test -z "$GNUPLOT_BINARY"; then
+  cat << EOF
+warning: I didn't find gnuplot.  It isn't necessary to have gnuplot
+         installed, but you won't be able to use any of Octave's
+         plotting commands without it.
+
+         If gnuplot is installed but it isn't in your path, you can
+         tell Octave where to find it by typing the command
+
+           gnuplot_binary = '/full/path/to/gnuplot/binary'
+
+         at the Octave prompt.
+EOF
+fi
+
+AC_PROGRAM_CHECK(DEFAULT_PAGER, less, less, [])dnl
+if test -z "$DEFAULT_PAGER"; then
+  AC_PROGRAM_CHECK(DEFAULT_PAGER, more, more, [])dnl
+fi
+if test -z "$DEFAULT_PAGER"; then
+  AC_PROGRAM_CHECK(DEFAULT_PAGER, page, page, [])dnl
+fi
+if test -z "$DEFAULT_PAGER"; then
+  AC_PROGRAM_CHECK(DEFAULT_PAGER, pg, pg, [])dnl
+fi
+if test -z "$DEFAULT_PAGER"; then
+  echo "warning: I couldn't find less(1), more(1), page(1), or pg(1)"
+fi
+AC_SUBST(DEFAULT_PAGER)dnl
+
+AC_PROGRAM_CHECK(RUNTEST, runtest, runtest, [])dnl
+AC_PROGRAM_CHECK(EXPECT, expect, expect, [])dnl
+if test -z "$EXPECT" ; then
+  RUNTEST=
+fi
+AC_SUBST(RUNTEST)dnl
+
+define([tmpa], [libcruft/blas/Makefile libcruft/dassl/Makefile])dnl
+define([tmpb], [libcruft/fftpack/Makefile])dnl
+define([tmpc], [libcruft/fsqp/Makefile libcruft/lapack/Makefile])dnl
+define([tmpd], [libcruft/linpack/Makefile libcruft/minpack/Makefile])dnl
+define([tmpe], [libcruft/misc/Makefile libcruft/npsol/Makefile])dnl
+define([tmpf], [libcruft/odepack/Makefile libcruft/qpsol/Makefile])dnl
+define([tmpg], [libcruft/quadpack/Makefile libcruft/ranlib/Makefile])dnl
+define([tmph], [libcruft/villad/Makefile])dnl 
+define([cruftdirs], [tmpa tmpb tmpc tmpd tmpe tmpf tmpg tmph])dnl
+define([tmpA], [Makefile Makeconf libcruft/Makefile libcruft/Makerules])dnl
+define([tmpB], [liboctave/Makefile src/Makefile])dnl
+define([tmpC], [dld/Makefile readline/Makefile readline/doc/Makefile])dnl
+define([tmpD], [readline/examples/Makefile doc/Makefile])dnl
+define([tmpE], [scripts/Makefile test/Makefile])dnl
+define([tmpF], [test/config/Makefile test/octave/Makefile])dnl
+define([srcdirs], [tmpA tmpB tmpC tmpD tmpE tmpF])dnl
+AC_OUTPUT([srcdirs cruftdirs])dnl
new file mode 100755
--- /dev/null
+++ b/doinstall.sh
@@ -0,0 +1,86 @@
+#!/bin/sh
+#
+# doinstall.sh -- install script for binary distributions.
+#
+# John W. Eaton
+# jwe@che.utexas.edu
+# Department of Chemical Engineering
+# The University of Texas at Austin
+
+prefix=/usr/local
+if test $# -eq 1 ; then
+  prefix=$1
+else
+  if test $# -gt 1 ; then
+    echo "usage: doinstall.sh [prefix-directory]"
+    exit 1
+  fi
+fi
+
+# ask octave to tell us the version number
+version=`./octave -v 2>/dev/null | sed -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q`
+
+if test -z "$version" ; then
+  echo "doinstall.sh: unable to extract version number from Octave!"
+  exit 1
+fi
+
+# where to install binaries.
+bindir=$prefix/bin
+
+# where to install M-files
+libsubdir=$prefix/lib/octave/$version
+
+# where to install Info files
+infodir=$prefix/info
+
+cat << EOF
+Installing octave in subdirectories of $prefix:
+
+    Binaries: $bindir
+     M-files: $libsubdir
+  Info files: $infodir
+
+EOF
+
+for d in $bindir $libsubdir $infodir ; do
+  if test -d $d ; then
+    true
+  else
+    echo "making $d"
+    ./mkpath $d
+  fi
+done
+
+if test "$prefix" = /usr/local ; then
+  echo "installing ./octave as $bindir/octave"
+  cp ./octave $bindir/octave
+  chmod 755 $bindir/octave
+else
+  echo "installing octave.sh as $bindir/octave"
+  sed "s|@OCTAVE_HOME@|$prefix|" octave.sh > octave.tmp
+  cp octave.tmp $bindir/octave
+  chmod 755 $bindir/octave
+
+  echo "installing ./octave as $bindir/octave.bin"
+  cp ./octave $bindir/octave.bin
+  chmod 755 $bindir/octave.bin
+fi
+
+echo "installing M-files in $libsubdir"
+for f in scripts/*.m ; do
+  file=`basename $f`
+  echo $file
+  cp $f $libsubdir/$file
+  chmod 644 $libsubdir/$file
+done
+
+echo "installing info files in $infodir"
+for f in doc/octave.info* ; do
+  file=`basename $f`
+  echo $file
+  cp $f $infodir/$file
+  chmod 644 $infodir/$file
+done
+
+exit 0
new file mode 100755
--- /dev/null
+++ b/f2c-compat.sh
@@ -0,0 +1,120 @@
+#!/bin/sh
+#
+# f2c-compat -- try to see if calling a Fortran compiled routine from
+# a C compiled main program will work as if the Fortran routine has
+# been translated to C via f2c.
+#
+# John W. Eaton
+# jwe@che.utexas.edu
+# Department of Chemical Engineering
+# The University of Texas at Austin
+
+# trap 'rm -f ftest* ctest* core; exit 1' 1 3 15
+
+status=1
+
+if test $# -eq 0; then
+  FLIBS_SH="./flibs.sh"
+elif test $# -eq 1; then
+  FLIBS_SH="$1"
+else
+  echo "usage: f2c-compat.sh [flibs_script]"
+  exit 1
+fi
+
+# Write a minimal program, compile it, and see if it works as
+# expected.
+
+cat << EOF > ftest.f
+      INTEGER FUNCTION FORSUB (C, D)
+      CHARACTER *(*) C
+      INTEGER L
+      DOUBLE PRECISION D
+      L = LEN (C)
+      WRITE (*, '(A,1X,I2)') C(1:L), INT (D)
+      FORSUB = 1
+      RETURN
+      END
+EOF
+${F77-f77} -c ftest.f > /dev/null 2>&1
+
+cat << EOF > ctest.c
+extern int strlen ();
+extern int strcpy ();
+extern int forsub_ ();
+static char s[14];
+int
+main (argc, argv)
+  int argc;
+  char **argv;
+{
+  double d = 10.0;
+  int len;
+  strcpy (s, "FOO-I-HITHERE");
+  len = strlen (s);
+  return (! forsub_ (s, &d, len));
+}
+/* For Sun f77 */
+int
+MAIN_ ()
+{
+  return 0;
+}
+EOF
+
+${CC-cc} -c ctest.c > /dev/null 2>&1
+
+FLIBS=`F77="${F77-f77}" $FLIBS_SH`
+
+${CC-cc} -o ctest ctest.o ftest.o $FLIBS -lm > /dev/null 2>&1
+
+ctest_output=`./ctest 2>&1`
+status=$?
+
+if test $status -eq 0 && test "$ctest_output" = "FOO-I-HITHERE 10"
+then
+  echo '-DF77_APPEND_UNDERSCORE=1'
+  status=0
+else
+  cat << EOF > ctest.c
+extern int strlen ();
+extern int strcpy ();
+extern int forsub ();
+static char s[14];
+int
+main (argc, argv)
+  int argc;
+  char **argv;
+{
+  double d = 10.0;
+  int len;
+  strcpy (s, "FOO-I-HITHERE");
+  len = strlen (s);
+  return (! forsub (s, &d, len));
+}
+/* For Sun f77 */
+int
+MAIN_ ()
+{
+  return 0;
+}
+EOF
+
+  ${CC-cc} -c ctest.c > /dev/null 2>&1
+
+  ${CC-cc} -o ctest ctest.o ftest.o $FLIBS -lm > /dev/null 2>&1
+
+  ctest_output=`./ctest 2>&1`
+  status=$?
+
+  if test $status -eq 0 && test "$ctest_output" = "FOO-I-HITHERE 10"
+  then
+    status=0
+  fi
+fi
+
+rm -f ftest* ctest* core
+
+# Bye-bye.
+
+exit $status
new file mode 100755
--- /dev/null
+++ b/flibs.sh
@@ -0,0 +1,72 @@
+#!/bin/sh
+#
+# flibs -- try to get the Fortran compiler to tell us what libraries
+# it expects to link to, and echo the result to the standard output.
+#
+# John W. Eaton
+# jwe@che.utexas.edu
+# Department of Chemical Engineering
+# The University of Texas at Austin
+
+trap 'rm -f conftest* core; exit 1' 1 3 15
+
+# Write a minimal program and compile it with -v.  I don't know what
+# to do if your compiler doesn't have -v...
+
+echo "      END" > conftest.f
+
+# I don't think that stripping commas out of this will ever hurt, and
+# we have to do it for the code that follows to understand the output
+# from `xlf -v'.  
+
+foutput=`${F77-f77} -v -o conftest conftest.f 2>&1 | sed 's/,/ /g'`
+
+flibs=
+lflags=
+want_arg=
+
+for arg in $foutput
+do
+  if test x$want_arg = x
+  then
+    want_arg=
+    case $arg in
+      -[lL]*)
+        exists=false
+        for f in $lflags
+        do
+          if test x$arg = x$f
+          then
+            exists=true
+          fi
+        done
+	if $exists || test x$arg = x-lm -o x$arg = x-lc
+	then
+	  arg=
+        else
+          lflags="$lflags $arg"
+	fi
+      ;;
+      -u)
+        want_arg=$arg
+      ;;
+      *)
+        arg=
+      ;;
+    esac
+  else
+    want_arg=
+  fi
+  if test x$arg != x
+  then
+    flibs="$flibs $arg"
+  fi
+done
+
+echo "$flibs"
+
+rm -f conftest* core
+
+# Bye-bye.
+
+exit 0
new file mode 100644
--- /dev/null
+++ b/mkpath.c
@@ -0,0 +1,87 @@
+/* Make all the directories along a path.
+   Copyright (C) 1992 Free Software Foundation, Inc.
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 1, or (at your option)
+any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs; see the file COPYING.  If not, write to
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+/* This program works like mkdir, except that it generates
+   intermediate directories if they don't exist.  This is just like
+   the `mkdir -p' command on most systems; unfortunately, the mkdir
+   command on some of the purer BSD systems (like Mt. Xinu) don't have
+   that option. */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <errno.h>
+
+extern int errno;
+
+char *prog_name;
+
+int touchy_mkdir (path)
+     char *path;
+{
+  struct stat buf;
+
+  /* If PATH already exists and is a directory, return success.  */
+  if (stat (path, &buf) >= 0
+      && (buf.st_mode & S_IFMT) == S_IFDIR)
+    return 0;
+
+  /* Otherwise, try to make it.  If PATH exists but isn't a directory,
+     this will signal an error.  */
+  if (mkdir (path, 0777) < 0)
+    {
+      fprintf (stderr, "%s: ", prog_name);
+      perror (path);
+      return -1;
+    }
+
+  return 0;
+}
+
+int
+main (argc, argv)
+     int argc;
+     char **argv;
+{
+  prog_name = *argv;
+
+  for (argc--, argv++; argc > 0; argc--, argv++)
+    {
+      char *path = *argv;
+      int i;
+
+      /* Stop at each slash in path and try to create the directory.
+	 Skip any initial slash.  */
+      for (i = (path[0] == '/') ? 1 : 0; path[i]; i++)
+	if (path[i] == '/')
+	  {
+	    path[i] = '\0';
+	    if (touchy_mkdir (path) < 0)
+	      goto next_pathname;
+	    path[i] = '/';
+	  }
+
+      touchy_mkdir (path);
+
+    next_pathname:
+      ;
+    }
+
+  return 0;
+}
new file mode 100644
--- /dev/null
+++ b/octMakefile.in
@@ -0,0 +1,192 @@
+#
+# Makefile for octave
+#
+# John W. Eaton
+# jwe@che.utexas.edu
+# Department of Chemical Engineering
+# The University of Texas at Austin
+
+TOPDIR = .
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include Makeconf
+
+DISTFILES = COPYING ChangeLog Makefile.in Makeconf.in NEWS README \
+	THANKS INSTALL INSTALL.OCTAVE BUGS PLOTTING PROJECTS \
+	f2c-compat.sh flibs.sh configure configure.in config.guess \
+	octave.sh octave-mode.el doinstall.sh mkpath.c
+
+# Complete directory trees to distribute.
+DISTDIRS = bsd-math dld
+
+# Subdirectories to run make in for the primary targets.
+SUBDIRS = libcruft liboctave @DLD_DIR@ readline src doc scripts 
+
+# Subdirectories to run `make dist' in
+DISTSUBDIRS = $(SUBDIRS) test
+
+BINDISTFILES = COPYING ChangeLog NEWS README THANKS INSTALL.OCTAVE \
+	BUGS PLOTTING PROJECTS octave.sh octave-mode.el doinstall.sh \
+	mkpath
+
+# Subdirectories to run `make dist' in
+BINDISTSUBDIRS = doc scripts
+
+all: mkpath
+	for dir in $(SUBDIRS); do echo making $@ in $$dir; cd $$dir; $(MAKE) $@; cd ..; done
+.PHONY: all
+
+mkpath:
+	$(CC) $(ALL_CFLAGS) $(srcdir)/mkpath.c -o mkpath
+
+libcruft:
+	cd libcruft ; $(MAKE) all
+.PHONY: libcruft
+
+liboctave:
+	cd liboctave ; $(MAKE) all
+.PHONY: liboctave
+
+dld:
+	cd dld ; $(MAKE) all
+.PHONY: dld
+
+readline:
+	cd readline ; $(MAKE) all
+.PHONY: readline
+
+src:
+	cd src ; $(MAKE) all
+.PHONY: src
+
+scripts:
+	cd scripts ; $(MAKE) all
+.PHONY: scripts
+
+doc:
+	cd doc ; $(MAKE) all
+.PHONY: doc
+
+check:
+	cd test; $(MAKE) check
+.PHONY: check
+
+octave.info:
+	cd doc ; $(MAKE) octave.info
+.PHONY: octave.info
+
+INSTALL.info:
+	cd doc ; $(MAKE) ../INSTALL.OCTAVE
+.PHONY: INSTALL.info
+
+BUGS.info:
+	cd doc ; $(MAKE) ../BUGS
+.PHONY: BUGS.info
+
+install:
+	for dir in $(SUBDIRS); do echo making $@ in $$dir; cd $$dir; $(MAKE) $@; cd ..; done
+.PHONY: install
+
+uninstall:
+	for dir in $(SUBDIRS); do echo making $@ in $$dir; cd $$dir; $(MAKE) $@; cd ..; done
+.PHONY: uninstall
+
+tags:
+	for dir in $(SUBDIRS); do echo making $@ in $$dir; cd $$dir; $(MAKE) $@; cd ..; done
+.PHONY: tags
+
+TAGS:
+	for dir in $(SUBDIRS); do echo making $@ in $$dir; cd $$dir; $(MAKE) $@; cd ..; done
+.PHONY: TAGS
+
+clean:
+	for dir in $(SUBDIRS); do echo making $@ in $$dir; cd $$dir; $(MAKE) $@; cd ..; done
+.PHONY: clean
+
+mostlyclean:
+	for dir in $(SUBDIRS); do echo making $@ in $$dir; cd $$dir; $(MAKE) $@; cd ..; done
+.PHONY: mostlyclean
+
+distclean: clean
+	for dir in $(SUBDIRS); do echo making $@ in $$dir; cd $$dir; $(MAKE) $@; cd ..; done
+	rm -f *.a Makefile config.status
+.PHONY: distclean
+
+realclean:
+	for dir in $(SUBDIRS); do echo making $@ in $$dir; cd $$dir; $(MAKE) $@; cd ..; done
+	rm -f *.a Makefile config.status
+.PHONY: realclean
+
+local-dist: octave.info INSTALL.info BUGS.info
+	echo octave-local-$(version) > .fname
+	rm -rf `cat .fname`
+	mkdir `cat .fname`
+	ln $(DISTFILES) `cat .fname`
+	for dir in $(DISTDIRS); do ln -s ../$$dir `cat .fname`; done
+	for dir in $(DISTSUBDIRS); do mkdir `cat .fname`/$$dir; cd $$dir; $(MAKE) $@; cd ..; done
+	tar chf `cat .fname`.tar `cat .fname`
+	rm -rf `cat .fname` .fname
+.PHONY: local-dist
+
+links-for-dist: octave.info INSTALL.info BUGS.info
+	echo octave-$(version) > .fname
+	rm -rf `cat .fname`
+	mkdir `cat .fname`
+	ln $(DISTFILES) `cat .fname`
+	for dir in $(DISTDIRS); do ln -s ../$$dir `cat .fname`; done
+	for dir in $(DISTSUBDIRS); do mkdir `cat .fname`/$$dir; cd $$dir; $(MAKE) dist; cd ..; done
+.PHONY: links-for-dist
+
+links-for-bin-dist: octave.info INSTALL.info BUGS.info
+	echo octave-$(version) > .fname
+	rm -rf `cat .fname`
+	mkdir `cat .fname`
+	ln $(BINDISTFILES) `cat .fname`
+	for dir in $(BINDISTSUBDIRS); do mkdir `cat .fname`/$$dir; cd $$dir; $(MAKE) dist; cd ..; done
+.PHONY: links-for-dist
+
+binary-dist: links-for-bin-dist .fname
+	strip src/octave
+	ln src/octave `cat .fname`/octave
+	tar chf `cat .fname`.tar `cat .fname`
+	rm -rf `cat .fname` .fname
+.PHONY: binary-dist
+
+dist: links-for-dist
+	tar chf `cat .fname`.tar `cat .fname`
+	rm -rf `cat .fname` .fname
+.PHONY: dist
+
+dist-z:
+	echo octave-$(versin).tar > .fname
+	gzip --best `cat .fname`
+.PHONY: dist-z
+
+split-dist:
+	echo octave-$(version).tar.z > .fname
+	split -b 1350k `cat .fname` `cat .fname`-
+	rm -f .fname
+.PHONY: split-dist
+
+split-local-dist:
+	echo octave-local-$(version).tar.z > .fname
+	split -b 1350k `cat .fname` `cat .fname`-
+	rm -f .fname
+.PHONY: split-local-dist
+
+newversion:
+	awk '/static[ \t]+char[ \t]+version_string\[\] [ \t]*=/ { \
+	  beg = index ($$5, ".") + 1; \
+	  end = index ($$5, ";") - 2; \
+	  len_major = beg - 3; \
+	  len_minor = end - beg + 1; \
+	  major = substr ($$5, 2, len_major); \
+	  minor = substr ($$5, beg, len_minor); \
+	  printf ("static char version_string[] = \"%d.%d\";\n", \
+		  major, ++minor); \
+	  next; \
+	} { print $$0 }' src/version.h > src/version.h.new
+	mv src/version.h.new src/version.h
+.PHONY: newversion
new file mode 100644
--- /dev/null
+++ b/octave-mode.el
@@ -0,0 +1,346 @@
+;; octave-mode.el - major mode for editing Octave source with GNU Emacs
+;;
+;; This major mode for GNU Emacs provides support for editing Octave
+;; source files.  It automatically indents for block structures, line
+;; continuations (e.g., ...), and comments.  The usual paren matching
+;; support is included.  Indenting for continued matrix expressions is
+;; currently not supported.  Perhaps it will be in the future.  Auto-fill
+;; mode seems to actually work!  For convient use add something like the
+;; following to your .emacs start-up file:
+;;
+;;   (autoload 'octave-mode "octave-mode" "Enter Octave-mode." t)
+;;   (setq auto-mode-alist (cons '("\\.m$" . octave-mode) auto-mode-alist))
+;;   (setq octave-mode-hook '(lambda () (setq fill-column 74)))
+;;
+;; Enjoy.
+;;
+;; Last modified Sun Mar  7 17:55:20 1993.
+;;
+;; This file was modified by John W. Eaton (jwe@che.utexas.edu) from
+;; the file matlab-mode.el which is:
+;;
+;; Copyright (C) 1991 Matthew R. Wette.
+;; Everyone is granted permission to copy, modify and redistribute this
+;; file provided:
+;;   1. All copies contain this copyright notice.
+;;   2. All modified copies shall carry a prominant notice stating who
+;;      made the last modification and the date of such modification.
+;;   3. No charge is made for this software or works derived from it.
+;;      This clause shall not be construed as constraining other software
+;;      distributed on the same medium as this software, nor is a
+;;      distribution fee considered a charge.
+;;
+;; Version 1.01, dated 25Jan91
+;;
+;; 25Jan91 by Matt Wette, mwette@csi.jpl.nasa.gov
+;;	Got indentation of matrix expression to work, I think.  Also,
+;;	added tabs to comment start regular-expression.
+;;
+;; 14Jan91 by Matt Wette, mwette@csi.jpl.nasa.gov
+;;	Added functions (ml-unbal-matexp ml-matexp-indent) for matrix
+;;	expressions.
+;;
+;; 07Jan91 by Matt Wette, mwette@csi.jpl.nasa.gov
+;;      Many changes.  Seems to work reasonably well.  Still would like
+;;      to add some support for filling in comments and handle continued
+;;      matrix expressions.  Released as Version 1.0.
+;;
+;; 04Jan91 by Matt Wette, mwette@csi.jpl.nasa.gov
+;;      Created.  Used eiffel.el as a guide.
+
+
+;; Constants used in all Octave-mode buffers.
+(defconst octave-indent-level 2
+  "*The indentation in Octave-mode.")
+
+(defconst octave-comment-column 40
+  "*The goal comment column in Octave-mode buffers.")
+
+
+;; Syntax Table
+(defvar octave-mode-syntax-table nil
+  "Syntax table used in Octave-mode buffers.")
+
+(if octave-mode-syntax-table
+    ()
+  (setq octave-mode-syntax-table (make-syntax-table))
+  (modify-syntax-entry ?\\ "." octave-mode-syntax-table)
+  (modify-syntax-entry ?/ "." octave-mode-syntax-table)
+  (modify-syntax-entry ?* "." octave-mode-syntax-table)
+  (modify-syntax-entry ?+ "." octave-mode-syntax-table)
+  (modify-syntax-entry ?- "." octave-mode-syntax-table)
+  (modify-syntax-entry ?= "." octave-mode-syntax-table)
+  (modify-syntax-entry ?< "." octave-mode-syntax-table)
+  (modify-syntax-entry ?> "." octave-mode-syntax-table)
+  (modify-syntax-entry ?& "." octave-mode-syntax-table)
+  (modify-syntax-entry ?| "." octave-mode-syntax-table)
+  (modify-syntax-entry ?\' "\"" octave-mode-syntax-table)
+  (modify-syntax-entry ?# "<" octave-mode-syntax-table)
+  (modify-syntax-entry ?% "<" octave-mode-syntax-table)
+  (modify-syntax-entry ?\n ">" octave-mode-syntax-table)
+  (set-syntax-table octave-mode-syntax-table))
+
+
+;; Abbrev Table
+(defvar octave-mode-abbrev-table nil
+  "Abbrev table used in Octave-mode buffers.")
+
+(define-abbrev-table 'octave-mode-abbrev-table ())
+
+
+;; Mode Map
+(defvar octave-mode-map ()
+  "Keymap used in octave-mode.")
+
+(if octave-mode-map
+    ()
+  (setq octave-mode-map (make-sparse-keymap))
+  (define-key octave-mode-map "\r" 'octave-return)
+  (define-key octave-mode-map "\t" 'octave-indent-line)
+  (define-key octave-mode-map "\M-;" 'octave-comment)
+  (define-key octave-mode-map "\C-ct" 'octave-line-type)
+  (define-key octave-mode-map "\C-ci" 'octave-indent-type)
+  (define-key octave-mode-map "\M-\r" 'newline))
+
+
+;; Octave Mode
+(defun octave-mode ()
+  "Major mode for editing Octave source files.  Version 1.0, 23 Feb 1993.
+Will run octave-mode-hook if it is non-nil.  Auto-fill-mode seems to work.
+Filling does not work (yet).
+Special Key Bindings:
+\\{octave-mode-map}
+Variables:
+  octave-indent-level                   Level to indent blocks.
+  octave-comment-column                 Goal column for on-line comments.
+  fill-column                           Column used in auto-fill (default=70).
+Commands:
+  octave-mode                           Enter Octave major mode.
+  octave-return                         Handle return with indenting.
+  octave-indent-line                    Indent line for structure.
+  octave-comment                        Add comment to current line.
+  octave-comment-indent                 Compute indent for comment.
+  octave-line-type                      Tell current line type (for debugging).
+  octave-indent-type                    Tell last indent type (for debugging).
+To add automatic support put something like the following in your .emacs file:
+  \(autoload 'octave-mode \"octave-mode\" \"Enter Octave-mode.\" t\)
+  \(setq auto-mode-alist \(cons '\(\"\\\\.m$\" . octave-mode\) \
+auto-mode-alist\)\)
+  \(setq octave-mode-hook '\(lambda \(\) \(setq fill-column 74\)\)\)"
+  (interactive)
+  (kill-all-local-variables)
+  (use-local-map octave-mode-map)
+  (setq major-mode 'octave-mode)
+  (setq mode-name "Octave")
+  (setq local-abbrev-table octave-mode-abbrev-table)
+  (set-syntax-table octave-mode-syntax-table)
+  (make-local-variable 'paragraph-start)
+  (setq paragraph-start (concat "^$\\|" page-delimiter))
+  (make-local-variable 'paragraph-separate)
+  (setq paragraph-separate paragraph-start)
+  (make-local-variable 'paragraph-ignore-fill-prefix)
+  (setq paragraph-ignore-fill-prefix t)
+  (make-local-variable 'indent-line-function)
+  (setq indent-line-function 'octave-indent-line)
+  (make-local-variable 'comment-start-skip)
+  (setq comment-start-skip "[%#][ \t]*")
+  (make-local-variable 'comment-column)
+  (setq comment-column 'octave-comment-column)
+  (make-local-variable 'comment-indent-hook)
+  (setq comment-indent-hook 'octave-comment-indent)
+  (make-local-variable 'fill-column)
+  (setq fill-column default-fill-column)
+  (run-hooks 'octave-mode-hook))
+
+
+(defun octave-return ()
+  "Handle carriage return in Octave-mode."
+  (interactive)
+  (if (oct-block-end-line)
+      (octave-indent-line))
+  (newline)
+  (octave-indent-line))
+
+(defun octave-comment ()
+  "Add a comment to the following line, or format if one already exists."
+  (interactive)
+  (cond
+   ((oct-empty-line)
+    (octave-indent-line)
+    (insert "# "))
+   ((oct-comment-line))
+   (t
+    (end-of-line)
+    (re-search-backward "[^ \t^]" 0 t)
+    (forward-char)
+    (delete-horizontal-space)
+    (if (< (current-column) octave-comment-column)
+        (indent-to octave-comment-column)
+      (insert " "))
+    (insert "# "))))
+
+(defun octave-comment-indent ()
+  "Indent a comment line in Octave-mode."
+  (oct-calc-indent))
+
+(defun octave-indent-line ()
+  "Indent a line in Octave-mode."
+  (interactive)
+  (save-excursion
+    (beginning-of-line)
+    (delete-horizontal-space)
+    (indent-to (oct-calc-indent)))
+  (skip-chars-forward " \t"))
+
+(defun octave-line-type ()
+  "Display type of current line.  Used in debugging."
+  (interactive)
+  (cond
+   ((oct-empty-line)
+    (message "octave-line-type: empty-line"))
+   ((oct-comment-line)
+    (message "octave-line-type: comment-line"))
+   ((oct-continuation-line)
+    (message "octave-line-type: continuation-line"))
+   ((oct-block-beg-end-line)
+    (message "octave-line-type: block-beg-end-line"))
+   ((oct-block-beg-line)
+    (message "octave-line-type: block-beg-line"))
+   ((oct-block-end-line)
+    (message "octave-line-type: block-end-line"))
+   (t
+    (message "octave-line-type: other"))))
+
+(defun octave-indent-type ()
+  "Display type of current or previous nonempty line.  Used in debugging."
+  (interactive)
+  (message (concat "octave-ident-type: " oct-last-indent-type)))
+
+(defun octave-fill-region (from to &optional justify-flag)
+  "Fill the region of comments.
+Prefix arg (non-nil third arg, if called from program)
+means justify as well."
+  (interactive "r\nP")
+  (messages "octave-fill-region not implemented yet."))
+
+(defvar oct-last-indent-type "unknown"
+  "String to tell line type.")
+
+(defun oct-calc-indent ()
+  "Return the appropriate indentation for this line as an int."
+  (let ((indent 0))
+    (save-excursion
+      (forward-line -1)                 ; compute indent based on previous
+      (if (oct-empty-line)               ;   non-empty line
+          (re-search-backward "[^ \t\n]" 0 t))
+      (cond
+       ((oct-empty-line) 
+        (setq oct-last-indent-type "empty"))
+       ((oct-comment-line) 
+        (setq oct-last-indent-type "comment"))
+       ((oct-continuation-line)
+        (setq oct-last-indent-type "continuation")
+        (setq indent (* 2 octave-indent-level)))
+       ((oct-block-beg-end-line)
+        (setq oct-last-indent-type "block begin-end"))
+       ((oct-block-beg-line)
+        (setq oct-last-indent-type "block begin")
+        (setq indent octave-indent-level))
+       ((oct-unbal-matexp-line)
+        (setq oct-last-indent-type "unbalanced-matrix-expression")
+        (setq indent (oct-calc-matexp-indent)))
+       (t
+        (setq oct-last-indent-type "other")))
+      (setq indent (+ indent (current-indentation)))
+      (if (= 0 (forward-line -1))
+          (if (oct-continuation-line)
+              (setq indent (- indent (* 2 octave-indent-level))))))
+    (if (oct-block-end-line) (setq indent (- indent octave-indent-level)))
+    (if (< indent 0) (setq indent 0))
+    indent))
+
+
+(defun oct-empty-line ()
+  "Returns t if current line is empty."
+  (save-excursion
+    (beginning-of-line)
+    (looking-at "^[ \t]*$")))
+
+(defun oct-comment-line ()
+  "Returns t if current line is an Octave comment line."
+  (save-excursion
+    (beginning-of-line)
+    (skip-chars-forward " \t")
+    (looking-at "[%#]")))
+
+(defun oct-continuation-line ()
+  "Returns t if current line ends in ... and optional comment."
+  (save-excursion
+    (beginning-of-line)
+    (re-search-forward "\\.\\.\\.+[ \t]*\\(%.*\\)?$" (oct-eoln-point) t)))
+
+(defun oct-eoln-point ()
+  "Returns point for end-of-line in Octave-mode."
+  (save-excursion
+    (end-of-line)
+    (point)))
+
+(defun oct-block-beg-line ()
+  "Returns t if line contains beginning of Octave block."
+  (save-excursion
+    (beginning-of-line)
+    (looking-at (concat "\\([^%#\n]*[ \t]\\)?" oct-block-beg-kw))))
+
+(defconst oct-block-beg-kw "\\(for\\|while\\|if\\|else\\|elseif\\|function\\)"
+  "Regular expression for keywords which begin blocks in Octave-mode.")
+
+(defun oct-block-end-line ()
+  "Returns t if line contains end of Octave block."
+  (save-excursion
+    (beginning-of-line)
+    (looking-at (concat "\\([^%#\n]*[ \t]\\)?" oct-block-end-kw))))
+
+(defconst oct-block-end-kw "\\(end\\|endfor\\|endwhile\\|endif\\|endfunction\\|else\\|elseif\\)"
+  "Regular expression for keywords which end blocks.")
+
+(defun oct-block-beg-end-line ()
+  "Returns t if line contains matching block begin-end in Octave-mode."
+  (save-excursion
+    (beginning-of-line)
+    (looking-at (concat
+                 "\\([^%#\n]*[ \t]\\)?" oct-block-beg-kw 
+                 "." "\\([^%#\n]*[ \t]\\)?" oct-block-end-kw))))
+
+(defun oct-unbal-matexp-line ()
+  (if (= (oct-calc-matexp-indent) 0)
+    ()
+    t))
+
+(defun oct-calc-matexp-indent ()
+  (let ((indent 0))
+    (save-excursion
+      (beginning-of-line)
+      (while (< (point) (oct-eoln-point))
+	(cond
+	 ((looking-at "\\[")
+	  (setq indent (+ indent octave-indent-level)))
+	 ((looking-at "\\]")
+	  (setq indent (- indent octave-indent-level))))
+	(forward-char)))
+    (* 2 indent)))
+
+(defun oct-comment-on-line ()
+  "Returns t if current line contains a comment."
+  (save-excursion
+    (beginning-of-line)
+    (looking-at "[^\n]*[%#]")))
+
+(defun oct-in-comment ()
+  "Returns t if point is in a comment."
+  (save-excursion
+    (and (/= (point) (point-max)) (forward-char))
+    (search-backward "[%#]" (save-excursion (beginning-of-line) (point)) t)))
+
+(provide 'octave-mode)
+
+;; --- last line of octave-mode.el --- 
new file mode 100755
--- /dev/null
+++ b/octave.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+#
+# Wrapper for octave for binary installations that can't install
+# octave in /usr/local/bin.
+#
+# The real binary should be installed in as octave.bin, and this file
+# should be installed in the same directory as octave.
+
+OCTAVE_HOME=@OCTAVE_HOME@
+export OCTAVE_HOME
+
+exec octave.bin $*