changeset 2676:a5a300c61159

[project @ 1997-02-14 03:16:06 by jwe]
author jwe
date Fri, 14 Feb 1997 03:16:12 +0000
parents 5b13fb88db90
children 014551a682b9
files ChangeLog Makeconf.in configure.in kpathsea/ChangeLog kpathsea/Makefile.in kpathsea/configure.in libcruft/ChangeLog libcruft/Makefile.in libcruft/Makerules.in liboctave/CColVector.cc liboctave/CColVector.h liboctave/CMatrix.cc liboctave/CMatrix.h liboctave/CRowVector.cc liboctave/CRowVector.h liboctave/ChangeLog liboctave/Makefile.in liboctave/chMatrix.h liboctave/dColVector.cc liboctave/dColVector.h liboctave/dMatrix.cc liboctave/dMatrix.h liboctave/dRowVector.cc liboctave/dRowVector.h octave-bug.in readline/ChangeLog readline/Makefile.in readline/configure.in scripts/ChangeLog scripts/image/saveimage.m src/ChangeLog src/Makefile.in src/gripes.cc
diffstat 33 files changed, 295 insertions(+), 202 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 Thu Feb 13 16:25:09 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* configure.in (SH_LD, SH_LDFLAGS): New variables.
+	* Makeconf.in: Substitute them.
+
+	* configure.in (SH_LIBS, SH_FLIBS, SH_TERMLIBS): Delete.
+
+	* Makeconf.in (SH_LIBS, SH_FLIBS, SH_TERMLIBS): Delete.
+
 	* octave-bug.in: Reinstate RLD_FLAG.
 	* mkoctfile.in: Likewise.
 	* Makeconf.in: Likewise.
--- a/Makeconf.in
+++ b/Makeconf.in
@@ -114,6 +114,9 @@
 ALL_LDFLAGS = $(LIBFLAGS) $(FORTRAN_MAIN_FLAG) $(GCC_IEEE_FP_FLAG) \
 	$(LD_STATIC_FLAG) $(CPICFLAG) $(LDFLAGS)
 
+SH_LD = @SH_LD@
+SH_LDFLAGS = @SH_LDFLAGS@
+
 RLD_FLAG = @RLD_FLAG@
 
 FLIBS = @FLIBS@
@@ -124,10 +127,6 @@
 LIBPLPLOT = @LIBPLPLOT@
 LIBDLFCN = @LIBDLFCN@
 
-SH_FLIBS = @SH_FLIBS@
-SH_TERMLIBS = @SH_TERMLIBS@
-SH_LIBS = @SH_LIBS@
-
 # The arguments passed to configure.
 config_opts = @config_opts@
 
--- a/configure.in
+++ b/configure.in
@@ -21,7 +21,7 @@
 ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 ### 02111-1307, USA. 
 
-AC_REVISION($Revision: 1.254 $)
+AC_REVISION($Revision: 1.255 $)
 AC_PREREQ(2.9)
 AC_INIT(src/octave.cc)
 AC_CONFIG_HEADER(config.h)
@@ -385,12 +385,19 @@
 CXXPICFLAG=-fPIC
 FPICFLAG=-fPIC
 SHLEXT=so
+SH_LD="$CC"
+SH_LDFLAGS=-shared
 RLD_FLAG=
 case "$canonical_host_type" in
+  *-*-386bsd* | *-*-openbsd* | *-*-netbsd* | *-*-freebsd*)
+    SH_LD=ld
+    SH_LDFLAGS=-Bshareable
+  ;;
   alpha-dec-osf*)
     CPICFLAG=
     CXXPICFLAG=
     FPICFLAG=
+    SH_LDFLAGS="-Xlinker -exepct_unresolved -Xlinker '*'"
     RLD_FLAG='-Xlinker -rpath -Xlinker $(libdir)'
   ;;
 changequote(,)dnl
@@ -449,11 +456,17 @@
 AC_MSG_RESULT([defining CXXPICFLAG to be $CXXPICFLAG])
 AC_MSG_RESULT([defining SHLEXT to be $SHLEXT])
 AC_MSG_RESULT([defining DLFCN_DIR to be $DLFCN_DIR])
+AC_MSG_RESULT([defining SH_LD to be $SH_LD])
+AC_MSG_RESULT([defining SH_LDFLAGS to be $SH_LDFLAGS])
+AC_MSG_RESULT([defining RLD_FLAG to be $RLD_FLAG])
 AC_SUBST(FPICFLAG)
 AC_SUBST(CPICFLAG)
 AC_SUBST(CXXPICFLAG)
 AC_SUBST(SHLEXT)
 AC_SUBST(DLFCN_DIR)
+AC_SUBST(SH_LD)
+AC_SUBST(SH_LDFLAGS)
+AC_SUBST(RLD_FLAG)
 
 ### Allow compilation of smaller kernel.  This only works if some form
 ### of dynamic linking is also supported and used.
@@ -1036,25 +1049,6 @@
 
 AC_PROG_LN_S
 
-### Kluge for SunOS 4.x vs. shared libraries.
-
-SH_LIBS="$LIBS"
-SH_FLIBS="$FLIBS"
-SH_TERMLIBS="$TERMLIBS"
-case "$canonical_host_type" in
-  *-*-sunos4*)
-    SH_LIBS=
-    SH_FLIBS=
-    SH_TERMLIBS=
-  ;;
-esac
-AC_MSG_RESULT([defining SH_LIBS to be $SH_LIBS])
-AC_MSG_RESULT([defining SH_FLIBS to be $SH_FLIBS])
-AC_MSG_RESULT([defining SH_TERMLIBS to be $SH_TERMLIBS])
-AC_SUBST(SH_LIBS)
-AC_SUBST(SH_FLIBS)
-AC_SUBST(SH_TERMLIBS)
-
 AC_CHECK_PROG(RUNTEST, runtest, runtest, [])
 AC_CHECK_PROG(EXPECT, expect, expect, [])
 if test -z "$EXPECT"; then
--- a/kpathsea/ChangeLog
+++ b/kpathsea/ChangeLog
@@ -1,3 +1,11 @@
+Thu Feb 13 17:35:20 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* configure.in: Update config for shared libraries.
+	* Makefile.in (stamp-shared): Use $(SH_LD) $(SH_LDFLAGS) instead
+	of $(CXX) -shared.
+
+	* Makefile.in (stamp-picdir): Silence noise about making pic.
+
 Sat Jan 25 22:33:56 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* Makefile.in (bin-dist): New target.
--- a/kpathsea/Makefile.in
+++ b/kpathsea/Makefile.in
@@ -45,9 +45,18 @@
 default all: stamp-picdir kpsewhich MakeTeXPK kpathsea.info stamp-shared
 
 stamp-picdir:
-	if [ -n "$(CPICFLAG)" ]; then \
-	  if [ -d pic ]; then true; else mkdir pic ; fi ; \
-	else true; fi
+	@if $(SHARED_LIBS); then \
+	  if [ -n "$(CPICFLAG)" ]; then \
+	    if [ -d pic ]; then \
+	      true ; \
+	    else \
+	      echo "mkdir pic" ; \
+	      mkdir pic ; \
+	    fi ; \
+	  else \
+	    true ; \
+	  fi ; \
+	fi
 	touch stamp-picdir
 
 libkpathsea.a: $(objects)
@@ -65,7 +74,7 @@
 
 stamp-shared: $(PICOBJ)
 	if $(SHARED_LIBS); then \
-	  $(CC) -shared -o libkpathsea.$(SHLEXT) $(PICOBJ); \
+	  $(SH_LD) $(SH_LDFLAGS) -o libkpathsea.$(SHLEXT) $(PICOBJ) ; \
 	fi
 	touch stamp-shared
 
--- a/kpathsea/configure.in
+++ b/kpathsea/configure.in
@@ -17,28 +17,34 @@
   SHARED_LIBS=false)
 AC_SUBST(SHARED_LIBS)
 
-if $SHARED_LIBS; then
-  CPICFLAG=-fPIC
-  SHLEXT=so
-  case "$canonical_host_type" in
-    alpha-dec-osf*)
-      CPICFLAG=
-    ;;
-    rs6000-ibm-aix*)
-      CPICFLAG=
-    ;;
-    hppa*-hp-hpux*)
-      SHLEXT=sl
-    ;;
-  esac
-else
-  CPICFLAG=
-  SHLEXT=
-fi
+CPICFLAG=-fPIC
+SHLEXT=so
+SH_LD="$CC"
+SH_LDFLAGS=-shared
+case "$canonical_host_type" in
+  *-*-386bsd* | *-*-openbsd* | *-*-netbsd* | *-*-freebsd*)
+    SH_LD=ld
+    SH_LDFLAGS=-Bshareable
+  ;;
+  alpha-dec-osf*)
+    CPICFLAG=
+    SH_LDFLAGS="-Xlinker -exepct_unresolved -Xlinker '*'"
+  ;;
+  rs6000-ibm-aix* | powerpc-ibm-aix*)
+    CPICFLAG=
+  ;;
+  hppa*-hp-hpux*)
+    SHLEXT=sl
+  ;;
+esac
 AC_MSG_RESULT([defining CPICFLAG to be $CPICFLAG])
 AC_MSG_RESULT([defining SHLEXT to be $SHLEXT])
+AC_MSG_RESULT([defining SH_LD to be $SH_LD])
+AC_MSG_RESULT([defining SH_LDFLAGS to be $SH_LDFLAGS])
 AC_SUBST(CPICFLAG)
 AC_SUBST(SHLEXT)
+AC_SUBST(SH_LD)
+AC_SUBST(SH_LDFLAGS)
 
 sinclude(common.ac)
 
--- a/libcruft/ChangeLog
+++ b/libcruft/ChangeLog
@@ -1,3 +1,10 @@
+Thu Feb 13 17:33:41 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* Makefile.in (stamp-shared): Use $(SH_LD) $(SH_LDFLAGS) instead
+	of $(CXX) -shared.
+
+	* Makerules.in (stamp-picdir): Silence noise about making pic.
+
 Mon Jan 27 15:52:29 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* Version 2.0.2 released.
--- a/libcruft/Makefile.in
+++ b/libcruft/Makefile.in
@@ -69,8 +69,7 @@
 
 stamp-shared: $(CRUFT_PICOBJ)
 	if $(SHARED_LIBS); then \
-	  $(CC) -shared -o libcruft.$(SHLEXT) $(CRUFT_PICOBJ) \
-	    $(SH_FLIBS) -lm ; \
+	  $(SH_LD) $(SH_LDFLAGS) -o libcruft.$(SHLEXT) $(CRUFT_PICOBJ) ; \
 	else \
 	  true ; \
 	fi
--- a/libcruft/Makerules.in
+++ b/libcruft/Makerules.in
@@ -54,11 +54,12 @@
 .PRECIOUS: $(LIBCRUFT_OBJS)
 
 stamp-picdir:
-	if [ "$(SHARED_LIBS)" = true ]; then \
+	@if $(SHARED_LIBS); then \
 	  if [ -n "$(FPICFLAG)" ]; then \
 	    if [ -d pic ]; then \
 	      true ; \
 	    else \
+	      echo "mkdir pic" ; \
 	      mkdir pic ; \
 	    fi ; \
 	  fi ; \
--- a/liboctave/CColVector.cc
+++ b/liboctave/CColVector.cc
@@ -726,18 +726,38 @@
 // other operations
 
 ComplexColumnVector
-map (c_c_Mapper f, const ComplexColumnVector& a)
+ComplexColumnVector::map (c_c_Mapper f) const
 {
-  ComplexColumnVector b (a);
-  b.map (f);
-  return b;
+  ComplexColumnVector b (*this);
+  return b.apply (f);
 }
 
-void
-ComplexColumnVector::map (c_c_Mapper f)
+ColumnVector
+ComplexColumnVector::map (d_c_Mapper f) const
 {
+  const Complex *d = data ();
+
+  int len = length ();
+
+  ColumnVector retval (len);
+
+  double *r = retval.fortran_vec ();
+
+  for (int i = 0; i < len; i++)
+    r[i] = f (d[i]);
+
+  return retval;
+}
+
+ComplexColumnVector&
+ComplexColumnVector::apply (c_c_Mapper f)
+{
+  Complex *d = fortran_vec (); // Ensures only one reference to my privates!
+
   for (int i = 0; i < length (); i++)
-    elem (i) = f (elem (i));
+    d[i] = f (d[i]);
+
+  return *this;
 }
 
 Complex
--- a/liboctave/CColVector.h
+++ b/liboctave/CColVector.h
@@ -172,8 +172,10 @@
 
   // other operations
 
-  friend ComplexColumnVector map (c_c_Mapper f, const ComplexColumnVector& a);
-  void map (c_c_Mapper f);
+  ComplexColumnVector map (c_c_Mapper f) const;
+  ColumnVector map (d_c_Mapper f) const;
+
+  ComplexColumnVector& apply (c_c_Mapper f);
 
   Complex min (void) const;
   Complex max (void) const;
--- a/liboctave/CMatrix.cc
+++ b/liboctave/CMatrix.cc
@@ -2929,19 +2929,36 @@
 // other operations
 
 ComplexMatrix
-map (c_c_Mapper f, const ComplexMatrix& a)
+ComplexMatrix::map (c_c_Mapper f) const
 {
-  ComplexMatrix b (a);
-  b.map (f);
-  return b;
+  ComplexMatrix b (*this);
+  return b.apply (f);
 }
 
-void
-ComplexMatrix::map (c_c_Mapper f)
+Matrix
+ComplexMatrix::map (d_c_Mapper f) const
 {
-  for (int j = 0; j < cols (); j++)
-    for (int i = 0; i < rows (); i++)
-      elem (i, j) = f (elem (i, j));
+  const Complex *d = data ();
+
+  Matrix retval (rows (), columns ());
+
+  double *r = retval.fortran_vec ();
+
+  for (int i = 0; i < length (); i++)
+    r[i] = f (d[i]);
+
+  return retval;
+}
+
+ComplexMatrix&
+ComplexMatrix::apply (c_c_Mapper f)
+{
+  Complex *d = fortran_vec (); // Ensures only one reference to my privates!
+
+  for (int i = 0; i < length (); i++)
+    d[i] = f (d[i]);
+
+  return *this;
 }
 
 bool
--- a/liboctave/CMatrix.h
+++ b/liboctave/CMatrix.h
@@ -317,8 +317,10 @@
 
   // other operations
 
-  friend ComplexMatrix map (c_c_Mapper f, const ComplexMatrix& a);
-  void map (c_c_Mapper f);
+  ComplexMatrix map (c_c_Mapper f) const;
+  Matrix map (d_c_Mapper f) const;
+
+  ComplexMatrix& apply (c_c_Mapper f);
 
   bool any_element_is_inf_or_nan (void) const;
   bool all_elements_are_real (void) const;
--- a/liboctave/CRowVector.cc
+++ b/liboctave/CRowVector.cc
@@ -636,18 +636,38 @@
 // other operations
 
 ComplexRowVector
-map (c_c_Mapper f, const ComplexRowVector& a)
+ComplexRowVector::map (c_c_Mapper f) const
 {
-  ComplexRowVector b (a);
-  b.map (f);
-  return b;
+  ComplexRowVector b (*this);
+  return b.apply (f);
 }
 
-void
-ComplexRowVector::map (c_c_Mapper f)
+RowVector
+ComplexRowVector::map (d_c_Mapper f) const
 {
+  const Complex *d = data ();
+
+  int len = length ();
+
+  RowVector retval (len);
+
+  double *r = retval.fortran_vec ();
+
+  for (int i = 0; i < len; i++)
+    r[i] = f (d[i]);
+
+  return retval;
+}
+
+ComplexRowVector&
+ComplexRowVector::apply (c_c_Mapper f)
+{
+  Complex *d = fortran_vec (); // Ensures only one reference to my privates!
+
   for (int i = 0; i < length (); i++)
-    elem (i) = f (elem (i));
+    d[i] = f (d[i]);
+
+  return *this;
 }
 
 Complex
--- a/liboctave/CRowVector.h
+++ b/liboctave/CRowVector.h
@@ -139,8 +139,10 @@
 
   // other operations
 
-  friend ComplexRowVector map (c_c_Mapper f, const ComplexRowVector& a);
-  void map (c_c_Mapper f);
+  ComplexRowVector map (c_c_Mapper f) const;
+  RowVector map (d_c_Mapper f) const;
+
+  ComplexRowVector& apply (c_c_Mapper f);
 
   Complex min (void) const;
   Complex max (void) const;
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,5 +1,11 @@
 Thu Feb 13 14:35:19 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* Makefile.in (stamp-prereq): Depend on stamp-picdir.
+	(all): Don't depend on stamp-prereq or stamp-picdir.
+	(liboctave.a, stamp-shared): Do depend on stamp-prereq.
+	(stamp-picdir): Silence noise about making pic.
+	(stamp-shared): Use $(SH_LD) $(SH_LDFLAGS) instead of $(CXX) -shared.
+
 	* Array2-idx.h (Array2<T>::index (idx_vector&, idx_vector&)):
 	Fix typo in last change. 
 
--- a/liboctave/Makefile.in
+++ b/liboctave/Makefile.in
@@ -98,18 +98,19 @@
 
 LIBOCTAVE_DEPEND := $(patsubst %, liboctave.a(%), $(OBJECTS))
 
-all: stamp-prereq stamp-picdir liboctave.a stamp-shared
+all: liboctave.a stamp-shared
 .PHONY: all
 
-stamp-prereq: safe-stat.h safe-lstat.h
+stamp-prereq: stamp-picdir safe-stat.h safe-lstat.h
 	touch stamp-prereq
 
 stamp-picdir:
-	if $(SHARED_LIBS); then \
+	@if $(SHARED_LIBS); then \
 	  if [ -n "$(CPICFLAG)" ] || [ -n "$(CXXPICFLAG)" ]; then \
 	    if [ -d pic ]; then \
 	      true ; \
 	    else \
+	      echo "mkdir pic" ; \
 	      mkdir pic ; \
 	    fi ; \
 	  fi ; \
@@ -118,14 +119,13 @@
 	fi
 	touch stamp-picdir
 
-liboctave.a: $(OBJECTS)
+liboctave.a: stamp-prereq $(OBJECTS)
 	$(AR) $(ARFLAGS) liboctave.a $(OBJECTS)
 	$(RANLIB) liboctave.a
 
-stamp-shared: $(PICOBJ)
+stamp-shared: stamp-prereq $(PICOBJ)
 	if $(SHARED_LIBS); then \
-	  $(CXX) -shared -o liboctave.$(SHLEXT) $(PICOBJ) \
-	    $(LIBOCTAVE_LFLAGS) $(LIBOCTAVE_LIBS) ; \
+	  $(SH_LD) $(SH_LDFLAGS) -o liboctave.$(SHLEXT) $(PICOBJ) ; \
 	else \
 	  true ; \
 	fi
--- a/liboctave/chMatrix.h
+++ b/liboctave/chMatrix.h
@@ -201,6 +201,7 @@
 
   friend Matrix map (d_d_Mapper f, const Matrix& a);
   friend Matrix map (d_c_Mapper f, const ComplexMatrix& a);
+
   void map (d_d_Mapper f);
 
   Matrix all (void) const;
--- a/liboctave/dColVector.cc
+++ b/liboctave/dColVector.cc
@@ -282,28 +282,21 @@
 // other operations
 
 ColumnVector
-map (d_d_Mapper f, const ColumnVector& a)
+ColumnVector::map (d_d_Mapper f) const
 {
-  ColumnVector b (a);
-  b.map (f);
-  return b;
+  ColumnVector b (*this);
+  return b.apply (f);
 }
 
-ColumnVector
-map (d_c_Mapper f, const ComplexColumnVector& a)
+ColumnVector&
+ColumnVector::apply (d_d_Mapper f)
 {
-  int a_len = a.length ();
-  ColumnVector b (a_len);
-  for (int i = 0; i < a_len; i++)
-    b.elem (i) = f (a.elem (i));
-  return b;
-}
+  double *d = fortran_vec (); // Ensures only one reference to my privates!
 
-void
-ColumnVector::map (d_d_Mapper f)
-{
   for (int i = 0; i < length (); i++)
-    elem (i) = f (elem (i));
+    d[i] = f (d[i]);
+
+  return *this;
 }
 
 double
--- a/liboctave/dColVector.h
+++ b/liboctave/dColVector.h
@@ -86,9 +86,9 @@
 
   // other operations
 
-  friend ColumnVector map (d_d_Mapper f, const ColumnVector& a);
-  friend ColumnVector map (d_c_Mapper f, const ComplexColumnVector& a);
-  void map (d_d_Mapper f);
+  ColumnVector map (d_d_Mapper f) const;
+
+  ColumnVector& apply (d_d_Mapper f);
 
   double min (void) const;
   double max (void) const;
--- a/liboctave/dMatrix.cc
+++ b/liboctave/dMatrix.cc
@@ -1841,32 +1841,21 @@
 // other operations.
 
 Matrix
-map (d_d_Mapper f, const Matrix& a)
-{
-  Matrix b (a);
-  b.map (f);
-  return b;
-}
-
-Matrix
-map (d_c_Mapper f, const ComplexMatrix& a)
+Matrix::map (d_d_Mapper f) const
 {
-  int a_nc = a.cols ();
-  int a_nr = a.rows ();
-  Matrix b (a_nr, a_nc);
-  for (int j = 0; j < a_nc; j++)
-    for (int i = 0; i < a_nr; i++)
-      b.elem (i, j) = f (a.elem (i, j));
-  return b;
+  Matrix b (*this);
+  return b.apply (f);
 }
 
-void
-Matrix::map (d_d_Mapper f)
+Matrix&
+Matrix::apply (d_d_Mapper f)
 {
   double *d = fortran_vec (); // Ensures only one reference to my privates!
 
   for (int i = 0; i < length (); i++)
     d[i] = f (d[i]);
+
+  return *this;
 }
 
 bool
--- a/liboctave/dMatrix.h
+++ b/liboctave/dMatrix.h
@@ -203,9 +203,9 @@
 
   // other operations
 
-  friend Matrix map (d_d_Mapper f, const Matrix& a);
-  friend Matrix map (d_c_Mapper f, const ComplexMatrix& a);
-  void map (d_d_Mapper f);
+  Matrix map (d_d_Mapper f) const;
+
+  Matrix& apply (d_d_Mapper f);
 
   bool any_element_is_negative (void) const;
   bool any_element_is_inf_or_nan (void) const;
--- a/liboctave/dRowVector.cc
+++ b/liboctave/dRowVector.cc
@@ -255,28 +255,21 @@
 // other operations
 
 RowVector
-map (d_d_Mapper f, const RowVector& a)
+RowVector::map (d_d_Mapper f) const
 {
-  RowVector b (a);
-  b.map (f);
-  return b;
+  RowVector b (*this);
+  return b.apply (f);
 }
 
-RowVector
-map (d_c_Mapper f, const ComplexRowVector& a)
+RowVector&
+RowVector::apply (d_d_Mapper f)
 {
-  int a_len = a.length ();
-  RowVector b (a_len);
-  for (int i = 0; i < a_len; i++)
-    b.elem (i) = f (a.elem (i));
-  return b;
-}
+  double *d = fortran_vec (); // Ensures only one reference to my privates!
 
-void
-RowVector::map (d_d_Mapper f)
-{
   for (int i = 0; i < length (); i++)
-    elem (i) = f (elem (i));
+    d[i] = f (d[i]);
+
+  return *this;
 }
 
 double
--- a/liboctave/dRowVector.h
+++ b/liboctave/dRowVector.h
@@ -81,9 +81,9 @@
 
   // other operations
 
-  friend RowVector map (d_d_Mapper f, const RowVector& a);
-  friend RowVector map (d_c_Mapper f, const ComplexRowVector& a);
-  void map (d_d_Mapper f);
+  RowVector map (d_d_Mapper f) const;
+
+  RowVector& apply (d_d_Mapper f);
 
   double min (void) const;
   double max (void) const;
--- a/octave-bug.in
+++ b/octave-bug.in
@@ -34,6 +34,7 @@
 CXXPICFLAG=%CXXPICFLAG%
 LDFLAGS=%LDFLAGS%
 LIBFLAGS=%LIBFLAGS%
+RLD_FLAG=%RLD_FLAG%
 CXXLIBS=%CXXLIBS%
 TERMLIBS=%TERMLIBS%
 LIBS=%LIBS%
@@ -167,6 +168,7 @@
 CXXPICFLAG:       $CXXPICFLAG
 LDFLAGS:          $LDFLAGS
 LIBFLAGS:         $LIBFLAGS
+RLD_FLAG:         $RLD_FLAG
 CXXLIBS:          $CXXLIBS
 TERMLIBS:         $TERMLIBS
 LIBS:             $LIBS
--- a/readline/ChangeLog
+++ b/readline/ChangeLog
@@ -1,5 +1,15 @@
 Thu Feb 13 13:50:21 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* Makefile.in (stamp-history, stamp-readline): Use $(SH_LD)
+	$(SH_LDFLAGS) instead of $(CXX) -shared.
+
+	* configure.in (SH_TERMLIBS): Delete.
+	Update config for shared libraries.
+
+	* Makefile.in (SH_TERMLIBS): Delete.
+
+	* Makefile.in (stamp-picdir): Silence noise about making pic.
+
 	* configure.in (TERMLIBS): Search in same order as in Octave's
 	top-level configure script.
 
--- a/readline/Makefile.in
+++ b/readline/Makefile.in
@@ -21,7 +21,6 @@
 SHARED_LIBS = @SHARED_LIBS@
 
 TERMLIBS = @TERMLIBS@
-SH_TERMLIBS = @SH_TERMLIBS@
 
 LIBS_TO_INSTALL = libreadline.a libhistory.a
 
@@ -136,9 +135,18 @@
 all: stamp-picdir libreadline.a libhistory.a stamp-readline stamp-history
 
 stamp-picdir:
-	if [ -n "$(CPICFLAG)" ]; then \
-	  if [ -d pic ]; then true; else mkdir pic ; fi ; \
-	else true; fi
+	@if $(SHARED_LIBS); then \
+	  if [ -n "$(CPICFLAG)" ]; then \
+	    if [ -d pic ]; then \
+	      true ; \
+	    else \
+	      echo "mkdir pic" ; \
+	      mkdir pic ; \
+	    fi ; \
+	  else \
+	    true ; \
+	  fi ; \
+	fi
 	touch stamp-picdir
 
 libreadline.a: $(OBJECTS)
@@ -153,13 +161,13 @@
 
 stamp-readline: $(PICOBJ)
 	if $(SHARED_LIBS); then \
-	  $(CC) -shared -o libreadline.$(SHLEXT) $(PICOBJ) $(SH_TERMLIBS); \
+	  $(SH_LD) $(SH_LDFLAGS) -o libreadline.$(SHLEXT) $(PICOBJ) ; \
 	fi
 	touch stamp-readline
 
 stamp-history: $(HIST_PICOBJ)
 	if $(SHARED_LIBS); then \
-	  $(CC) -shared -o libhistory.$(SHLEXT) $(HIST_PICOBJ); \
+	  $(SH_LD) $(SH_LDFLAGS) -o libhistory.$(SHLEXT) $(HIST_PICOBJ); \
 	fi
 	touch stamp-history
 
--- a/readline/configure.in
+++ b/readline/configure.in
@@ -29,28 +29,34 @@
   SHARED_LIBS=false)
 AC_SUBST(SHARED_LIBS)
 
-if $SHARED_LIBS; then
-  CPICFLAG=-fPIC
-  SHLEXT=so
-  case "$canonical_host_type" in
-    alpha-dec-osf*)
-      CPICFLAG=
-    ;;
-    rs6000-ibm-aix*)
-      CPICFLAG=
-    ;;
-    hppa*-hp-hpux*)
-      SHLEXT=sl
-    ;;
-  esac
-else
-  CPICFLAG=
-  SHLEXT=
-fi
+CPICFLAG=-fPIC
+SHLEXT=so
+SH_LD="$CC"
+SH_LDFLAGS=-shared
+case "$canonical_host_type" in
+  *-*-386bsd* | *-*-openbsd* | *-*-netbsd* | *-*-freebsd*)
+    SH_LD=ld
+    SH_LDFLAGS=-Bshareable
+  ;;
+  alpha-dec-osf*)
+    CPICFLAG=
+    SH_LDFLAGS="-Xlinker -exepct_unresolved -Xlinker '*'"
+  ;;
+  rs6000-ibm-aix* | powerpc-ibm-aix*)
+    CPICFLAG=
+  ;;
+  hppa*-hp-hpux*)
+    SHLEXT=sl
+  ;;
+esac
 AC_MSG_RESULT([defining CPICFLAG to be $CPICFLAG])
 AC_MSG_RESULT([defining SHLEXT to be $SHLEXT])
+AC_MSG_RESULT([defining SH_LD to be $SH_LD])
+AC_MSG_RESULT([defining SH_LDFLAGS to be $SH_LDFLAGS])
 AC_SUBST(CPICFLAG)
 AC_SUBST(SHLEXT)
+AC_SUBST(SH_LD)
+AC_SUBST(SH_LDFLAGS)
 
 AC_CONFIG_HEADER(config.h)
 
@@ -72,15 +78,6 @@
 done
 AC_SUBST(TERMLIBS)
 
-SH_TERMLIBS="$TERMLIBS"
-case "$canonical_host_type" in
-  *-*-sunos4*)
-    SH_TERMLIBS=
-  ;;
-esac
-AC_MSG_RESULT([defining SH_TERMLIBS to be $SH_TERMLIBS])
-AC_SUBST(SH_TERMLIBS)
-
 case "$canonical_host_type" in
   *-*-sco*)
     AC_DEFINE(USG, 1)
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,8 @@
+Thu Feb 13 19:06:42 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* image/saveimage.m: Only clip image data that is actually out of
+	range.
+
 Sun Feb  9 19:52:08 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* general/is_matrix.m: Scalars, vectors, and empty matrices may
--- a/scripts/image/saveimage.m
+++ b/scripts/image/saveimage.m
@@ -141,7 +141,7 @@
   img_sz = img_nr * img_nc;
   img = reshape (img, img_sz, 1);
 
-  idx = find (img >= map_nr - 1);
+  idx = find (img > map_nr);
   img (idx) = ones (size (idx)) * map_nr;
 
   idx = find (img <= 0);
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,13 @@
 Thu Feb 13 03:02:08 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* Makefile.in (stamp-prereq): Depend on stamp-picdir.
+	(all): Don't depend on stamp-prereq or stamp-picdir.
+	(stamp-tinst, stamp-interp, libtinst.a, liboctinterp.a):
+	Do depend on stamp-prereq.
+	(stamp-picdir): Silence noise about making pic.
+	(stamp-tinst, stamp-interp): Use $(SH_LD) $(SH_LDFLAGS) instead of
+	$(CXX) -shared.
+
 	* oct-conf.h.in: Reinstate RLD_FLAG.
 	* toplev.cc (octave_config_info): Likewise.
 
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -32,16 +32,10 @@
 ifeq ($(OCTAVE_LITE), true)
   ifdef CXXPICFLAG
     %.oct : pic/%.o
-	  $(CXX) -shared -o $@ $< \
-	    $(OCTAVE_LFLAGS) \
-	    $(OCTAVE_LIBS) \
-	    $(FLIBS) $(LEXLIB) $(TERMLIBS) $(LIBS)
+	  $(CXX) -shared -o $@ $<
   else
     %.oct : %.o
-	  $(CXX) -shared -o $@ $< \
-	    $(OCTAVE_LFLAGS) \
-	    $(OCTAVE_LIBS) \
-	    $(FLIBS) $(LEXLIB) $(TERMLIBS) $(LIBS)
+	  $(CXX) -shared -o $@ $<
   endif
 endif
 
@@ -177,10 +171,10 @@
   BINDISTFILES = octave $(OCT_FILES)
 endif
 
-all: stamp-prereq stamp-picdir libraries $(OCT_FILES) octave
+all: libraries $(OCT_FILES) octave
 .PHONY: all
 
-stamp-prereq: defaults.h oct-conf.h
+stamp-prereq: stamp-picdir defaults.h oct-conf.h
 	touch stamp-prereq
 
 octave: octave.o builtins.o $(DLD_STATIC_OBJ) libraries
@@ -191,11 +185,12 @@
 	$(FLIBS) $(LEXLIB) $(TERMLIBS) $(LIBS)
 
 stamp-picdir:
-	if [ "$(SHARED_LIBS)" = true ] || [ "$(OCTAVE_LITE)" = true ]; then \
+	@if $(SHARED_LIBS) || [ "$(OCTAVE_LITE)" = true ]; then \
 	  if [ -n "$(CPICFLAG)" ] || [ -n "$(CXXPICFLAG)" ]; then \
 	    if [ -d pic ]; then \
 	      true ; \
 	    else \
+	      echo "mkdir pic" ; \
 	      mkdir pic ; \
 	    fi ; \
 	  fi ; \
@@ -206,31 +201,25 @@
 
 libraries: liboctinterp.a libtinst.a stamp-interp stamp-tinst
 
-liboctinterp.a: $(OBJECTS)
+liboctinterp.a: stamp-prereq $(OBJECTS)
 	$(AR) $(ARFLAGS) liboctinterp.a $(OBJECTS)
 	$(RANLIB) liboctinterp.a
 
-libtinst.a: $(TI_OBJ)
+libtinst.a: stamp-prereq $(TI_OBJ)
 	$(AR) $(ARFLAGS) libtinst.a $(TI_OBJ)
 	$(RANLIB) libtinst.a
 
-stamp-interp: $(PICOBJ)
+stamp-interp: stamp-prereq $(PICOBJ)
 	if $(SHARED_LIBS); then \
-	  $(CXX) -shared -o liboctinterp.$(SHLEXT) $(PICOBJ) \
-	    $(OCTAVE_LFLAGS) \
-	    -loctave -lcruft -ltinst -lreadline -lkpathsea \
-	    $(SH_TERMLIBS) $(SH_LIBS) ; \
+	  $(SH_LD) $(SH_LDFLAGS) -o liboctinterp.$(SHLEXT) $(PICOBJ) ; \
 	else \
 	  true ; \
 	fi
 	touch stamp-interp
 
-stamp-tinst: $(TI_PICOBJ)
+stamp-tinst: stamp-prereq $(TI_PICOBJ)
 	if $(SHARED_LIBS); then \
-	  $(CXX) -shared -o libtinst.$(SHLEXT) $(TI_PICOBJ) \
-	    $(OCTAVE_LFLAGS) \
-	    -loctinterp -loctave -lcruft -lreadline -lkpathsea \
-	    $(SH_TERMLIBS) $(SH_LIBS) ; \
+	  $(SH_LD) $(SH_LDFLAGS) -o libtinst.$(SHLEXT) $(TI_PICOBJ) ; \
 	else \
 	  true ; \
 	fi
--- a/src/gripes.cc
+++ b/src/gripes.cc
@@ -125,7 +125,6 @@
 void
 gripe_wrong_type_arg (const char *name, const string& s)
 {
-  string type = tc.type_name ();
   error ("%s: wrong type argument `%s'", name, s.c_str ());
 }