"Fossies" - the Fresh Open Source Software Archive

Member "harminv-1.4.2/m4/ax_lapack.m4" (14 Jun 2021, 5173 Bytes) of package /linux/privat/harminv-1.4.2.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "ax_lapack.m4": 1.4.1_vs_1.4.2.

    1 # ===========================================================================
    2 #        https://www.gnu.org/software/autoconf-archive/ax_lapack.html
    3 # ===========================================================================
    4 #
    5 # SYNOPSIS
    6 #
    7 #   AX_LAPACK([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
    8 #
    9 # DESCRIPTION
   10 #
   11 #   This macro looks for a library that implements the LAPACK linear-algebra
   12 #   interface (see http://www.netlib.org/lapack/). On success, it sets the
   13 #   LAPACK_LIBS output variable to hold the requisite library linkages.
   14 #
   15 #   To link with LAPACK, you should link with:
   16 #
   17 #     $LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS
   18 #
   19 #   in that order. BLAS_LIBS is the output variable of the AX_BLAS macro,
   20 #   called automatically. FLIBS is the output variable of the
   21 #   AC_F77_LIBRARY_LDFLAGS macro (called if necessary by AX_BLAS), and is
   22 #   sometimes necessary in order to link with F77 libraries. Users will also
   23 #   need to use AC_F77_DUMMY_MAIN (see the autoconf manual), for the same
   24 #   reason.
   25 #
   26 #   The user may also use --with-lapack=<lib> in order to use some specific
   27 #   LAPACK library <lib>. In order to link successfully, however, be aware
   28 #   that you will probably need to use the same Fortran compiler (which can
   29 #   be set via the F77 env. var.) as was used to compile the LAPACK and BLAS
   30 #   libraries.
   31 #
   32 #   ACTION-IF-FOUND is a list of shell commands to run if a LAPACK library
   33 #   is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
   34 #   is not found. If ACTION-IF-FOUND is not specified, the default action
   35 #   will define HAVE_LAPACK.
   36 #
   37 # LICENSE
   38 #
   39 #   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
   40 #   Copyright (c) 2019 Geoffrey M. Oxberry <goxberry@gmail.com>
   41 #
   42 #   This program is free software: you can redistribute it and/or modify it
   43 #   under the terms of the GNU General Public License as published by the
   44 #   Free Software Foundation, either version 3 of the License, or (at your
   45 #   option) any later version.
   46 #
   47 #   This program is distributed in the hope that it will be useful, but
   48 #   WITHOUT ANY WARRANTY; without even the implied warranty of
   49 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
   50 #   Public License for more details.
   51 #
   52 #   You should have received a copy of the GNU General Public License along
   53 #   with this program. If not, see <https://www.gnu.org/licenses/>.
   54 #
   55 #   As a special exception, the respective Autoconf Macro's copyright owner
   56 #   gives unlimited permission to copy, distribute and modify the configure
   57 #   scripts that are the output of Autoconf when processing the Macro. You
   58 #   need not follow the terms of the GNU General Public License when using
   59 #   or distributing such scripts, even though portions of the text of the
   60 #   Macro appear in them. The GNU General Public License (GPL) does govern
   61 #   all other use of the material that constitutes the Autoconf Macro.
   62 #
   63 #   This special exception to the GPL applies to versions of the Autoconf
   64 #   Macro released by the Autoconf Archive. When you make and distribute a
   65 #   modified version of the Autoconf Macro, you may extend this special
   66 #   exception to the GPL to apply to your modified version as well.
   67 
   68 #serial 10
   69 
   70 AU_ALIAS([ACX_LAPACK], [AX_LAPACK])
   71 AC_DEFUN([AX_LAPACK], [
   72 AC_REQUIRE([AX_BLAS])
   73 ax_lapack_ok=no
   74 
   75 AC_ARG_WITH(lapack,
   76         [AS_HELP_STRING([--with-lapack=<lib>], [use LAPACK library <lib>])])
   77 case $with_lapack in
   78         yes | "") ;;
   79         no) ax_lapack_ok=disable ;;
   80         -* | */* | *.a | *.so | *.so.* | *.dylib | *.dylib.* | *.o)
   81                  LAPACK_LIBS="$with_lapack"
   82         ;;
   83         *) LAPACK_LIBS="-l$with_lapack" ;;
   84 esac
   85 
   86 # Get fortran linker name of LAPACK function to check for.
   87 AC_F77_FUNC(cheev)
   88 
   89 # We cannot use LAPACK if BLAS is not found
   90 if test "x$ax_blas_ok" != xyes; then
   91         ax_lapack_ok=noblas
   92         LAPACK_LIBS=""
   93 fi
   94 
   95 # First, check LAPACK_LIBS environment variable
   96 if test "x$LAPACK_LIBS" != x; then
   97         save_LIBS="$LIBS"; LIBS="$LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS"
   98         AC_MSG_CHECKING([for $cheev in $LAPACK_LIBS])
   99         AC_LINK_IFELSE([AC_LANG_CALL([], [$cheev])], [ax_lapack_ok=yes], [LAPACK_LIBS=""])
  100         AC_MSG_RESULT($ax_lapack_ok)
  101         LIBS="$save_LIBS"
  102         if test $ax_lapack_ok = no; then
  103                 LAPACK_LIBS=""
  104         fi
  105 fi
  106 
  107 # LAPACK linked to by default?  (is sometimes included in BLAS lib)
  108 if test $ax_lapack_ok = no; then
  109         save_LIBS="$LIBS"; LIBS="$LIBS $BLAS_LIBS $FLIBS"
  110         AC_CHECK_FUNC($cheev, [ax_lapack_ok=yes])
  111         LIBS="$save_LIBS"
  112 fi
  113 
  114 # Generic LAPACK library?
  115 for lapack in lapack lapack_rs6k; do
  116         if test $ax_lapack_ok = no; then
  117                 save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS"
  118                 AC_CHECK_LIB($lapack, $cheev,
  119                     [ax_lapack_ok=yes; LAPACK_LIBS="-l$lapack"], [], [$FLIBS])
  120                 LIBS="$save_LIBS"
  121         fi
  122 done
  123 
  124 AC_SUBST(LAPACK_LIBS)
  125 
  126 # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
  127 if test x"$ax_lapack_ok" = xyes; then
  128         ifelse([$1],,AC_DEFINE(HAVE_LAPACK,1,[Define if you have LAPACK library.]),[$1])
  129         :
  130 else
  131         ax_lapack_ok=no
  132         $2
  133 fi
  134 ])dnl AX_LAPACK