From: Akshay S. <aks...@gm...> - 2012-03-13 07:11:38
|
On 03/13/2012 10:24 AM, Raymond Toy wrote: > This is an automated email from the git hooks/post-receive script. > It was generated because a ref change was pushed to the repository > containing the project "matlisp". > > The branch, master has been updated via > 8a2722a7452cac1de3edd5fc8cc65d97c0d1a0a8 (commit) via > ecab7fc4f75f615eabed198e0e7a325b2c055fd0 (commit) from > 14707c10ced9ee08431313323cc1905ac77e2a21 (commit) > > Those revisions listed above that are new to this repository have > not appeared on any other notification email; so we list those > revisions in full, below. > > - Log > ----------------------------------------------------------------- > commit 8a2722a7452cac1de3edd5fc8cc65d97c0d1a0a8 Author: Raymond > Toy <toy...@gm...> Date: Mon Mar 12 21:54:26 2012 -0700 > > Add wrapper for ZDOTC and ZDOTU to handle the differing possible > Fortran return conventions. Tests pass. Still needs testing for > ATLAS. > > Makefile.am: o Compile and install the new matlisp library. > > configure: o Regenerated > > configure.ac: o Remove checks if we need -ff2c. o Remove check for > ATLAS compatible with f2c conventions. > > lib-src/compat/Makefile.am: o New file to compile and build the > matlisp compat library. > > lib-src/compat/compat.f: o New file adding wrapper functions for > ZDOTU and ZDOTC. > > lib/lazy-loader.lisp.in: o Define and use our libmatlisp > compatibility library for both the standard LAPACK build and for > ATLAS. > > src/blas.lisp: o Comment out old definitions for ZDOTU and ZDOTC. > o Add definitions for our wrapper functions and add new functions > ZDOTU and ZDOTC to call our wrappers. > > diff --git a/Makefile.am b/Makefile.am index 01c9e07..b073e06 > 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,6 +15,7 @@ all : > (cd dfftpack; $(MAKE) install) (cd lib-src/toms715; $(MAKE) > install) (cd lib-src/odepack; $(MAKE) install) + (cd > lib-src/compat; $(MAKE) install) if !ATLAS (cd LAPACK/BLAS/SRC; > $(MAKE) install) (cd LAPACK/SRC; $(MAKE) install) diff --git > a/configure b/configure index 5465828..35ee372 100755 --- > a/configure +++ b/configure @@ -15205,75 +15205,6 @@ else $as_echo > "no" >&6; } fi > > -# Check to see if gfortran needs -ff2c. If needed, this option > forces -# gfortran to be compatible with f2c. This is needed by > matlisp's FFI -# so that it can correctly handle Fortran functions > that return -# complex numbers. With f2c, complex numbers cause a > hidden initial -# parameter that is a pointer to a structure where > the complex result -# is stored. - -if test x"$F77" = x"gfortran"; > then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if > gfortran needs -ff2c for functions returning complex numbers" >&5 > -$as_echo_n "checking if gfortran needs -ff2c for functions > returning complex numbers... " >&6; } - # Just some silly Fortran > function that returns a complex number. - cat > conftest.f <<EOF > - complex*16 function f77_name(x) - complex*16 x - > f77_name = 3*x - return - end -EOF - #echo $F77 $FFLAGS > -c conftest.f - $F77 $FFLAGS -c conftest.f - # A C main routine > that calls the fortran routine. This assumes the - # f2c calling > convention of a hidden result structure. If the real - # part of > the result matches our expectations, then main returns 0 - # (f2c > compatible). Any other exit code means incompatible. - cat > > ctest.c <<EOF -#include <stdio.h> -#include <math.h> - -struct c16 > -{ - double real; - double imag; -}; - - -extern void > ${f77_name}(struct c16* result, struct c16* x); - -int main() -{ - > int rc; - - struct c16 x, y; - - x.real = 1; - x.imag = 2; - - > ${f77_name}(&y, &x); - - if (fabs(y.real - 3) < 1e-5) { - rc = > 0; - } else { - rc = 1; - } - - return rc; -} -EOF - #echo > $CC $CFLAGS -o a.out ctest.c conftest.o $LIBS - $CC $CFLAGS -o > a.out ctest.c conftest.o $LIBS - NEED_FF2C=yes - F2C="-ff2c" - if > a.out; then - NEED_FF2c=no - F2C="" - fi - rm -f ctest.c > a.out - { $as_echo "$as_me:${as_lineno-$LINENO}: result: > $NEED_FF2C" >&5 -$as_echo "$NEED_FF2C" >&6; } -fi > > # Allow user to use ATLAS if available. # We assume the standard > names for the ATLAS libraries. @@ -15305,80 +15236,6 @@ else fi > > > -# Check to see if the ATLAS libraries are compatible with > matlisp's -# ffi. Basically the same test as above that checks to > see if -ff2c -# is needed. We call zdotu which is a Fortran > function returning a -# complex number. Matlisp assumes such > functions return the result by -# storing the answer at address > given by a hidden first parameter to -# the function. - -if test > x"$atlas" = xtrue; then - { $as_echo > "$as_me:${as_lineno-$LINENO}: checking if ATLAS is compatible with > matlisp's FFI" >&5 -$as_echo_n "checking if ATLAS is compatible > with matlisp's FFI... " >&6; } - # From the value of f77_name, > figure out the actual name for - # Fortran's zdotu. - case > $f77_name in - F77*) case $f77_name in - F77_NAME) > ZDOTU="ZDOTU" ;; - F77_NAME_) ZDOTU="ZDOTU_" ;; - > F77_NAME__) ZDOTU="ZDOTU_" ;; - esac - ;; - f77*) case > $f77_name in - f77_name) ZDOTU="zdotu" ;; - f77_name_) > ZDOTU="zdotu_" ;; - f77_name__) ZDOTU="zdotu_" ;; - esac - ;; > - esac - - cat > conftest.c <<EOF - -#include <stdio.h> -#include > <math.h> - -extern void ${ZDOTU}(double *, int *, double *, int *, > double *, int *); - -int main() -{ - int rc; - - int n = 2; - > int incx = 1; - double x[4]; - double out[2]; - x[0] = 1; - > x[1] = 0; - x[2] = 2; - x[3] = 0; - out[0] = 0; - out[1] = 0; - > - ${ZDOTU}(out, &n, x, &incx, x, &incx); - - if (fabs(out[0] - 5) > < 1e-10) { - rc = 0; - } else { - printf("Actual output = %lg, > %lg, instead of 5, 0\n", out[0], out[1]); - rc = 1; - } - - > return rc; -} - -EOF - $CC $CFLAGS -c conftest.c - $F77 $FFLAGS > -o a.out conftest.o -L${ATLAS_DIR} -latlas -lcblas -lf77blas > -llapack - if a.out; then - { $as_echo > "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; > } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" > >&5 -$as_echo "no" >&6; } - as_fn_error $? "ATLAS libraries are > not compatible with matlisp." "$LINENO" 5 - fi -fi - > > > > @@ -15407,7 +15264,7 @@ case $host in *) share_ext=so ;; esac > > -ac_config_files="$ac_config_files matlisp.mk Makefile start.lisp > config.lisp lib/lazy-loader.lisp LAPACK/SRC/Makefile > LAPACK/BLAS/SRC/Makefile dfftpack/Makefile > lib-src/toms715/Makefile lib-src/odepack/Makefile > src/f77-mangling.lisp" +ac_config_files="$ac_config_files > matlisp.mk Makefile start.lisp config.lisp lib/lazy-loader.lisp > LAPACK/SRC/Makefile LAPACK/BLAS/SRC/Makefile dfftpack/Makefile > lib-src/toms715/Makefile lib-src/odepack/Makefile > lib-src/compat/Makefile src/f77-mangling.lisp" > > > echo FLIBS = $FLIBS @@ -16541,6 +16398,7 @@ do > "dfftpack/Makefile") CONFIG_FILES="$CONFIG_FILES dfftpack/Makefile" > ;; "lib-src/toms715/Makefile") CONFIG_FILES="$CONFIG_FILES > lib-src/toms715/Makefile" ;; "lib-src/odepack/Makefile") > CONFIG_FILES="$CONFIG_FILES lib-src/odepack/Makefile" ;; + > "lib-src/compat/Makefile") CONFIG_FILES="$CONFIG_FILES > lib-src/compat/Makefile" ;; "src/f77-mangling.lisp") > CONFIG_FILES="$CONFIG_FILES src/f77-mangling.lisp" ;; > > *) as_fn_error $? "invalid argument: \`$ac_config_target'" > "$LINENO" 5;; diff --git a/configure.ac b/configure.ac index > fad1307..ef543fb 100644 --- a/configure.ac +++ b/configure.ac @@ > -227,74 +227,74 @@ else AC_MSG_RESULT([no]) fi > > -# Check to see if gfortran needs -ff2c. If needed, this option > forces -# gfortran to be compatible with f2c. This is needed by > matlisp's FFI -# so that it can correctly handle Fortran functions > that return -# complex numbers. With f2c, complex numbers cause a > hidden initial -# parameter that is a pointer to a structure where > the complex result -# is stored. - -if test x"$F77" = x"gfortran"; > then - AC_MSG_CHECKING([if gfortran needs -ff2c for functions > returning complex numbers]) - # Just some silly Fortran function > that returns a complex number. - cat > conftest.f <<EOF - > complex*16 function f77_name(x) - complex*16 x - > f77_name = 3*x - return - end -EOF - #echo $F77 $FFLAGS > -c conftest.f - $F77 $FFLAGS -c conftest.f - # A C main routine > that calls the fortran routine. This assumes the - # f2c calling > convention of a hidden result structure. If the real - # part of > the result matches our expectations, then main returns 0 - # (f2c > compatible). Any other exit code means incompatible. - cat > > ctest.c <<EOF -#include <stdio.h> -#include <math.h> - -struct c16 > -{ - double real; - double imag; -}; - - -extern void > ${f77_name}(struct c16* result, struct c16* x); - -int main() -{ - > int rc; - - struct c16 x, y; - - x.real = 1; - x.imag = 2; - - > ${f77_name}(&y, &x); - - if (fabs(y.real - 3) < 1e-5) { - rc = > 0; - } else { - rc = 1; - } - - return rc; -} -EOF - #echo > $CC $CFLAGS -o a.out ctest.c conftest.o $LIBS - $CC $CFLAGS -o > a.out ctest.c conftest.o $LIBS - NEED_FF2C=yes - F2C="-ff2c" - if > a.out; then - NEED_FF2c=no - F2C="" - fi - rm -f ctest.c > a.out - AC_MSG_RESULT([$NEED_FF2C]) -fi - +dnl # Check to see if > gfortran needs -ff2c. If needed, this option forces +dnl # > gfortran to be compatible with f2c. This is needed by matlisp's > FFI +dnl # so that it can correctly handle Fortran functions that > return +dnl # complex numbers. With f2c, complex numbers cause a > hidden initial +dnl # parameter that is a pointer to a structure > where the complex result +dnl # is stored. + +dnl if test x"$F77" > = x"gfortran"; then +dnl AC_MSG_CHECKING([if gfortran needs > -ff2c for functions returning complex numbers]) +dnl # Just some > silly Fortran function that returns a complex number. +dnl cat > > conftest.f <<EOF +dnl complex*16 function f77_name(x) +dnl > complex*16 x +dnl f77_name = 3*x +dnl return +dnl end > +dnl EOF +dnl #echo $F77 $FFLAGS -c conftest.f +dnl $F77 > $FFLAGS -c conftest.f +dnl # A C main routine that calls the > fortran routine. This assumes the +dnl # f2c calling convention > of a hidden result structure. If the real +dnl # part of the > result matches our expectations, then main returns 0 +dnl # (f2c > compatible). Any other exit code means incompatible. +dnl cat > > ctest.c <<EOF +dnl #include <stdio.h> +dnl #include <math.h> +dnl > +dnl struct c16 +dnl { +dnl double real; +dnl double imag; > +dnl }; +dnl +dnl +dnl extern void ${f77_name}(struct c16* result, > struct c16* x); +dnl +dnl int main() +dnl { +dnl int rc; +dnl > +dnl struct c16 x, y; +dnl +dnl x.real = 1; +dnl x.imag = 2; > +dnl +dnl ${f77_name}(&y, &x); +dnl +dnl if (fabs(y.real - 3) > < 1e-5) { +dnl rc = 0; +dnl } else { +dnl rc = 1; +dnl > } +dnl +dnl return rc; +dnl } +dnl EOF +dnl #echo $CC $CFLAGS > -o a.out ctest.c conftest.o $LIBS +dnl $CC $CFLAGS -o a.out > ctest.c conftest.o $LIBS +dnl NEED_FF2C=yes +dnl F2C="-ff2c" > +dnl if a.out; then +dnl NEED_FF2c=no +dnl F2C="" +dnl > fi +dnl rm -f ctest.c a.out +dnl AC_MSG_RESULT([$NEED_FF2C]) +dnl > fi +dnl # Allow user to use ATLAS if available. # We assume the > standard names for the ATLAS libraries. AC_ARG_WITH([atlas], @@ > -314,77 +314,77 @@ AC_HELP_STRING([--with-atlas=libpath], [Location > of the ATLAS libraries]), ]) AM_CONDITIONAL([ATLAS], [test x$atlas > = xtrue]) > > -# Check to see if the ATLAS libraries are compatible with > matlisp's -# ffi. Basically the same test as above that checks to > see if -ff2c -# is needed. We call zdotu which is a Fortran > function returning a -# complex number. Matlisp assumes such > functions return the result by -# storing the answer at address > given by a hidden first parameter to -# the function. - -if test > x"$atlas" = xtrue; then - AC_MSG_CHECKING([if ATLAS is compatible > with matlisp's FFI]) - # From the value of f77_name, figure out > the actual name for - # Fortran's zdotu. - case $f77_name in - > F77*) case $f77_name in - F77_NAME) ZDOTU="ZDOTU" ;; - > F77_NAME_) ZDOTU="ZDOTU_" ;; - F77_NAME__) ZDOTU="ZDOTU_" ;; - > esac - ;; - f77*) case $f77_name in - f77_name) > ZDOTU="zdotu" ;; - f77_name_) ZDOTU="zdotu_" ;; - f77_name__) > ZDOTU="zdotu_" ;; - esac - ;; - esac - - cat > conftest.c > <<EOF -[ -#include <stdio.h> -#include <math.h> - -extern void > ${ZDOTU}(double *, int *, double *, int *, double *, int *); - -int > main() -{ - int rc; - - int n = 2; - int incx = 1; - double > x[4]; - double out[2]; - x[0] = 1; - x[1] = 0; - x[2] = 2; - > x[3] = 0; - out[0] = 0; - out[1] = 0; - - ${ZDOTU}(out, &n, x, > &incx, x, &incx); - - if (fabs(out[0] - 5) < 1e-10) { - rc = 0; > - } else { - printf("Actual output = %lg, %lg, instead of 5, > 0\n", out[0], out[1]); - rc = 1; - } - - return rc; -} -] -EOF > - $CC $CFLAGS -c conftest.c - $F77 $FFLAGS -o a.out conftest.o > -L${ATLAS_DIR} -latlas -lcblas -lf77blas -llapack - if a.out; then > - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - > AC_MSG_ERROR([ATLAS libraries are not compatible with matlisp.]) - > fi -fi - +dnl # Check to see if the ATLAS libraries are compatible > with matlisp's +dnl # ffi. Basically the same test as above that > checks to see if -ff2c +dnl # is needed. We call zdotu which is a > Fortran function returning a +dnl # complex number. Matlisp > assumes such functions return the result by +dnl # storing the > answer at address given by a hidden first parameter to +dnl # the > function. +dnl +dnl if test x"$atlas" = xtrue; then +dnl > AC_MSG_CHECKING([if ATLAS is compatible with matlisp's FFI]) +dnl > # From the value of f77_name, figure out the actual name for +dnl > # Fortran's zdotu. +dnl case $f77_name in +dnl F77*) case > $f77_name in +dnl F77_NAME) ZDOTU="ZDOTU" ;; +dnl > F77_NAME_) ZDOTU="ZDOTU_" ;; +dnl F77_NAME__) ZDOTU="ZDOTU_" > ;; +dnl esac +dnl ;; +dnl f77*) case $f77_name in +dnl > f77_name) ZDOTU="zdotu" ;; +dnl f77_name_) ZDOTU="zdotu_" ;; +dnl > f77_name__) ZDOTU="zdotu_" ;; +dnl esac +dnl ;; +dnl esac > +dnl +dnl cat > conftest.c <<EOF +dnl [ +dnl #include <stdio.h> > +dnl #include <math.h> +dnl +dnl extern void ${ZDOTU}(double *, int > *, double *, int *, double *, int *); +dnl +dnl int main() +dnl { > +dnl int rc; +dnl +dnl int n = 2; +dnl int incx = 1; +dnl > double x[4]; +dnl double out[2]; +dnl x[0] = 1; +dnl x[1] = > 0; +dnl x[2] = 2; +dnl x[3] = 0; +dnl out[0] = 0; +dnl out[1] > = 0; +dnl +dnl ${ZDOTU}(out, &n, x, &incx, x, &incx); +dnl +dnl > if (fabs(out[0] - 5) < 1e-10) { +dnl rc = 0; +dnl } else { > +dnl printf("Actual output = %lg, %lg, instead of 5, 0\n", out[0], > out[1]); +dnl rc = 1; +dnl } +dnl +dnl return rc; +dnl } > +dnl ] +dnl EOF +dnl $CC $CFLAGS -c conftest.c +dnl $F77 > $FFLAGS -o a.out conftest.o -L${ATLAS_DIR} -latlas -lcblas > -lf77blas -llapack +dnl if a.out; then +dnl AC_MSG_RESULT([yes]) > +dnl else +dnl AC_MSG_RESULT([no]) +dnl AC_MSG_ERROR([ATLAS > libraries are not compatible with matlisp.]) +dnl fi +dnl fi +dnl > dnl The following variables will be substituted into the .in files > AC_SUBST(LISPEXEC) AC_SUBST(BLAS_OBJS) @@ -404,7 +404,7 @@ > AC_SUBST(FLIBS_OPTS) AC_SUBST(share_ext) AC_SUBST(GIT_VERSION) > AC_SUBST(HAVE_QL) -AC_SUBST(F2C) +dnl AC_SUBST(F2C) > > echo host = $host > > @@ -425,6 +425,7 @@ AC_CONFIG_FILES([ dfftpack/Makefile > lib-src/toms715/Makefile lib-src/odepack/Makefile + > lib-src/compat/Makefile src/f77-mangling.lisp ]) > > diff --git a/lib-src/compat/Makefile.am > b/lib-src/compat/Makefile.am new file mode 100644 index > 0000000..afa1180 --- /dev/null +++ b/lib-src/compat/Makefile.am @@ > -0,0 +1,12 @@ +lib_LTLIBRARIES = libmatlisp.la + +AM_FFLAGS = > $(F2C) +if LIB32 +AM_FFLAGS += -m32 +endif + > +libmatlisp_la_LDFLAGS = ../../LAPACK/BLAS/SRC/libblas.la > $(FLIBS_OPTS) +libmatlisp_la_LIBADD = $(FLIBS) + > +libmatlisp_la_SOURCES = \ +compat.f diff --git > a/lib-src/compat/compat.f b/lib-src/compat/compat.f new file mode > 100644 index 0000000..a4aabd5 --- /dev/null +++ > b/lib-src/compat/compat.f @@ -0,0 +1,34 @@ +c Compatibility > routines for Matlisp. +c +c Fortran compilers differ on how a > function returns a complex +c result. A compiler compatible with > f2c will add a hidden first +c parameter where the result of the > function will be stored. Other +c compilers will use the > standard C structure return convention. +c +c Currently there > are two BLAS functions the return complex numbers: +c ZDOTC and > ZDOTU. + +c We don't want to deal with this difference in > Matlisp, so we +c define the following wrapper functions to > call the real BLAS +c routines using whatever the default > convention is and then return +c the result in the first > argument to routine. + subroutine mzdotc(result, n, x, incx, y, > incy) + complex*16 result + complex*16 x(*), y(*) + > integer n, incx, incy + external zdotc + complex*16 zdotc + > result = zdotc(n, x, incx, y, incy) + return + end + + > subroutine mzdotu(result, n, x, incx, y, incy) + complex*16 > result + complex*16 x(*), y(*) + integer n, incx, incy + > external zdotu + complex*16 zdotu + result = zdotu(n, x, > incx, y, incy) + return + end + diff --git > a/lib/lazy-loader.lisp.in b/lib/lazy-loader.lisp.in index > 7df2449..d558183 100644 --- a/lib/lazy-loader.lisp.in +++ > b/lib/lazy-loader.lisp.in @@ -137,6 +137,10 @@ (:darwin > "libodepack.dylib") (t (:default "@libdir@/libodepack"))) > > +(cffi:define-foreign-library matlisp + (:darwin > "libmatlisp.dylib") + (t (:default "@libdir@/libmatlisp"))) + (if > @ATLAS_P@ (progn ;; Define the ATLAS libraries and their locations. > @@ -172,9 +176,11 @@ (cffi:use-foreign-library cblas) > (cffi:use-foreign-library f77blas) (cffi:use-foreign-library > lapack) + (cffi:use-foreign-library matlisp) ) (t > (cffi:use-foreign-library blas) + (cffi:use-foreign-library > matlisp) (cffi:use-foreign-library lapack)))) > > #+:allegro diff --git a/src/blas.lisp b/src/blas.lisp index > 827ab13..18c22d1 100644 --- a/src/blas.lisp +++ b/src/blas.lisp @@ > -451,6 +451,7 @@ (incy :integer :input) ) > > +#-(and) (def-fortran-routine zdotu :complex-double-float " Syntax > @@ -494,7 +495,24 @@ (incy :integer :input) ) > > +(def-fortran-routine mzdotu :void + (result (* > :complex-double-float) :output) + (n :integer :input) + (zx (* > :complex-double-float) :input) + (incx :integer :input) + (zy (* > :complex-double-float) :input) + (incy :integer :input) + ) > > +(defun zdotu (n zx incx zy incy) + (let ((result (make-array 2 > :element-type 'double-float))) + (with-vector-data-addresses > ((addr-result result) + (addr-zx zx) + (addr-zy zy)) + > (mzdotu addr-result n addr-zx incx addr-zy incy) + (complex > (aref result 0) (aref result 1))))) + +#-(and) > (def-fortran-routine zdotc :complex-double-float " Syntax @@ -537,6 > +555,24 @@ (incy :integer :input) ) > > +(def-fortran-routine mzdotc :void + (result (* > :complex-double-float) :output) + (n :integer :input) + (zx (* > :complex-double-float) :input) + (incx :integer :input) + (zy (* > :complex-double-float) :input) + (incy :integer :input) + ) + > +(defun zdotc (n zx incx zy incy) + (let ((result (make-array 2 > :element-type 'double-float))) + (with-vector-data-addresses > ((addr-result result) + (addr-zx zx) + (addr-zy zy)) + > (mzdotc addr-result n addr-zx incx addr-zy incy) + (complex > (aref result 0) (aref result 1))))) + + #| (declaim (inline > fortran-daxpy)) (def-alien-routine ("daxpy_" fortran-daxpy) void > > commit ecab7fc4f75f615eabed198e0e7a325b2c055fd0 Author: Raymond > Toy <toy...@gm...> Date: Sun Mar 11 10:56:12 2012 -0700 > > Regenerated. > > diff --git a/configure b/configure index 0f6e275..5465828 100755 > --- a/configure +++ b/configure @@ -615,8 +615,6 @@ > ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS > -ATLAS_FALSE -ATLAS_TRUE F2C HAVE_QL GIT_VERSION @@ -634,6 +632,8 > @@ ATLAS_DIR NO_ATLAS_LAPACK_OBJS BLAS_OBJS LISPEXEC +ATLAS_FALSE > +ATLAS_TRUE LIB32_FALSE LIB32_TRUE CPP @@ -4664,7 +4664,10 @@ > ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS > conftest.$ac_ext $LIBS >&5' > ac_compiler_gnu=$ac_cv_f77_compiler_gnu > > > -# Setup our environment variables based on the value of f77_name > +# Setup our environment variables based on the value of f77_name. > For +# the record, F77_EXTRA_UNDERSCORE means that any embedded > underscores +# in the Fortran name are converted to two > underscores for the C +# equivalent name. F77_LOWER_CASE=t > F77_UNDERSCORE=t F77_EXTRA_UNDERSCORE=nil @@ -15155,7 +15158,8 @@ > FLIBS_OPTS=`echo $FLIBS | tr -s ' ' '\n' | $GREP -v gfortranbegin | > $GREP -v x86 > > GIT_VERSION=`git describe --dirty` > > -# Check that quicklisp exists. We need that currently to get > cffi. +# Check that quicklisp exists. We need that currently to > get cffi if +# it's not already available. as_ac_File=`$as_echo > "ac_cv_file_$HOME/quicklisp/setup.lisp" | $as_tr_sh` { $as_echo > "$as_me:${as_lineno-$LINENO}: checking for > $HOME/quicklisp/setup.lisp" >&5 $as_echo_n "checking for > $HOME/quicklisp/setup.lisp... " >&6; } @@ -15271,37 +15275,6 @@ EOF > $as_echo "$NEED_FF2C" >&6; } fi > > - - - - - - - - - - - - - - - - - - - - -echo host = $host - -# > Set the extension for shared libraries. This is not very robust. > -case $host in - *darwin*) share_ext=dylib ;; - *) share_ext=so > ;; -esac - -ac_config_files="$ac_config_files matlisp.mk Makefile > start.lisp config.lisp lib/lazy-loader.lisp LAPACK/SRC/Makefile > LAPACK/BLAS/SRC/Makefile dfftpack/Makefile > lib-src/toms715/Makefile lib-src/odepack/Makefile > src/f77-mangling.lisp" - - # Allow user to use ATLAS if available. > # We assume the standard names for the ATLAS libraries. > > @@ -15334,7 +15307,10 @@ fi > > # Check to see if the ATLAS libraries are compatible with matlisp's > # ffi. Basically the same test as above that checks to see if > -ff2c -# is needed. +# is needed. We call zdotu which is a Fortran > function returning a +# complex number. Matlisp assumes such > functions return the result by +# storing the answer at address > given by a hidden first parameter to +# the function. > > if test x"$atlas" = xtrue; then { $as_echo > "$as_me:${as_lineno-$LINENO}: checking if ATLAS is compatible with > matlisp's FFI" >&5 @@ -15345,13 +15321,13 @@ $as_echo_n "checking > if ATLAS is compatible with matlisp's FFI... " >&6; } F77*) case > $f77_name in F77_NAME) ZDOTU="ZDOTU" ;; F77_NAME_) ZDOTU="ZDOTU_" > ;; - F77_NAME__) ZDOTU="ZDOTU__" ;; + F77_NAME__) > ZDOTU="ZDOTU_" ;; esac ;; f77*) case $f77_name in f77_name) > ZDOTU="zdotu" ;; f77_name_) ZDOTU="zdotu_" ;; - f77_name__) > ZDOTU="zdotu__" ;; + f77_name__) ZDOTU="zdotu_" ;; esac ;; esac > @@ -15383,6 +15359,7 @@ int main() if (fabs(out[0] - 5) < 1e-10) { > rc = 0; } else { + printf("Actual output = %lg, %lg, instead of > 5, 0\n", out[0], out[1]); rc = 1; } > > @@ -15402,6 +15379,37 @@ $as_echo "no" >&6; } fi fi > > + + + + + + + + + + + + + + + + + + + + +echo host = $host + +# > Set the extension for shared libraries. This is not very robust. > +case $host in + *darwin*) share_ext=dylib ;; + *) share_ext=so > ;; +esac + +ac_config_files="$ac_config_files matlisp.mk Makefile > start.lisp config.lisp lib/lazy-loader.lisp LAPACK/SRC/Makefile > LAPACK/BLAS/SRC/Makefile dfftpack/Makefile > lib-src/toms715/Makefile lib-src/odepack/Makefile > src/f77-mangling.lisp" + + echo FLIBS = $FLIBS echo HAVE_QL = > $HAVE_QL cat >confcache <<\_ACEOF > > ----------------------------------------------------------------------- > > > Summary of changes: Makefile.am | 1 + configure > | 198 +++++-------------------------- configure.ac > | 281 ++++++++++++++++++++++---------------------- > lib-src/compat/Makefile.am | 12 ++ lib-src/compat/compat.f | > 34 ++++++ lib/lazy-loader.lisp.in | 6 + src/blas.lisp | 36 > ++++++ 7 files changed, 262 insertions(+), 306 deletions(-) create > mode 100644 lib-src/compat/Makefile.am create mode 100644 > lib-src/compat/compat.f > > > hooks/post-receive I tried doing something similar earlier, but my initial attempt threw up some odd stuff. For some odd reason compiling the F77 wrapper with -ff2c and linking this with ATLAS works, but throws up a segfault when linked with the BLAS compiled by Matlisp (with -ff2c) (?). Akshay |