Mercurial > hg > octave-nkf
changeset 19493:9f83ea3fa48c
maint: Periodic merge of gui-release to default.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 03 Nov 2014 22:40:45 -0800 |
parents | 5537c582416b (current diff) d6240c099a02 (diff) |
children | e433efa383e4 |
files | doc/interpreter/install.txi scripts/io/importdata.m |
diffstat | 5 files changed, 189 insertions(+), 115 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/interpreter/install.txi +++ b/doc/interpreter/install.txi @@ -728,6 +728,16 @@ @noindent Other systems may require a different solution. +@item @sc{arpack} (http://forge.scilab.org/index.php/p/arpack-ng/) + +@itemize @minus +@item Add @option{-fdefault-integer-8} to @env{FFLAGS} when running configure. + +@item Run @code{make} to build the library. + +@item Run @code{make install} to install the library. +@end itemize + @item ATLAS instead of reference @sc{blas} and @sc{lapack} Suggestions on how to compile ATLAS would be most welcome.
--- a/m4/ax_blas.m4 +++ b/m4/ax_blas.m4 @@ -63,12 +63,13 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 12 +#serial 14 AU_ALIAS([ACX_BLAS], [AX_BLAS]) AC_DEFUN([AX_BLAS], [ AC_PREREQ(2.50) AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS]) +AC_REQUIRE([AC_CANONICAL_HOST]) ax_blas_ok=no AC_ARG_WITH(blas, @@ -107,6 +108,12 @@ LIBS="$save_LIBS" fi +# BLAS in OpenBLAS library? (http://xianyi.github.com/OpenBLAS/) +if test $ax_blas_ok = no; then + AC_CHECK_LIB(openblas, $sgemm, [ax_blas_ok=yes + BLAS_LIBS="-lopenblas"]) +fi + # BLAS in ATLAS library? (http://math-atlas.sourceforge.net/) if test $ax_blas_ok = no; then AC_CHECK_LIB(atlas, ATL_xerbla, @@ -130,6 +137,36 @@ # BLAS in Intel MKL library? if test $ax_blas_ok = no; then + # MKL for gfortran + if test x"$ac_cv_fc_compiler_gnu" = xyes; then + # 64 bit + if test $host_cpu = x86_64; then + AC_CHECK_LIB(mkl_gf_lp64, $sgemm, + [ax_blas_ok=yes;BLAS_LIBS="-lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lpthread"],, + [-lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lpthread]) + # 32 bit + elif test $host_cpu = i686; then + AC_CHECK_LIB(mkl_gf, $sgemm, + [ax_blas_ok=yes;BLAS_LIBS="-lmkl_gf -lmkl_sequential -lmkl_core -lpthread"],, + [-lmkl_gf -lmkl_sequential -lmkl_core -lpthread]) + fi + # MKL for other compilers (Intel, PGI, ...?) + else + # 64-bit + if test $host_cpu = x86_64; then + AC_CHECK_LIB(mkl_intel_lp64, $sgemm, + [ax_blas_ok=yes;BLAS_LIBS="-lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread"],, + [-lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread]) + # 32-bit + elif test $host_cpu = i686; then + AC_CHECK_LIB(mkl_intel, $sgemm, + [ax_blas_ok=yes;BLAS_LIBS="-lmkl_intel -lmkl_sequential -lmkl_core -lpthread"],, + [-lmkl_intel -lmkl_sequential -lmkl_core -lpthread]) + fi + fi +fi +# Old versions of MKL +if test $ax_blas_ok = no; then AC_CHECK_LIB(mkl, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-lmkl -lguide -lpthread"],,[-lguide -lpthread]) fi
--- a/m4/ax_blas_f77_func.m4 +++ b/m4/ax_blas_f77_func.m4 @@ -55,21 +55,20 @@ #serial 8 AU_ALIAS([ACX_BLAS_F77_FUNC], [AX_BLAS_F77_FUNC]) - AC_DEFUN([AX_BLAS_F77_FUNC], [ - AC_PREREQ(2.50) - AC_REQUIRE([AX_BLAS]) +AC_PREREQ(2.50) +AC_REQUIRE([AX_BLAS]) - ## F77 call-compatibility checks - if test "$cross_compiling" = yes ; then - ifelse($3, ,$1,$3) - elif test x"$ax_blas_ok" = xyes; then - save_ax_blas_f77_func_LIBS="$LIBS" - LIBS="$BLAS_LIBS $LIBS" - AC_LANG_PUSH(Fortran 77) - ## LSAME check (LOGICAL return values) - AC_MSG_CHECKING([whether LSAME is called correctly from Fortran]) - AC_RUN_IFELSE([AC_LANG_PROGRAM([], [[ +# F77 call-compatibility checks +if test "$cross_compiling" = yes ; then + ifelse($3, ,$1,$3) +elif test x"$ax_blas_ok" = xyes; then + save_ax_blas_f77_func_LIBS="$LIBS" + LIBS="$BLAS_LIBS $LIBS" + AC_LANG_PUSH(Fortran 77) +# LSAME check (LOGICAL return values) + AC_MSG_CHECKING([whether LSAME is called correctly from Fortran]) + AC_RUN_IFELSE(AC_LANG_PROGRAM(,[[ logical lsame,w external lsame character c1,c2 @@ -79,13 +78,12 @@ if (w) stop 1 w = lsame(c1,c1) if (.not. w) stop 1 - ]])], - [ax_blas_lsame_fcall_ok=yes], - [ax_blas_lsame_fcall_ok=no]) - AC_MSG_RESULT([$ax_blas_lsame_fcall_ok]) - ## ISAMAX check (INTEGER return values) - AC_MSG_CHECKING([whether ISAMAX is called correctly from Fortran]) - AC_RUN_IFELSE([AC_LANG_PROGRAM([], [[ + ]]),[ax_blas_lsame_fcall_ok=yes], + [ax_blas_lsame_fcall_ok=no]) + AC_MSG_RESULT([$ax_blas_lsame_fcall_ok]) +# ISAMAX check (INTEGER return values) + AC_MSG_CHECKING([whether ISAMAX is called correctly from Fortran]) + AC_RUN_IFELSE(AC_LANG_PROGRAM(,[[ integer isamax,i external isamax real a(2) @@ -93,73 +91,68 @@ a(2) = -2e0 i = isamax(2,a,1) if (i.ne.2) stop 1 - ]])], - [ax_blas_isamax_fcall_ok=yes], - [ax_blas_isamax_fcall_ok=no]) - AC_MSG_RESULT([$ax_blas_isamax_fcall_ok]) - ## SDOT check (REAL return values) - AC_MSG_CHECKING([whether SDOT is called correctly from Fortran]) - AC_RUN_IFELSE([AC_LANG_PROGRAM([], [[ + ]]),[ax_blas_isamax_fcall_ok=yes], + [ax_blas_isamax_fcall_ok=no]) + AC_MSG_RESULT([$ax_blas_isamax_fcall_ok]) +# SDOT check (REAL return values) + AC_MSG_CHECKING([whether SDOT is called correctly from Fortran]) + AC_RUN_IFELSE(AC_LANG_PROGRAM(,[[ real sdot,a(1),b(1),w external sdot a(1) = 1e0 b(1) = 2e0 w = sdot(1,a,1,b,1) if (w .ne. a(1)*b(1)) stop 1 - ]])], - [ax_blas_sdot_fcall_ok=yes], - [ax_blas_sdot_fcall_ok=no]) - AC_MSG_RESULT([$ax_blas_sdot_fcall_ok]) - ## DDOT check (DOUBLE return values) - AC_MSG_CHECKING([whether DDOT is called correctly from Fortran]) - AC_RUN_IFELSE([AC_LANG_PROGRAM([], [[ + ]]),[ax_blas_sdot_fcall_ok=yes], + [ax_blas_sdot_fcall_ok=no]) + AC_MSG_RESULT([$ax_blas_sdot_fcall_ok]) +# DDOT check (DOUBLE return values) + AC_MSG_CHECKING([whether DDOT is called correctly from Fortran]) + AC_RUN_IFELSE(AC_LANG_PROGRAM(,[[ double precision ddot,a(1),b(1),w external ddot a(1) = 1d0 b(1) = 2d0 w = ddot(1,a,1,b,1) if (w .ne. a(1)*b(1)) stop 1 - ]])], - [ax_blas_ddot_fcall_ok=yes], - [ax_blas_ddot_fcall_ok=no]) - AC_MSG_RESULT([$ax_blas_ddot_fcall_ok]) - ## CDOTU check (COMPLEX return values) - AC_MSG_CHECKING([whether CDOTU is called correctly from Fortran]) - AC_RUN_IFELSE([AC_LANG_PROGRAM([], [[ + ]]),[ax_blas_ddot_fcall_ok=yes], + [ax_blas_ddot_fcall_ok=no]) + AC_MSG_RESULT([$ax_blas_ddot_fcall_ok]) +# CDOTU check (COMPLEX return values) + AC_MSG_CHECKING([whether CDOTU is called correctly from Fortran]) + AC_RUN_IFELSE(AC_LANG_PROGRAM(,[[ complex cdotu,a(1),b(1),w external cdotu a(1) = cmplx(1e0,1e0) b(1) = cmplx(1e0,2e0) w = cdotu(1,a,1,b,1) if (w .ne. a(1)*b(1)) stop 1 - ]])], - [ax_blas_cdotu_fcall_ok=yes], - [ax_blas_cdotu_fcall_ok=no]) - AC_MSG_RESULT([$ax_blas_cdotu_fcall_ok]) - ## ZDOTU check (DOUBLE COMPLEX return values) - AC_MSG_CHECKING([whether ZDOTU is called correctly from Fortran]) - AC_RUN_IFELSE([AC_LANG_PROGRAM([], [[ + ]]),[ax_blas_cdotu_fcall_ok=yes], + [ax_blas_cdotu_fcall_ok=no]) + AC_MSG_RESULT([$ax_blas_cdotu_fcall_ok]) +# ZDOTU check (DOUBLE COMPLEX return values) + AC_MSG_CHECKING([whether ZDOTU is called correctly from Fortran]) + AC_RUN_IFELSE(AC_LANG_PROGRAM(,[[ double complex zdotu,a(1),b(1),w external zdotu a(1) = dcmplx(1d0,1d0) b(1) = dcmplx(1d0,2d0) w = zdotu(1,a,1,b,1) if (w .ne. a(1)*b(1)) stop 1 - ]])], - [ax_blas_zdotu_fcall_ok=yes], - [ax_blas_zdotu_fcall_ok=no]) - AC_MSG_RESULT([$ax_blas_zdotu_fcall_ok]) - ## Check for correct integer size - ## FIXME: this may fail with things like -ftrapping-math. - AC_MSG_CHECKING([whether the integer size is correct]) - AC_RUN_IFELSE([AC_LANG_PROGRAM([], [[ + ]]),[ax_blas_zdotu_fcall_ok=yes], + [ax_blas_zdotu_fcall_ok=no]) + AC_MSG_RESULT([$ax_blas_zdotu_fcall_ok]) +# Check for correct integer size +# FIXME: this may fail with things like -ftrapping-math. + AC_MSG_CHECKING([whether the integer size is correct]) + AC_RUN_IFELSE(AC_LANG_PROGRAM(,[[ integer n,nn(3) real s,a(1),b(1),sdot a(1) = 1.0 b(1) = 1.0 -c Generate -2**32 + 1, if possible +c Generate -2**33 + 1, if possible n = 2 - n = -4 ** (n ** 30) + n = -4 * (n ** 30) n = n + 1 if (n >= 0) goto 1 c This means we're on 64-bit integers. Check whether the BLAS is, too. @@ -173,40 +166,39 @@ nn(3) = -1 s = sdot(nn(2),a,1,b,1) if (s .ne. 1.0) stop 1 - ]])], - [ax_blas_integer_size_ok=yes], - [ax_blas_integer_size_ok=no]) - AC_MSG_RESULT([$ax_blas_integer_size_ok]) + ]]),[ax_blas_integer_size_ok=yes], + [ax_blas_integer_size_ok=no]) + AC_MSG_RESULT([$ax_blas_integer_size_ok]) - AC_LANG_POP(Fortran 77) + AC_LANG_POP(Fortran 77) - ## if any of the tests failed, reject the BLAS library - if test $ax_blas_lsame_fcall_ok = yes \ - -a $ax_blas_sdot_fcall_ok = yes \ - -a $ax_blas_ddot_fcall_ok = yes \ - -a $ax_blas_cdotu_fcall_ok = yes \ - -a $ax_blas_zdotu_fcall_ok = yes \ - -a $ax_blas_integer_size_ok = yes; then - ax_blas_f77_func_ok=yes; - $1 - else - ax_blas_f77_func_ok=no; - $2 - fi - LIBS="$save_ax_blas_f77_func_LIBS" - fi +# if any of the tests failed, reject the BLAS library + if test $ax_blas_lsame_fcall_ok = yes \ + -a $ax_blas_sdot_fcall_ok = yes \ + -a $ax_blas_ddot_fcall_ok = yes \ + -a $ax_blas_cdotu_fcall_ok = yes \ + -a $ax_blas_zdotu_fcall_ok = yes \ + -a $ax_blas_integer_size_ok = yes; then + ax_blas_f77_func_ok=yes; + $1 + else + ax_blas_f77_func_ok=no; + $2 + fi + LIBS="$save_ax_blas_f77_func_LIBS" +fi + ])dnl AX_BLAS_F77_FUNC AC_DEFUN([AX_BLAS_WITH_F77_FUNC], [ - AC_PREREQ(2.50) - AX_BLAS([# disable special action], []) - if test x$ax_blas_ok = xyes ; then - AX_BLAS_F77_FUNC( - [ifelse([$1],,AC_DEFINE(HAVE_BLAS,1,[Define if you have a BLAS library.]),[$1])], - [ax_blas_ok=no; BLAS_LIBS=], - [$3]) - fi - if test x$ax_blas_ok = xno ; then - $2 - fi +AC_PREREQ(2.50) +AX_BLAS([# disable special action], []) +if test x$ax_blas_ok = xyes ; then + AX_BLAS_F77_FUNC( + [ifelse([$1],,AC_DEFINE(HAVE_BLAS,1,[Define if you have a BLAS library.]),[$1])], + [ax_blas_ok=no; BLAS_LIBS=]) +fi +if test x$ax_blas_ok = xno ; then + $2 +fi ])dnl AX_BLAS_WITH_F77_FUNC
--- a/m4/ax_pthread.m4 +++ b/m4/ax_pthread.m4 @@ -82,7 +82,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 18 +#serial 21 AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) AC_DEFUN([AX_PTHREAD], [ @@ -103,8 +103,8 @@ save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) - AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes) - AC_MSG_RESULT($ax_pthread_ok) + AC_TRY_LINK_FUNC([pthread_join], [ax_pthread_ok=yes]) + AC_MSG_RESULT([$ax_pthread_ok]) if test x"$ax_pthread_ok" = xno; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" @@ -164,6 +164,20 @@ ;; esac +# Clang doesn't consider unrecognized options an error unless we specify +# -Werror. We throw in some extra Clang-specific options to ensure that +# this doesn't happen for GCC, which also accepts -Werror. + +AC_MSG_CHECKING([if compiler needs -Werror to reject unknown flags]) +save_CFLAGS="$CFLAGS" +ax_pthread_extra_flags="-Werror" +CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument" +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo(void);],[foo()])], + [AC_MSG_RESULT([yes])], + [ax_pthread_extra_flags= + AC_MSG_RESULT([no])]) +CFLAGS="$save_CFLAGS" + if test x"$ax_pthread_ok" = xno; then for flag in $ax_pthread_flags; do @@ -178,7 +192,7 @@ ;; pthread-config) - AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no) + AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) if test x"$ax_pthread_config" = xno; then continue; fi PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" @@ -193,7 +207,7 @@ save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we @@ -219,7 +233,7 @@ LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" - AC_MSG_RESULT($ax_pthread_ok) + AC_MSG_RESULT([$ax_pthread_ok]) if test "x$ax_pthread_ok" = xyes; then break; fi @@ -245,9 +259,9 @@ [attr_name=$attr; break], []) done - AC_MSG_RESULT($attr_name) + AC_MSG_RESULT([$attr_name]) if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then - AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, + AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$attr_name], [Define to necessary symbol if this constant uses a non-standard name on your system.]) fi @@ -261,45 +275,54 @@ if test "$GCC" = "yes"; then flag="-D_REENTRANT" else + # TODO: What about Clang on Solaris? flag="-mt -D_REENTRANT" fi ;; esac - AC_MSG_RESULT(${flag}) + AC_MSG_RESULT([$flag]) if test "x$flag" != xno; then PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], - ax_cv_PTHREAD_PRIO_INHERIT, [ - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[#include <pthread.h>]], [[int i = PTHREAD_PRIO_INHERIT;]])], + [ax_cv_PTHREAD_PRIO_INHERIT], [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]], + [[int i = PTHREAD_PRIO_INHERIT;]])], [ax_cv_PTHREAD_PRIO_INHERIT=yes], [ax_cv_PTHREAD_PRIO_INHERIT=no]) ]) AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"], - AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.])) + [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])]) LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" - # More AIX lossage: must compile with xlc_r or cc_r - if test x"$GCC" != xyes; then - AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC}) - else - PTHREAD_CC=$CC + # More AIX lossage: compile with *_r variant + if test "x$GCC" != xyes; then + case $host_os in + aix*) + AS_CASE(["x/$CC"], + [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], + [#handle absolute path differently from PATH based program lookup + AS_CASE(["x$CC"], + [x/*], + [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], + [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) + ;; + esac fi -else - PTHREAD_CC="$CC" fi -AC_SUBST(PTHREAD_LIBS) -AC_SUBST(PTHREAD_CFLAGS) -AC_SUBST(PTHREAD_CC) +test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" + +AC_SUBST([PTHREAD_LIBS]) +AC_SUBST([PTHREAD_CFLAGS]) +AC_SUBST([PTHREAD_CC]) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$ax_pthread_ok" = xyes; then - ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) + ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1]) : else ax_pthread_ok=no
--- a/scripts/io/importdata.m +++ b/scripts/io/importdata.m @@ -175,7 +175,7 @@ ## If no delimiter determined yet, make a guess. if (isempty (delimiter)) ## This pattern can be fooled, but mostly does the job just fine. - delim = regexp (row, '[-+\d.eE*ij ]+([^-+\d.ij])[-+\d.ij]', + delim = regexpi (row, '[-+\d.e*ij ]+([^-+\de.ij])[-+\de*.ij ]', 'tokens', 'once'); #delim = regexp (row, '[+-\d.eE\*ij ]+([^+-\d.ij])[+-\d.ij]', # 'tokens', 'once'); @@ -520,6 +520,18 @@ %! assert (h, 0); %!test +%! ## Distinguish double from complex when no delimiter is supplied (bug #43393) +%! fn = tmpnam (); +%! fid = fopen (fn, "w"); +%! fputs (fid, "2.0000e+02 4.0000e-04"); +%! fclose (fid); +%! [a, d, h] = importdata (fn); +%! unlink (fn); +%! assert (a, [2e2, 4e-4]); +%! assert (d, " "); +%! assert (h, 0); + +%!test %! ## Only text / no numeric data; \n as EOL %! fn = tempname (); %! fid = fopen (fn, "w");