slackbuilds/academic/qrupdate/patches/autoconfiscate.diff

506 lines
17 KiB
Diff

diff --git a/Makefile.am b/Makefile.am
new file mode 100644
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,5 @@
+ACLOCAL_AMFLAGS = -I m4
+
+SUBDIRS = src test
+
+pkgconfig_DATA = qrupdate.pc
diff --git a/configure.ac b/configure.ac
new file mode 100644
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,35 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.69])
+AC_INIT([qrupdate],[1.1.2],[highegg@gmail.com],[qrupdate],[https://sourceforge.net/projects/qrupdate/])
+AC_CONFIG_SRCDIR([src/sqr1up.f])
+AC_CONFIG_AUX_DIR([build-aux])
+AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_HEADERS([src/config.h])
+AM_INIT_AUTOMAKE([foreign])
+AM_SILENT_RULES([yes])
+LT_INIT([disable-static])
+
+# Checks for programs.
+AC_PROG_INSTALL
+AC_PROG_F77
+
+# Checks for libraries.
+AX_BLAS([], [AC_MSG_ERROR([cannot find BLAS])])
+AX_LAPACK([], [AC_MSG_ERROR([cannot find LAPACK])])
+
+# Checks for header files.
+
+# Checks for typedefs, structures, and compiler characteristics.
+
+# Checks for library functions.
+
+m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], [AC_SUBST([pkgconfigdir], [${libdir}/pkgconfig])])
+AC_CONFIG_FILES([
+ qrupdate.pc
+ Makefile
+ src/Makefile
+ test/Makefile
+])
+AC_OUTPUT
diff --git a/m4/ax_blas.m4 b/m4/ax_blas.m4
new file mode 100644
--- /dev/null
+++ b/m4/ax_blas.m4
@@ -0,0 +1,238 @@
+# ===========================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_blas.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_BLAS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+#
+# DESCRIPTION
+#
+# This macro looks for a library that implements the BLAS linear-algebra
+# interface (see http://www.netlib.org/blas/). On success, it sets the
+# BLAS_LIBS output variable to hold the requisite library linkages.
+#
+# To link with BLAS, you should link with:
+#
+# $BLAS_LIBS $LIBS $FLIBS
+#
+# in that order. FLIBS is the output variable of the
+# AC_F77_LIBRARY_LDFLAGS macro (called if necessary by AX_BLAS), and is
+# sometimes necessary in order to link with F77 libraries. Users will also
+# need to use AC_F77_DUMMY_MAIN (see the autoconf manual), for the same
+# reason.
+#
+# Many libraries are searched for, from ATLAS to CXML to ESSL. The user
+# may also use --with-blas=<lib> in order to use some specific BLAS
+# library <lib>. In order to link successfully, however, be aware that you
+# will probably need to use the same Fortran compiler (which can be set
+# via the F77 env. var.) as was used to compile the BLAS library.
+#
+# ACTION-IF-FOUND is a list of shell commands to run if a BLAS library is
+# found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it is
+# not found. If ACTION-IF-FOUND is not specified, the default action will
+# define HAVE_BLAS.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 16
+
+AU_ALIAS([ACX_BLAS], [AX_BLAS])
+AC_DEFUN([AX_BLAS], [
+AC_PREREQ([2.55])
+AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS])
+AC_REQUIRE([AC_CANONICAL_HOST])
+ax_blas_ok=no
+
+AC_ARG_WITH(blas,
+ [AS_HELP_STRING([--with-blas=<lib>], [use BLAS library <lib>])])
+case $with_blas in
+ yes | "") ;;
+ no) ax_blas_ok=disable ;;
+ -* | */* | *.a | *.so | *.so.* | *.o) BLAS_LIBS="$with_blas" ;;
+ *) BLAS_LIBS="-l$with_blas" ;;
+esac
+
+# Get fortran linker names of BLAS functions to check for.
+AC_F77_FUNC(sgemm)
+AC_F77_FUNC(dgemm)
+
+ax_blas_save_LIBS="$LIBS"
+LIBS="$LIBS $FLIBS"
+
+# First, check BLAS_LIBS environment variable
+if test $ax_blas_ok = no; then
+if test "x$BLAS_LIBS" != x; then
+ save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS"
+ AC_MSG_CHECKING([for $sgemm in $BLAS_LIBS])
+ AC_LINK_IFELSE([AC_LANG_CALL([], [$sgemm])], [ax_blas_ok=yes], [BLAS_LIBS=""])
+ AC_MSG_RESULT($ax_blas_ok)
+ LIBS="$save_LIBS"
+fi
+fi
+
+# BLAS linked to by default? (happens on some supercomputers)
+if test $ax_blas_ok = no; then
+ save_LIBS="$LIBS"; LIBS="$LIBS"
+ AC_MSG_CHECKING([if $sgemm is being linked in already])
+ AC_LINK_IFELSE([AC_LANG_CALL([], [$sgemm])], [ax_blas_ok=yes])
+ AC_MSG_RESULT($ax_blas_ok)
+ 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,
+ [AC_CHECK_LIB(f77blas, $sgemm,
+ [AC_CHECK_LIB(cblas, cblas_dgemm,
+ [ax_blas_ok=yes
+ BLAS_LIBS="-lcblas -lf77blas -latlas"],
+ [], [-lf77blas -latlas])],
+ [], [-latlas])])
+fi
+
+# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
+if test $ax_blas_ok = no; then
+ AC_CHECK_LIB(blas, $sgemm,
+ [AC_CHECK_LIB(dgemm, $dgemm,
+ [AC_CHECK_LIB(sgemm, $sgemm,
+ [ax_blas_ok=yes; BLAS_LIBS="-lsgemm -ldgemm -lblas"],
+ [], [-lblas])],
+ [], [-lblas])])
+fi
+
+# 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
+
+# BLAS in Apple vecLib library?
+if test $ax_blas_ok = no; then
+ save_LIBS="$LIBS"; LIBS="-framework vecLib $LIBS"
+ AC_MSG_CHECKING([for $sgemm in -framework vecLib])
+ AC_LINK_IFELSE([AC_LANG_CALL([], [$sgemm])], [ax_blas_ok=yes;BLAS_LIBS="-framework vecLib"])
+ AC_MSG_RESULT($ax_blas_ok)
+ LIBS="$save_LIBS"
+fi
+
+# BLAS in Alpha CXML library?
+if test $ax_blas_ok = no; then
+ AC_CHECK_LIB(cxml, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-lcxml"])
+fi
+
+# BLAS in Alpha DXML library? (now called CXML, see above)
+if test $ax_blas_ok = no; then
+ AC_CHECK_LIB(dxml, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-ldxml"])
+fi
+
+# BLAS in Sun Performance library?
+if test $ax_blas_ok = no; then
+ if test "x$GCC" != xyes; then # only works with Sun CC
+ AC_CHECK_LIB(sunmath, acosp,
+ [AC_CHECK_LIB(sunperf, $sgemm,
+ [BLAS_LIBS="-xlic_lib=sunperf -lsunmath"
+ ax_blas_ok=yes],[],[-lsunmath])])
+ fi
+fi
+
+# BLAS in SCSL library? (SGI/Cray Scientific Library)
+if test $ax_blas_ok = no; then
+ AC_CHECK_LIB(scs, $sgemm, [ax_blas_ok=yes; BLAS_LIBS="-lscs"])
+fi
+
+# BLAS in SGIMATH library?
+if test $ax_blas_ok = no; then
+ AC_CHECK_LIB(complib.sgimath, $sgemm,
+ [ax_blas_ok=yes; BLAS_LIBS="-lcomplib.sgimath"])
+fi
+
+# BLAS in IBM ESSL library? (requires generic BLAS lib, too)
+if test $ax_blas_ok = no; then
+ AC_CHECK_LIB(blas, $sgemm,
+ [AC_CHECK_LIB(essl, $sgemm,
+ [ax_blas_ok=yes; BLAS_LIBS="-lessl -lblas"],
+ [], [-lblas $FLIBS])])
+fi
+
+# Generic BLAS library?
+if test $ax_blas_ok = no; then
+ AC_CHECK_LIB(blas, $sgemm, [ax_blas_ok=yes; BLAS_LIBS="-lblas"])
+fi
+
+AC_SUBST(BLAS_LIBS)
+
+LIBS="$ax_blas_save_LIBS"
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$ax_blas_ok" = xyes; then
+ ifelse([$1],,AC_DEFINE(HAVE_BLAS,1,[Define if you have a BLAS library.]),[$1])
+ :
+else
+ ax_blas_ok=no
+ $2
+fi
+])dnl AX_BLAS
diff --git a/m4/ax_lapack.m4 b/m4/ax_lapack.m4
new file mode 100644
--- /dev/null
+++ b/m4/ax_lapack.m4
@@ -0,0 +1,131 @@
+# ===========================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_lapack.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_LAPACK([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+#
+# DESCRIPTION
+#
+# This macro looks for a library that implements the LAPACK linear-algebra
+# interface (see http://www.netlib.org/lapack/). On success, it sets the
+# LAPACK_LIBS output variable to hold the requisite library linkages.
+#
+# To link with LAPACK, you should link with:
+#
+# $LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS
+#
+# in that order. BLAS_LIBS is the output variable of the AX_BLAS macro,
+# called automatically. FLIBS is the output variable of the
+# AC_F77_LIBRARY_LDFLAGS macro (called if necessary by AX_BLAS), and is
+# sometimes necessary in order to link with F77 libraries. Users will also
+# need to use AC_F77_DUMMY_MAIN (see the autoconf manual), for the same
+# reason.
+#
+# The user may also use --with-lapack=<lib> in order to use some specific
+# LAPACK library <lib>. In order to link successfully, however, be aware
+# that you will probably need to use the same Fortran compiler (which can
+# be set via the F77 env. var.) as was used to compile the LAPACK and BLAS
+# libraries.
+#
+# ACTION-IF-FOUND is a list of shell commands to run if a LAPACK library
+# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
+# is not found. If ACTION-IF-FOUND is not specified, the default action
+# will define HAVE_LAPACK.
+#
+# LICENSE
+#
+# Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 9
+
+AU_ALIAS([ACX_LAPACK], [AX_LAPACK])
+AC_DEFUN([AX_LAPACK], [
+AC_REQUIRE([AX_BLAS])
+ax_lapack_ok=no
+
+AC_ARG_WITH(lapack,
+ [AS_HELP_STRING([--with-lapack=<lib>], [use LAPACK library <lib>])])
+case $with_lapack in
+ yes | "") ;;
+ no) ax_lapack_ok=disable ;;
+ -* | */* | *.a | *.so | *.so.* | *.o) LAPACK_LIBS="$with_lapack" ;;
+ *) LAPACK_LIBS="-l$with_lapack" ;;
+esac
+
+# Get fortran linker name of LAPACK function to check for.
+AC_F77_FUNC(cheev)
+
+# We cannot use LAPACK if BLAS is not found
+if test "x$ax_blas_ok" != xyes; then
+ ax_lapack_ok=noblas
+ LAPACK_LIBS=""
+fi
+
+# First, check LAPACK_LIBS environment variable
+if test "x$LAPACK_LIBS" != x; then
+ save_LIBS="$LIBS"; LIBS="$LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS"
+ AC_MSG_CHECKING([for $cheev in $LAPACK_LIBS])
+ AC_LINK_IFELSE([AC_LANG_CALL([], [$cheev])], [ax_lapack_ok=yes], [LAPACK_LIBS=""])
+ AC_MSG_RESULT($ax_lapack_ok)
+ LIBS="$save_LIBS"
+ if test $ax_lapack_ok = no; then
+ LAPACK_LIBS=""
+ fi
+fi
+
+# LAPACK linked to by default? (is sometimes included in BLAS lib)
+if test $ax_lapack_ok = no; then
+ save_LIBS="$LIBS"; LIBS="$LIBS $BLAS_LIBS $FLIBS"
+ AC_CHECK_FUNC($cheev, [ax_lapack_ok=yes])
+ LIBS="$save_LIBS"
+fi
+
+# Generic LAPACK library?
+for lapack in lapack lapack_rs6k; do
+ if test $ax_lapack_ok = no; then
+ save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS"
+ AC_CHECK_LIB($lapack, $cheev,
+ [ax_lapack_ok=yes; LAPACK_LIBS="-l$lapack"], [], [$FLIBS])
+ LIBS="$save_LIBS"
+ fi
+done
+
+AC_SUBST(LAPACK_LIBS)
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$ax_lapack_ok" = xyes; then
+ ifelse([$1],,AC_DEFINE(HAVE_LAPACK,1,[Define if you have LAPACK library.]),[$1])
+ :
+else
+ ax_lapack_ok=no
+ $2
+fi
+])dnl AX_LAPACK
diff --git a/qrupdate.pc.in b/qrupdate.pc.in
new file mode 100644
--- /dev/null
+++ b/qrupdate.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+
+Name: @PACKAGE_NAME@
+Description: Library for fast updating of QR and Cholesky decompositions
+Version: @PACKAGE_VERSION@
+URL: @PACKAGE_URL@
+Libs: -L${libdir} -lqrupdate
+Libs.private: @LAPACK_LIBS@ @BLAS_LIBS@
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,19 @@
+AM_FFLAGS = -fimplicit-none -O3 -funroll-loops
+
+SRC = caxcpy.f cch1dn.f cch1up.f cchdex.f cchinx.f cchshx.f cgqvec.f \
+cqhqr.f cqr1up.f cqrdec.f cqrder.f cqrinc.f cqrinr.f cqrot.f cqrqh.f \
+cqrshc.f cqrtv1.f dch1dn.f dch1up.f dchdex.f dchinx.f dchshx.f \
+dgqvec.f dqhqr.f dqr1up.f dqrdec.f dqrder.f dqrinc.f dqrinr.f dqrot.f \
+dqrqh.f dqrshc.f dqrtv1.f sch1dn.f sch1up.f schdex.f schinx.f schshx.f \
+sgqvec.f sqhqr.f sqr1up.f sqrdec.f sqrder.f sqrinc.f sqrinr.f sqrot.f \
+sqrqh.f sqrshc.f sqrtv1.f zaxcpy.f zch1dn.f zch1up.f zchdex.f zchinx.f \
+zchshx.f zgqvec.f zqhqr.f zqr1up.f zqrdec.f zqrder.f zqrinc.f zqrinr.f \
+zqrot.f zqrqh.f zqrshc.f zqrtv1.f \
+clu1up.f dlu1up.f slu1up.f zlu1up.f \
+clup1up.f dlup1up.f slup1up.f zlup1up.f
+
+lib_LTLIBRARIES = libqrupdate.la
+
+libqrupdate_la_SOURCES = $(SRC)
+libqrupdate_la_LIBADD = $(LAPACK_LIBS) $(BLAS_LIBS)
+libqrupdate_la_LDFLAGS = -no-undefined -version-number 1:1:2
diff --git a/test/Makefile.am b/test/Makefile.am
new file mode 100644
--- /dev/null
+++ b/test/Makefile.am
@@ -0,0 +1,32 @@
+AM_FFLAGS = -fimplicit-none -O3 -funroll-loops
+LDADD = $(top_builddir)/src/libqrupdate.la
+
+EXTRA_DIST = report_results
+
+check_PROGRAMS = \
+ tqr1up tqrinc tqrdec tqrshc tqrinr tqrder \
+ tch1up tch1dn tchinx tchdex tchshx \
+ tlu1up tlup1up
+
+tqr1up_SOURCES = tqr1up.f utils.f
+tqrinc_SOURCES = tqrinc.f utils.f
+tqrdec_SOURCES = tqrdec.f utils.f
+tqrshc_SOURCES = tqrshc.f utils.f
+tqrinr_SOURCES = tqrinr.f utils.f
+tqrder_SOURCES = tqrder.f utils.f
+tch1up_SOURCES = tch1up.f utils.f
+tch1dn_SOURCES = tch1dn.f utils.f
+tchinx_SOURCES = tchinx.f utils.f
+tchdex_SOURCES = tchdex.f utils.f
+tchshx_SOURCES = tchshx.f utils.f
+tlu1up_SOURCES = tlu1up.f utils.f
+tlup1up_SOURCES = tlup1up.f utils.f
+
+check-local: $(check_PROGRAMS)
+ @for i in $(check_PROGRAMS); do \
+ echo > $$i.out; \
+ ./$$i | tee $$i.out; \
+ done
+ @$(srcdir)/report_results $(check_PROGRAMS:%=%.out)
+
+CLEANFILES = *.out