changeset 2469:f201716926bb

[project @ 1996-11-05 19:39:33 by jwe]
author jwe
date Tue, 05 Nov 1996 19:40:29 +0000
parents 3db30620918e
children 1e673f0648b5
files ChangeLog PROJECTS acconfig.h aclocal.m4 doc/interpreter/func.texi doc/interpreter/install.texi doc/interpreter/invoke.texi doc/interpreter/program.texi doc/interpreter/system.texi src/ChangeLog src/sighandlers.cc src/sighandlers.h
diffstat 12 files changed, 192 insertions(+), 63 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Nov 05 03:52:50 1996 +0000
+++ b/ChangeLog	Tue Nov 05 19:40:29 1996 +0000
@@ -1,3 +1,19 @@
+Tue Nov  5 12:32:30 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* aclocal.m4 (OCTAVE_SIGNAL_CHECK, OCTAVE_REINSTALL_SIGHANDLERS):
+	New checks stolen from bash 2.0 config.
+	* configure.in: Use them.
+	* acconfig.h: Add #undefs for HAVE_BSD_SIGNALS, HAVE_POSIX_SIGNALS,
+	HAVE_USG_SIGHOLD, and MUST_REINSTALL_SIGHANDLERS.
+
+
+Mon Nov  4 11:31:22 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* configure.in: Check for gethostname in libsocket.  Apparently
+	needed for some SCO systems.
+
+	* emacs/octave.el: Update to version 0.8.5 from Kurt Hornik.
+
 Fri Nov  1 01:33:40 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* octMakefile.in (octave-bug, mkoctfile): After substituting
--- a/PROJECTS	Tue Nov 05 03:52:50 1996 +0000
+++ b/PROJECTS	Tue Nov 05 19:40:29 1996 +0000
@@ -393,6 +393,8 @@
   * Make Octave as independent of the particular readline version as
     possible.
 
+  * Make configure take more defaults from the environment.
+
   * Should --enable-lite-kernel imply --enable-shared?
 
   * Make it possible to configure without readline.
--- a/acconfig.h	Tue Nov 05 03:52:50 1996 +0000
+++ b/acconfig.h	Tue Nov 05 19:40:29 1996 +0000
@@ -33,12 +33,24 @@
 /* Define if your gnuplot has mutliplot. */
 #undef GNUPLOT_HAS_MULTIPLOT
 
+/* Define if you have BSD style signals. */
+#undef HAVE_BSD_SIGNALS
+
+/* Define if you have POSIX style signals. */
+#undef HAVE_POSIX_SIGNALS
+
 /* Define if your system has program_invocation_name. */
 #undef HAVE_PROGRAM_INVOCATION_NAME
 
 /* Define if your system has a sys_siglist variable. */
 #undef HAVE_SYS_SIGLIST
 
+/* Define if you have System V Release 3 style signals. */
+#undef HAVE_USG_SIGHOLD
+
+/* Define if signal handlers must be reinstalled after they are called. */
+#undef MUST_REINSTALL_SIGHANDLERS
+
 /* Define if you don't have NPSOL. */
 #undef NPSOL_MISSING
 
--- a/aclocal.m4	Tue Nov 05 03:52:50 1996 +0000
+++ b/aclocal.m4	Tue Nov 05 19:40:29 1996 +0000
@@ -435,3 +435,97 @@
 if test $octave_cv_var_program_inv_name = yes; then
   AC_DEFINE(HAVE_PROGRAM_INVOCATION_NAME)
 fi])
+dnl
+dnl These two checks for signal functions were originally part of the
+dnl aclocal.m4 file distributed with bash 2.0.
+dnl
+dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7)
+AC_DEFUN(OCTAVE_SIGNAL_CHECK,
+[AC_REQUIRE([AC_TYPE_SIGNAL])
+AC_MSG_CHECKING(for type of signal functions)
+AC_CACHE_VAL(octave_cv_signal_vintage,
+[
+  AC_TRY_LINK([#include <signal.h>],[
+    sigset_t ss;
+    struct sigaction sa;
+    sigemptyset(&ss); sigsuspend(&ss);
+    sigaction(SIGINT, &sa, (struct sigaction *) 0);
+    sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
+  ], octave_cv_signal_vintage=posix,
+  [
+    AC_TRY_LINK([#include <signal.h>], [
+	int mask = sigmask(SIGINT);
+	sigsetmask(mask); sigblock(mask); sigpause(mask);
+    ], octave_cv_signal_vintage=4.2bsd,
+    [
+      AC_TRY_LINK([
+	#include <signal.h>
+	RETSIGTYPE foo() { }], [
+		int mask = sigmask(SIGINT);
+		sigset(SIGINT, foo); sigrelse(SIGINT);
+		sighold(SIGINT); sigpause(SIGINT);
+        ], octave_cv_signal_vintage=svr3
+    )]
+  )]
+)
+])
+AC_MSG_RESULT($octave_cv_signal_vintage)
+if test $octave_cv_signal_vintage = posix; then
+AC_DEFINE(HAVE_POSIX_SIGNALS)
+elif test $octave_cv_signal_vintage = "4.2bsd"; then
+AC_DEFINE(HAVE_BSD_SIGNALS)
+elif test $octave_cv_signal_vintage = svr3; then
+AC_DEFINE(HAVE_USG_SIGHOLD)
+fi
+])
+dnl
+AC_DEFUN(OCTAVE_REINSTALL_SIGHANDLERS,
+[AC_REQUIRE([AC_TYPE_SIGNAL])
+AC_REQUIRE([OCTAVE_SIGNAL_CHECK])
+AC_MSG_CHECKING([if signal handlers must be reinstalled when invoked])
+AC_CACHE_VAL(octave_cv_must_reinstall_sighandlers,
+[AC_TRY_RUN([
+#include <signal.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+typedef RETSIGTYPE sigfunc();
+int nsigint;
+#ifdef HAVE_POSIX_SIGNALS
+sigfunc *
+set_signal_handler(sig, handler)
+     int sig;
+     sigfunc *handler;
+{
+  struct sigaction act, oact;
+  act.sa_handler = handler;
+  act.sa_flags = 0;
+  sigemptyset (&act.sa_mask);
+  sigemptyset (&oact.sa_mask);
+  sigaction (sig, &act, &oact);
+  return (oact.sa_handler);
+}
+#else
+#define set_signal_handler(s, h) signal(s, h)
+#endif
+RETSIGTYPE
+sigint(s)
+    int s;
+{
+  nsigint++;
+}
+main()
+{
+  nsigint = 0;
+  set_signal_handler(SIGINT, sigint);
+  kill((int)getpid(), SIGINT);
+  kill((int)getpid(), SIGINT);
+  exit(nsigint != 2);
+}
+], octave_cv_must_reinstall_sighandlers=no, octave_cv_must_reinstall_sighandlers=yes,
+AC_MSG_ERROR(cannot check signal handling if cross compiling))])
+AC_MSG_RESULT($octave_cv_must_reinstall_sighandlers)
+if test $octave_cv_must_reinstall_sighandlers = yes; then
+AC_DEFINE(MUST_REINSTALL_SIGHANDLERS)
+fi
+])
--- a/doc/interpreter/func.texi	Tue Nov 05 03:52:50 1996 +0000
+++ b/doc/interpreter/func.texi	Tue Nov 05 19:40:29 1996 +0000
@@ -583,11 +583,11 @@
 has to be done to ensure that the correct function definition is used.
 
 Octave assumes that function files in the
-@file{/usr/local/lib/octave/@value{VERSION}/m} directory tree will not
-change, so it doesn't have to check their time stamps every time the
-functions defined in those files are used.  This is normally a very good
-assumption and provides a significant improvement in performance for the
-function files that are distributed with Octave.
+@file{@value{OCTAVEHOME}/share/octave/@value{VERSION}/m} directory tree
+will not change, so it doesn't have to check their time stamps every
+time the functions defined in those files are used.  This is normally a
+very good assumption and provides a significant improvement in
+performance for the function files that are distributed with Octave.
 
 If you know that your own function files will not change while you are
 running Octave, you can improve performance by setting the variable
--- a/doc/interpreter/install.texi	Tue Nov 05 03:52:50 1996 +0000
+++ b/doc/interpreter/install.texi	Tue Nov 05 19:40:29 1996 +0000
@@ -115,7 +115,10 @@
 
 This will install a copy of octave, its libraries, and its documentation
 in the destination directory.  As distributed, Octave is installed in
-the following directories:
+the following directories.  In the table below, @var{prefix} defaults to
+@file{/usr/local}, @var{version} stands for the current version number
+of the interpreter, and @var{host_type} is the type of computer on which
+Octave is installed (for example, @samp{i586-unknown-gnu}).
 
 @table @file
 @item @var{prefix}/bin
@@ -124,6 +127,9 @@
 @item @var{prefix}/lib
 Libraries like libcruft.a and liboctave.a.
 
+@item @var{prefix}/share
+Architecture-independent data files.
+
 @item @var{prefix}/include/octave
 Include files distributed with Octave.
 
@@ -133,7 +139,7 @@
 @item @var{prefix}/info
 Info files describing Octave.
 
-@item @var{prefix}/lib/octave/@var{version}/m
+@item @var{prefix}/share/octave/@var{version}/m
 Function files distributed with Octave.  This includes the Octave
 version, so that multiple versions of Octave may be installed at the
 same time.
@@ -144,15 +150,9 @@
 @item @var{prefix}/lib/octave/@var{version}/oct/@var{host_type}
 Object files that will be dynamically loaded.
 
-@item @var{prefix}/lib/octave/@var{version}/imagelib
+@item @var{prefix}/share/octave/@var{version}/imagelib
 Image files that are distributed with Octave.
 @end table
-
-@noindent
-where @var{prefix} defaults to @file{/usr/local}, @var{version}
-stands for the current version number of the interpreter, and
-@var{host_type} is the type of computer on which Octave is installed
-(for example, @samp{i486-unknown-gnu}).
 @end itemize
 
 @menu
@@ -465,7 +465,7 @@
 If these directories don't exist, the script @file{doinstall.sh} will
 create them for you.
 
-If this is possible for you to install Octave in @file{/usr/local}, or
+If it is not possible for you to install Octave in @file{/usr/local}, or
 if you would prefer to install it in a different directory, you can
 specify the name of the top level directory as an argument to the
 doinstall.sh script.  For example:
--- a/doc/interpreter/invoke.texi	Tue Nov 05 03:52:50 1996 +0000
+++ b/doc/interpreter/invoke.texi	Tue Nov 05 19:40:29 1996 +0000
@@ -193,9 +193,9 @@
 automatically set to the name that was typed at the shell prompt to run
 Octave, and the value of @code{program_name} is automatically set to the
 final component of @code{program_invocation_name}.  For example, if you
-typed @file{/usr/local/bin/octave} to start Octave,
+typed @file{@value{OCTAVEHOME}/bin/octave} to start Octave,
 @code{program_invocation_name} would have the value
-@file{/usr/local/bin/octave}, and @code{program_name} would have the
+@file{@value{OCTAVEHOME}/bin/octave}, and @code{program_name} would have the
 value @code{octave}.
 
 If executing a script from the command line (e.g., @code{octave foo.m}
@@ -230,13 +230,22 @@
 @cindex startup files
 
 @table @code
-@item OCTAVE_HOME/lib/octave/VERSION/m/startup/octaverc
+@item OCTAVE_HOME/share/octave/site/m/startup/octaverc
+Where @code{OCTAVE_HOME} is the directory in which all of Octave is
+installed (the default is @file{/usr/local}).  This file is provided so
+that changes to the default Octave environment can be made globally for
+all users at your site for all versions of Octave you have installed.
+Some care should be taken when making changes to this file, since all
+users of Octave at your site will be affected.
+
+@item OCTAVE_HOME/share/octave/VERSION/m/startup/octaverc
 Where @code{OCTAVE_HOME} is the directory in which all of Octave is
 installed (the default is @file{/usr/local}), and @code{VERSION} is the
 version number of Octave.  This file is provided so that changes to the
-default Octave environment can be made globally for all users.  Some
-care should be taken when making changes to this file, since all users
-of Octave at your site will be affected.
+default Octave environment can be made globally for all users for a
+particular version of Octave.  Some care should be taken when making
+changes to this file, since all users of Octave at your site will be
+affected.
 
 @item ~/.octaverc
 @cindex @code{~/.octaverc}
--- a/doc/interpreter/program.texi	Tue Nov 05 03:52:50 1996 +0000
+++ b/doc/interpreter/program.texi	Tue Nov 05 19:40:29 1996 +0000
@@ -376,7 +376,7 @@
 
 @example
 octave:13> file_in_path (LOADPATH, "nargchk.m")
-ans = /usr/local/lib/octave/1.1.0/m/general/nargchk.m
+ans = "@value{OCTAVEHOME}/share/octave/2.0/m/general/nargchk.m"
 @end example
 @end deftypefn
 
--- a/doc/interpreter/system.texi	Tue Nov 05 03:52:50 1996 +0000
+++ b/doc/interpreter/system.texi	Tue Nov 05 19:40:29 1996 +0000
@@ -462,10 +462,13 @@
 argument @code{--exec-path PATH}, or by setting the value of
 @code{EXEC_PATH} in a startup script.  If the value of @code{EXEC_PATH}
 begins (ends) with a colon, the directories
+@code{OCTAVE_HOME/libexec/octave/site/exec/ARCH},
 @code{OCTAVE_HOME/libexec/octave/VERSION/exec/ARCH} and
-@code{OCTAVE_HOME/bin} are prepended (appended) to @code{EXEC_PATH} (if
-you don't specify a value for @code{EXEC_PATH} explicitly, these special
-directories are prepended to your shell path).
+@code{OCTAVE_HOME/bin} are prepended (appended) to @code{EXEC_PATH},
+where @code{OCTAVE_HOME} is the top-level directory where all of Octave
+is installed (@file{/usr/local} by default).  If you don't specify a
+value for @code{EXEC_PATH} explicitly, these special directories are
+prepended to your shell path.
 @end defvr
 
 @deftypefn {Built-in Function} {} getenv (@var{var})
--- a/src/ChangeLog	Tue Nov 05 03:52:50 1996 +0000
+++ b/src/ChangeLog	Tue Nov 05 19:40:29 1996 +0000
@@ -1,3 +1,14 @@
+Tue Nov  5 13:00:35 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* sighandlers.h (octave_child_list): Don't define
+	HAVE_POSIX_SIGNALS HERE.
+
+	* sighandlers.cc (SIGHANDLER_RETURN): New macro.
+	(generic_sig_handler, sigchld_handler, sigfpe_handler,
+	sigint_handler, sigpipe_handler):  Use it.
+	(sigchld_handler, sigfpe_handler, sigint_handler, sigpipe_handler):
+	Only reinstall signal handler if MUST_REINSTALL_SIGHANDLER is defined.
+
 Sun Nov  3 00:45:30 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* pt-const.cc (tree_constant::print): Just call val.print().
--- a/src/sighandlers.cc	Tue Nov 05 03:52:50 1996 +0000
+++ b/src/sighandlers.cc	Tue Nov 05 19:40:29 1996 +0000
@@ -63,6 +63,12 @@
 static sigset_t octave_signal_mask;
 #endif
 
+#if RETSIGTYPE == void
+#define SIGHANDLER_RETURN(status) return
+#else
+#define SIGHANDLER_RETURN(status) return status
+#endif
+
 void
 octave_save_signal_mask (void)
 {
@@ -126,11 +132,7 @@
 {
   my_friendly_exit (sys_siglist[sig], sig);
 
-#if RETSIGTYPE == void
-  return;
-#else
-  return 0;
-#endif
+  SIGHANDLER_RETURN (0);
 }
 
 // Handle SIGCHLD.
@@ -138,10 +140,9 @@
 static RETSIGTYPE
 sigchld_handler (int /* sig */)
 {
-  // Can this ever cause trouble on systems that don't forget signal
-  // handlers when they are invoked?
-
+#ifdef MUST_REINSTALL_SIGHANDLERS
   octave_set_signal_handler (SIGCHLD, sigchld_handler);
+#endif
 
   int n = octave_child_list::length ();
 
@@ -168,16 +169,17 @@
 	    }
 	}
     }
+
+  SIGHANDLER_RETURN (0);
 }
 
 #if defined (__alpha__)
 static RETSIGTYPE
 sigfpe_handler (int /* sig */)
 {
-  // Can this ever cause trouble on systems that don't forget signal
-  // handlers when they are invoked?
-
+#ifdef MUST_REINSTALL_SIGHANDLERS
   octave_set_signal_handler (SIGFPE, sigfpe_handler);
+#endif
 
   error ("floating point exception -- trying to return to prompt");
 
@@ -187,11 +189,7 @@
       panic_impossible ();
     }
 
-#if RETSIGTYPE == void
-  return;
-#else
-  return 0;
-#endif
+  SIGHANDLER_RETURN (0);
 }
 #endif
 
@@ -200,10 +198,9 @@
 static RETSIGTYPE
 sigint_handler (int /* sig */)
 {
-  // Can this ever cause trouble on systems that don't forget signal
-  // handlers when they are invoked?
-
+#ifdef MUST_REINSTALL_SIGHANDLERS
   octave_set_signal_handler (SIGINT, sigint_handler);
+#endif
 
   if (can_interrupt)
     {
@@ -211,20 +208,15 @@
       panic_impossible ();
     }
 
-#if RETSIGTYPE == void
-  return;
-#else
-  return 0;
-#endif
+  SIGHANDLER_RETURN (0);
 }
 
 static RETSIGTYPE
 sigpipe_handler (int /* sig */)
 {
-  // Can this ever cause trouble on systems that don't forget signal
-  // handlers when they are invoked?
-
+#ifdef MUST_REINSTALL_SIGHANDLERS
   octave_set_signal_handler (SIGPIPE, sigpipe_handler);
+#endif
 
   if (pipe_handler_error_count++ == 0)
     warning ("broken pipe");
@@ -234,11 +226,7 @@
   if (pipe_handler_error_count  > 100)
     jump_to_top_level ();
 
-#if RETSIGTYPE == void
-  return;
-#else
-  return 0;
-#endif
+  SIGHANDLER_RETURN (0);
 }
 
 void
--- a/src/sighandlers.h	Tue Nov 05 03:52:50 1996 +0000
+++ b/src/sighandlers.h	Tue Nov 05 19:40:29 1996 +0000
@@ -64,12 +64,6 @@
 extern char *sys_siglist[];
 #endif
 
-#if defined (HAVE_SIGACTION) && defined (HAVE_SIGPROCMASK)
-#if defined (HAVE_SIGPENDING) && defined (HAVE_SIGSUSPEND)
-#define HAVE_POSIX_SIGNALS
-#endif
-#endif
-
 // Maybe this should be in a separate file?
 
 class