# HG changeset patch # User Rik # Date 1385063448 28800 # Node ID acdee77299e1c51fca71aa01b3eb3f02e8357f55 # Parent 437e51a0c25da9df0c1cd0f55c108aa18de8df02 ax_blas_f77_func.m4: Overhaul to remove tabs, use indentation, follow m4 quoting guidelines. * m4/ax_blas_f77_func.m4: Overhaul to remove tabs, use indentation, follow m4 quoting guidelines. diff -r 437e51a0c25d -r acdee77299e1 m4/ax_blas_f77_func.m4 --- a/m4/ax_blas_f77_func.m4 Thu Nov 21 11:07:05 2013 -0800 +++ b/m4/ax_blas_f77_func.m4 Thu Nov 21 11:50:48 2013 -0800 @@ -55,20 +55,21 @@ #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 @@ -78,12 +79,13 @@ 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) @@ -91,61 +93,66 @@ 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 @@ -166,40 +173,40 @@ 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=], + [$3]) + fi + if test x$ax_blas_ok = xno ; then + $2 + fi ])dnl AX_BLAS_WITH_F77_FUNC