changeset 3690:55e59236c5e5

[project @ 2000-06-30 20:55:36 by jwe]
author jwe
date Fri, 30 Jun 2000 20:57:14 +0000
parents 9143cd2129c4
children dd144c6dfc71
files ChangeLog configure.in doc/interpreter/install.txi libcruft/ChangeLog libcruft/Makefile.in libcruft/blas/xerbla.f libcruft/lapack-xtra/Makefile.in libcruft/lapack-xtra/xdlamch.f libcruft/lapack-xtra/xdlange.f libcruft/lapack-xtra/xzlange.f libcruft/lapack/xdlamch.f libcruft/lapack/xdlange.f libcruft/lapack/xzlange.f scripts/ChangeLog scripts/plot/hist.m src/ChangeLog src/Makefile.in src/dirfns.cc src/octave.cc
diffstat 19 files changed, 210 insertions(+), 73 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2000-06-30  Steven G. Johnson  <stevenj@gil-galad.mit.edu>
+
+	* configure.in: Support for --with-fastblas (ATLAS).
+
 2000-06-29  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* configure.in: Check for long long data type.
--- 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.329 $)
+AC_REVISION($Revision: 1.330 $)
 AC_PREREQ(2.9)
 AC_INIT(src/octave.cc)
 AC_CONFIG_HEADER(config.h)
@@ -509,6 +509,110 @@
 AC_SUBST(F2CFLAGS)
 AC_SUBST_FILE(f77_rules_frag)
 
+# Checks for BLAS and LAPACK libraries:
+
+# subdirectories of libcruft to build if they aren't found on the system:
+BLAS_DIR="blas"
+LAPACK_DIR="lapack"
+AC_SUBST(BLAS_DIR)
+AC_SUBST(LAPACK_DIR)
+
+# names of Fortran dgemm & cheev functions to check for (depends upon
+# F77 compiler name-mangling scheme):
+if test "$octave_cv_f77_uppercase_names" = "yes"; then
+  if test "$octave_cv_f77_append_underscore" = "yes"; then
+    dgemm_func=DGEMM_
+    cheev_func=CHEEV_
+  else
+    dgemm_func=DGEMM
+    cheev_func=CHEEV
+  fi
+else
+  if test "$octave_cv_f77_append_underscore" = "yes"; then
+    dgemm_func=dgemm_
+    cheev_func=cheev_
+  else
+    dgemm_func=dgemm
+    cheev_func=cheev
+  fi
+fi
+
+# remember current libs, so we can check if any libs were found below.
+blas_save_LIBS="$LIBS"
+
+AC_ARG_WITH(fastblas, [  --without-fastblas      use included (generic) BLAS and LAPACK], with_fastblas=$withval, with_fastblas=yes)
+if test "$with_fastblas" = "no"; then
+  blas_save_LIBS="different from $LIBS so tests fail below"
+elif test "$with_fastblas" != "yes"; then
+  # user specified a BLAS library to try on the command line
+  AC_CHECK_LIB($with_fastblas, $dgemm_func, 
+	       LIBS="-l$with_fastblas $LIBS", , $FLIBS)
+fi
+
+if test "$blas_save_LIBS" = "$LIBS"; then
+  # Checks for ATLAS BLAS library:
+  AC_CHECK_LIB(atlas, ATL_xerbla)
+  if test "$blas_save_LIBS" != "$LIBS"; then
+    # check for other atlas libs:
+    AC_CHECK_LIB(cblas, cblas_dgemm)
+    AC_CHECK_LIB(f77blas, $dgemm_func, 
+		 LIBS="-lf77blas $LIBS", , $FLIBS)
+  fi
+fi
+
+if test "$blas_save_LIBS" = "$LIBS"; then
+  # BLAS in Alpha CXML library?
+  AC_CHECK_LIB(cxml, $dgemm_func, LIBS="-lcxml $LIBS", , $FLIBS)
+fi
+
+if test "$blas_save_LIBS" = "$LIBS"; then
+  # BLAS in Alpha DXML library? (now called CXML, see above)
+  AC_CHECK_LIB(dxml, $dgemm_func, LIBS="-ldxml $LIBS", , $FLIBS)
+fi
+
+if test "$blas_save_LIBS" = "$LIBS"; then
+  # Check for BLAS in Sun Performance library:
+  AC_CHECK_LIB(sunmath, acosp)
+  AC_CHECK_LIB(sunperf, $dgemm_func, LIBS="-xlic_lib=sunperf $LIBS")
+fi
+
+if test "$blas_save_LIBS" = "$LIBS"; then
+  # Check for BLAS in SCSL and SGIMATH libraries (prefer SCSL):
+  AC_CHECK_LIB(scs, $dgemm_func,
+               LIBS="-lscs $LIBS", 
+	       AC_CHECK_LIB(complib.sgimath, $dgemm_func,
+			    LIBS="-lcomplib.sgimath $LIBS", , $FLIBS), $FLIBS)
+fi
+
+if test "$blas_save_LIBS" = "$LIBS"; then
+  # Checks for BLAS in IBM ESSL library.  We must also link
+  # with -lblas in this case (ESSL does not include the full BLAS):
+  AC_CHECK_LIB(blas, zherk, 
+	       AC_CHECK_LIB(essl, $dgemm_func, 
+			    LIBS="-lessl -lblas $LIBS", , $FLIBS), , $FLIBS)
+fi
+
+if test "$blas_save_LIBS" = "$LIBS"; then
+  # Finally, check for the generic BLAS library:
+  AC_CHECK_LIB(blas, $dgemm_func, LIBS="-lblas $LIBS", , $FLIBS)
+fi
+
+if test "$blas_save_LIBS" != "$LIBS"; then
+  BLAS_DIR=""  # don't build our own BLAS
+
+# Check for LAPACK library.  Note that ATLAS has its own liblapack.a,
+# which is designed to be combined with the real LAPACK.  cheev is a
+# function in the real LAPACK but not in ATLAS's version, so this
+# (hopefully) insures that we are getting the real LAPACK.  Note also
+# that on some systems, LAPACK is included in the math library
+# (e.g. DXML) that we already linked to above...we detect this by
+# doing AC_CHECK_FUNC if -llapack isn't found:
+
+  AC_CHECK_LIB(lapack, $cheev_func, 
+	       [LIBS="-llapack $LIBS"; LAPACK_DIR=""],
+	       AC_CHECK_FUNC($cheev_func, LAPACK_DIR=""), $FLIBS)
+fi
+
 ### Handle dynamic linking and shared library options.
 
 ### Allow the user to experiment with dynamic linking using dlopen/dlsym.
@@ -1190,7 +1294,8 @@
   libcruft/odepack/Makefile libcruft/ordered-qz/Makefile \
   libcruft/quadpack/Makefile libcruft/ranlib/Makefile \
   libcruft/slatec-fn/Makefile libcruft/slatec-err/Makefile \
-  libcruft/villad/Makefile)
+  libcruft/villad/Makefile \
+  libcruft/blas-xtra/Makefile libcruft/lapack-xtra/Makefile)
 
 AC_OUTPUT_COMMANDS([chmod +x install-octave])
 
--- a/doc/interpreter/install.txi
+++ b/doc/interpreter/install.txi
@@ -54,7 +54,7 @@
 
 @item --enable-shared
 Create shared libraries.  If you are planning to use
-@code{--enable-lite-kernelel} or the dynamic loading features, you will
+@code{--enable-lite-kernel} or the dynamic loading features, you will
 probably want to use this option.  It will make your @file{.oct} files
 much smaller and on some systems it may be necessary to build shared
 libraries in order to use dynamically linked functions.
@@ -84,6 +84,17 @@
 functions @code{dlopen} or @code{shl_load} and friends so that Octave
 can load functions at run time that are not loaded at compile time.
 
+@item --without-fastblas
+Compile and use the generic BLAS and LAPACK versions included with
+Octave.  By default, configure first looks for BLAS and LAPACK matrix
+libraries on your system, including optimized BLAS implementations such
+as the free ATLAS 3.0, as well as vendor-tuned libraries.  (The use of
+an optimized BLAS will generally result in several-times faster matrix
+operations.)  Only use this option if your system has BLAS/LAPACK
+libraries that cause problems for some reason.  You can also use
+@code{--with-fastblas=lib} to specify a particular BLAS library
+@code{-llib} that configure doesn't check for automatically.
+
 @item --help
 Print a summary of the options recognized by the configure script.
 @end table
--- a/libcruft/ChangeLog
+++ b/libcruft/ChangeLog
@@ -1,3 +1,14 @@
+2000-06-30  Steven G. Johnson  <stevenj@gil-galad.mit.edu>
+
+	* blas-xtra, lapack-xtra: New directories.
+	* Makefile.in (CRUFT_DIRS): Add them to the list.
+	Substitute @BLAS_DIR@ and @LAPACK_DIR@ here.
+	* blas-xtra/xerbla.f: Move here from blas subdirectory.
+	* blas-xtra/Makefile.in: New file.
+	* lapack-xtra/xdlamch.f, lapack-xtra/xdlange.f,
+	lapack-xtra/xzlange.f: Move here from lapack subdirectory.
+	* lapack-xtra/Makefile.in: New file.
+
 2000-04-25  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* misc/Makefile.in (install, uninstall): Include files go in
--- a/libcruft/Makefile.in
+++ b/libcruft/Makefile.in
@@ -24,8 +24,13 @@
 # generate a new configure script in the top-level directory (edit
 # configure.in and run autoconf).
 
-CRUFT_DIRS = amos blas dassl fftpack lapack linpack minpack misc odepack \
-	ordered-qz quadpack ranlib slatec-err slatec-fn villad
+# Some of the directories in libcruft may be only optionally built,
+# e.g. if they are already present on the system.  For these, their
+# dirname is substituted by configure and may be the empty string.
+
+CRUFT_DIRS = amos @BLAS_DIR@ blas-xtra dassl fftpack @LAPACK_DIR@ \
+	lapack-xtra linpack minpack misc odepack ordered-qz quadpack \
+	ranlib slatec-err slatec-fn villad
 
 SUBDIRS = $(CRUFT_DIRS)
 
deleted file mode 100644
--- a/libcruft/blas/xerbla.f
+++ /dev/null
@@ -1,43 +0,0 @@
-      SUBROUTINE XERBLA( SRNAME, INFO )
-*
-*  -- LAPACK auxiliary routine (preliminary version) --
-*     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
-*     Courant Institute, Argonne National Lab, and Rice University
-*     February 29, 1992
-*
-*     .. Scalar Arguments ..
-      CHARACTER*6        SRNAME
-      INTEGER            INFO
-*     ..
-*
-*  Purpose
-*  =======
-*
-*  XERBLA  is an error handler for the LAPACK routines.
-*  It is called by an LAPACK routine if an input parameter has an
-*  invalid value.  A message is printed and execution stops.
-*
-*  Installers may consider modifying the STOP statement in order to
-*  call system-specific exception-handling facilities.
-*
-*  Arguments
-*  =========
-*
-*  SRNAME  (input) CHARACTER*6
-*          The name of the routine which called XERBLA.
-*
-*  INFO    (input) INTEGER
-*          The position of the invalid parameter in the parameter list
-*          of the calling routine.
-*
-*
-      WRITE( *, FMT = 9999 )SRNAME, INFO
-*
-      CALL XSTOPX (' ')
-*
- 9999 FORMAT( ' ** On entry to ', A6, ' parameter number ', I2, ' had ',
-     $      'an illegal value' )
-*
-*     End of XERBLA
-*
-      END
new file mode 100644
--- /dev/null
+++ b/libcruft/lapack-xtra/Makefile.in
@@ -0,0 +1,19 @@
+#
+# Makefile for octave's libcruft/lapack-xtra directory
+#
+# John W. Eaton
+# jwe@bevo.che.wisc.edu
+# University of Wisconsin-Madison
+# Department of Chemical Engineering
+
+TOPDIR = ../..
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+
+EXTERNAL_DISTFILES = $(DISTFILES)
+
+include $(TOPDIR)/Makeconf
+
+include ../Makerules
new file mode 100644
--- /dev/null
+++ b/libcruft/lapack-xtra/xdlamch.f
@@ -0,0 +1,6 @@
+	subroutine xdlamch (cmach, retval)
+	character cmach
+	double precision retval, dlamch
+	retval = dlamch (cmach)
+	return
+	end
new file mode 100644
--- /dev/null
+++ b/libcruft/lapack-xtra/xdlange.f
@@ -0,0 +1,7 @@
+      subroutine xdlange (norm, m, n, a, lda, work, retval)
+      character norm
+      integer lda, m, n
+      double precision a (lda, *), work (*), dlange, retval
+      retval = dlange (norm, m, n, a, lda, work)
+      return
+      end
new file mode 100644
--- /dev/null
+++ b/libcruft/lapack-xtra/xzlange.f
@@ -0,0 +1,8 @@
+      subroutine xzlange (norm, m, n, a, lda, work, retval)
+      character norm
+      integer lda, m, n
+      double precision work (*), zlange, retval
+      complex*16 a (lda, *)
+      retval = zlange (norm, m, n, a, lda, work)
+      return
+      end
deleted file mode 100644
--- a/libcruft/lapack/xdlamch.f
+++ /dev/null
@@ -1,6 +0,0 @@
-	subroutine xdlamch (cmach, retval)
-	character cmach
-	double precision retval, dlamch
-	retval = dlamch (cmach)
-	return
-	end
deleted file mode 100644
--- a/libcruft/lapack/xdlange.f
+++ /dev/null
@@ -1,7 +0,0 @@
-      subroutine xdlange (norm, m, n, a, lda, work, retval)
-      character norm
-      integer lda, m, n
-      double precision a (lda, *), work (*), dlange, retval
-      retval = dlange (norm, m, n, a, lda, work)
-      return
-      end
deleted file mode 100644
--- a/libcruft/lapack/xzlange.f
+++ /dev/null
@@ -1,8 +0,0 @@
-      subroutine xzlange (norm, m, n, a, lda, work, retval)
-      character norm
-      integer lda, m, n
-      double precision work (*), zlange, retval
-      complex*16 a (lda, *)
-      retval = zlange (norm, m, n, a, lda, work)
-      return
-      end
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,7 @@
+2000-06-30  Kai Habel  <kahacjde@calvados.zrz.TU-Berlin.DE>
+
+	* plot/hist.m: Allow 3 argument form to work.
+
 2000-06-27  Matthew W. Roberts <matt@lehi.tamu.edu>
 
 	* plot/plot.m: Add examples in doc string.
--- a/scripts/plot/hist.m
+++ b/scripts/plot/hist.m
@@ -45,7 +45,7 @@
 
 function [nn, xx] = hist (y, x, norm)
 
-  if (nargin < 1 || nargin > 2)
+  if (nargin < 1 || nargin > 3)
     usage ("[nn, xx] = hist (y, x, norm)");
   endif
 
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2000-06-30  Steven G. Johnson  <stevenj@gil-galad.mit.edu>
+
+	* Makefile.in (octave): Link $(FLIBS) last.
+	* octave.cc (main): Force our own xerbla to be linked instead of
+	some system version.
+
 2000-06-29  James R. Van Zandt  <jrv@vanzandt.mv.com>
 
 	* load-save.cc (load_save_format): New value, LS_MAT5_BINARY.
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -256,7 +256,7 @@
 	octave.o builtins.o ops.o $(DLD_STATIC_OBJ) \
 	$(OCTAVE_LFLAGS) \
 	$(OCTAVE_LIBS) \
-	$(FLIBS) $(LEXLIB) $(TERMLIBS) $(LIBS)
+	$(LEXLIB) $(TERMLIBS) $(LIBS) $(FLIBS)
 
 stmp-pic: pic
 	@if [ -f stmp-pic ]; then \
--- a/src/dirfns.cc
+++ b/src/dirfns.cc
@@ -416,8 +416,8 @@
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} glob (@var{pattern})\n\
 Given an array of strings in @var{pattern}, return the list of file\n\
-names that any of them, or an empty string if no patterns match.  Tilde\n\
-expansion is performed on each of the patterns before looking for\n\
+names that match any of them, or an empty string if no patterns match.\n\
+Tilde expansion is performed on each of the patterns before looking for\n\
 matching file names.  For example,\n\
 \n\
 @example\n\
--- a/src/octave.cc
+++ b/src/octave.cc
@@ -43,6 +43,7 @@
 #endif
 
 #include "cmd-edit.h"
+#include "f77-fcn.h"
 #include "file-stat.h"
 #include "lo-error.h"
 #include "oct-env.h"
@@ -71,6 +72,9 @@
 #include "variables.h"
 #include <version.h>
 
+// Kluge.
+extern "C" void F77_FCN (xerbla, XERBLA) (const char *, int);
+
 extern void install_builtins (void);
 
 #if !defined (HAVE_ATEXIT) && defined (HAVE_ON_EXIT)
@@ -578,6 +582,17 @@
     retval = 0;
 
   clean_up_and_exit (retval);
+
+  // The following code should never be reached.  It is a hack to make
+  // sure that the xerbla.f from libcruft/blas-xtra is linked with
+  // octave, in preference to the xerbla function from any standard
+  // BLAS that we link to.
+
+  // XXX FIXME XXX -- this may not work on some systems if libcruft
+  // and the external blas libraries are both shared libraries.
+
+  if (retval < 0)
+    F77_FCN (xerbla, XERBLA) ("foobar", 0);
 }
 
 /*