From b9cc4b4c34ef870ea2488079d082fb54b19391d9 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 24 Mar 2020 19:04:42 -0400 Subject: [PATCH 1/4] build/pkgs/r/distros/cygwin.txt: Add libtirpc-devel, needed for building rpy2 --- build/pkgs/r/distros/cygwin.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/build/pkgs/r/distros/cygwin.txt b/build/pkgs/r/distros/cygwin.txt index 331bae08fb7..f532411f70a 100644 --- a/build/pkgs/r/distros/cygwin.txt +++ b/build/pkgs/r/distros/cygwin.txt @@ -1 +1,2 @@ R +libtirpc-devel # needed for building extensions From 950ba671f078caeaa964db7292212a0450d30178 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 31 Mar 2020 22:15:10 -0400 Subject: [PATCH 2/4] build/pkgs/openblas/spkg-configure.m4: Fall back to building openblas.pc from AC_SEARCH_LIBS --- build/make/Makefile.in | 2 +- build/pkgs/openblas/spkg-configure.m4 | 54 +++++++++++++++++++++------ 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/build/make/Makefile.in b/build/make/Makefile.in index 018c6b4809e..5c349386908 100644 --- a/build/make/Makefile.in +++ b/build/make/Makefile.in @@ -48,7 +48,7 @@ $(SAGE_PKGCONFIG)/gsl.pc: @SAGE_GSL_PC_COMMAND@ # see build/pkgs/openblas/spkg-configure.m4 -$(SAGE_PKGCONFIG)/blas.pc $(SAGE_PKGCONFIG)/cblas.pc $(SAGE_PKGCONFIG)/lapack.pc: +$(SAGE_PKGCONFIG)/openblas.pc $(SAGE_PKGCONFIG)/blas.pc $(SAGE_PKGCONFIG)/cblas.pc $(SAGE_PKGCONFIG)/lapack.pc: -rm -f $@ @SAGE_OPENBLAS_PC_COMMAND@ diff --git a/build/pkgs/openblas/spkg-configure.m4 b/build/pkgs/openblas/spkg-configure.m4 index 0c806a82012..ee31f20d9c6 100644 --- a/build/pkgs/openblas/spkg-configure.m4 +++ b/build/pkgs/openblas/spkg-configure.m4 @@ -1,9 +1,10 @@ SAGE_SPKG_CONFIGURE([openblas], [ + dnl CHECK SAGE_SPKG_DEPCHECK([gfortran], [ + SAVE_LIBS="$LIBS" + SAVE_CFLAGS="$CFLAGS" PKG_CHECK_MODULES([OPENBLAS], [openblas >= 0.2.20], [ - SAVE_LIBS="$LIBS" LIBS="$OPENBLAS_LIBS $LIBS" - SAVE_CFLAGS="$CFLAGS" CFLAGS="$OPENBLAS_CFLAGS $CFLAGS" PKG_CHECK_VAR([OPENBLASPCDIR], [openblas], [pcfiledir], [ sage_install_blas_pc=yes @@ -30,24 +31,53 @@ SAGE_SPKG_CONFIGURE([openblas], [ AC_MSG_WARN([Unable to locate the directory of openblas.pc. This should not happen!]) sage_spkg_install_openblas=yes ]) - LIBS="$SAVE_LIBS" - CFLAGS="$SAVE_CFLAGS" - ], [sage_spkg_install_openblas=yes]) - AS_IF([test x$sage_spkg_install_openblas != xyes], [ - AC_SUBST([SAGE_SYSTEM_FACADE_PC_FILES]) - AC_SUBST([SAGE_OPENBLAS_PC_COMMAND], ["\$(LN) -sf \"$OPENBLASPCDIR/openblas.pc\" \"\$(@)\""]) - m4_foreach([blaslibnam], [blas, cblas, lapack], [ - AS_IF([test x$sage_install_]blaslibnam[_pc = xyes], [ - AS_VAR_APPEND([SAGE_SYSTEM_FACADE_PC_FILES], [" \$(SAGE_PKGCONFIG)/]blaslibnam[.pc"]) + AS_IF([test x$sage_spkg_install_openblas != xyes], [ + AC_SUBST([SAGE_SYSTEM_FACADE_PC_FILES]) + AC_SUBST([SAGE_OPENBLAS_PC_COMMAND], ["\$(LN) -sf \"$OPENBLASPCDIR/openblas.pc\" \"\$(@)\""]) + m4_foreach([blaslibnam], [blas, cblas, lapack], [ + AS_IF([test x$sage_install_]blaslibnam[_pc = xyes], [ + AS_VAR_APPEND([SAGE_SYSTEM_FACADE_PC_FILES], [" \$(SAGE_PKGCONFIG)/]blaslibnam[.pc"]) + ]) ]) - ]) + ]) + ], [ + dnl No openblas.pc + AC_SEARCH_LIBS([cblas_dgemm], [openblas cblas blas], [ + AS_VAR_SET([HAVE_CBLAS_DGEMM], [yes]) + AS_IF([test x"$ac_cv_search_cblas_dgemm" != x"none required"], [ + AS_VAR_APPEND([OPENBLAS_LIBS], ["$ac_cv_search_cblas_dgemm "]) + ]) + ], [], [-lgfortran]) + m4_foreach([dgeqrf_mangled], [dgeqrf, dgeqrf_, DGEQRF, DGEQRF_], [ + AC_SEARCH_LIBS(dgeqrf_mangled, [openblas lapack], [ + AS_VAR_SET([HAVE_DGEQRF], [yes]) + AS_IF([test x"$ac_cv_search_]dgeqrf_mangled[" != x"none required"], [ + AS_VAR_APPEND([OPENBLAS_LIBS], ["$ac_cv_search_]dgeqrf_mangled[ "]) + ]) + ], [], [-lgfortran]) + ]) + AS_IF([test x"$HAVE_CBLAS_DGEMM" = xyes -a x"$HAVE_DGEQRF" = xyes], [ + AC_SUBST([OPENBLAS_LIBS]) + AC_SUBST([SAGE_SYSTEM_FACADE_PC_FILES]) + AC_SUBST([SAGE_OPENBLAS_PC_COMMAND], [" (echo \"Name: openblas\"; echo \"Description: OpenBLAS\"; echo \"Version: 0.3\"; echo \"Libs: $OPENBLAS_LIBS\") > \"\$(@)\""]) + m4_foreach([blaslibnam], [openblas, blas, cblas, lapack], [ + AS_VAR_APPEND([SAGE_SYSTEM_FACADE_PC_FILES], [" \$(SAGE_PKGCONFIG)/]blaslibnam[.pc"]) + ]) + ], [ + dnl No system BLAS found + sage_spkg_install_openblas=yes + ]) ]) + LIBS="$SAVE_LIBS" + CFLAGS="$SAVE_CFLAGS" ]) ], [ + dnl REQUIRED-CHECK AS_IF([test "x$with_blas" = xopenblas], [ sage_require_openblas=yes sage_require_atlas=no]) ], [ + dnl PRE AC_MSG_CHECKING([BLAS library]) AC_ARG_WITH([blas], [AS_HELP_STRING([--with-blas=openblas], From 2873d86a6e39d76320250d1b8509e301ff00f868 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 1 Apr 2020 23:11:46 -0400 Subject: [PATCH 3/4] build/pkgs/openblas/spkg-configure.m4: Check version also when no pc file is available --- build/pkgs/openblas/spkg-configure.m4 | 49 +++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/build/pkgs/openblas/spkg-configure.m4 b/build/pkgs/openblas/spkg-configure.m4 index ee31f20d9c6..4d49c4068c3 100644 --- a/build/pkgs/openblas/spkg-configure.m4 +++ b/build/pkgs/openblas/spkg-configure.m4 @@ -3,7 +3,11 @@ SAGE_SPKG_CONFIGURE([openblas], [ SAGE_SPKG_DEPCHECK([gfortran], [ SAVE_LIBS="$LIBS" SAVE_CFLAGS="$CFLAGS" - PKG_CHECK_MODULES([OPENBLAS], [openblas >= 0.2.20], [ + m4_pushdef([SAGE_OPENBLAS_MIN_VERSION_MAJOR], [0]) + m4_pushdef([SAGE_OPENBLAS_MIN_VERSION_MINOR], [2]) + m4_pushdef([SAGE_OPENBLAS_MIN_VERSION_MICRO], [20]) + m4_pushdef([SAGE_OPENBLAS_MIN_VERSION], [SAGE_OPENBLAS_MIN_VERSION_MAJOR.SAGE_OPENBLAS_MIN_VERSION_MINOR.SAGE_OPENBLAS_MIN_VERSION_MICRO]) + PKG_CHECK_MODULES([OPENBLAS], [openblas >= 999]SAGE_OPENBLAS_MIN_VERSION, [ LIBS="$OPENBLAS_LIBS $LIBS" CFLAGS="$OPENBLAS_CFLAGS $CFLAGS" PKG_CHECK_VAR([OPENBLASPCDIR], [openblas], [pcfiledir], [ @@ -42,6 +46,47 @@ SAGE_SPKG_CONFIGURE([openblas], [ ]) ], [ dnl No openblas.pc + AS_CASE([$host], + [*-*-cygwin*], [dnl #29398: cygwin uses openblas only to provide a binary-compatible + dnl dll, /usr/bin/cygblas-0.dll, which shadows /usr/lib/lapack/cygblas-0.dll + dnl There is no .pc file, and openblas-specific functions such as + dnl openblas_get_config are not exported. We only accept the system BLAS + dnl if it is provided by OpenBLAS. + AC_MSG_CHECKING([whether cygblas-0.dll is openblas]) + AS_IF([grep -q openblas_get_config $(which cygblas-0.dll)], + [AS_VAR_SET([HAVE_OPENBLAS], [yes])], + [AS_VAR_SET([HAVE_OPENBLAS], [no])]) + AC_MSG_RESULT([$HAVE_OPENBLAS]) + ], + [dnl Recent OpenBLAS (>= 0.3.4, Dec 2018) provides the version number as + dnl part of openblas_get_config. We reject all older versions. + AC_SEARCH_LIBS([openblas_get_config], [openblas cblas blas], [ + AS_IF([test x"$ac_cv_search_openblas_get_config" != x"none required"], [ + AS_VAR_APPEND([OPENBLAS_LIBS], ["$ac_cv_search_openblas_get_config "]) + ]) + AC_MSG_CHECKING([whether openblas_get_config indicates version >= ]SAGE_OPENBLAS_MIN_VERSION) + AC_LANG_PUSH([C]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[#include + char *openblas_get_config(void); + int version[3]; ]], + [[version[0] = version[1] = version[2] = 0; + /*printf("%s", openblas_get_config());*/ + if (sscanf(openblas_get_config(), "OpenBLAS %d.%d.%d", + version, version+1, version+2) < 1) + return 1; + if ( 10000 * version[0] + + 100 * version[1] + + version[2] + < 10000 * ]]SAGE_OPENBLAS_MIN_VERSION_MAJOR[[ + + 100 * ]]SAGE_OPENBLAS_MIN_VERSION_MINOR[[ + + ]]SAGE_OPENBLAS_MIN_VERSION_MICRO[[) + return 1;]]) + ], [AS_VAR_SET([HAVE_OPENBLAS], [yes])], [AS_VAR_SET([HAVE_OPENBLAS], [no])]) + AC_LANG_POP([C]) + AC_MSG_RESULT([$HAVE_OPENBLAS]) + ]) + ]) AC_SEARCH_LIBS([cblas_dgemm], [openblas cblas blas], [ AS_VAR_SET([HAVE_CBLAS_DGEMM], [yes]) AS_IF([test x"$ac_cv_search_cblas_dgemm" != x"none required"], [ @@ -56,7 +101,7 @@ SAGE_SPKG_CONFIGURE([openblas], [ ]) ], [], [-lgfortran]) ]) - AS_IF([test x"$HAVE_CBLAS_DGEMM" = xyes -a x"$HAVE_DGEQRF" = xyes], [ + AS_IF([test x"$HAVE_OPENBLAS" = xyes -a x"$HAVE_CBLAS_DGEMM" = xyes -a x"$HAVE_DGEQRF" = xyes], [ AC_SUBST([OPENBLAS_LIBS]) AC_SUBST([SAGE_SYSTEM_FACADE_PC_FILES]) AC_SUBST([SAGE_OPENBLAS_PC_COMMAND], [" (echo \"Name: openblas\"; echo \"Description: OpenBLAS\"; echo \"Version: 0.3\"; echo \"Libs: $OPENBLAS_LIBS\") > \"\$(@)\""]) From 0cda07c33fe26f035377c57c8982f3e2ea8da85d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 2 Apr 2020 08:53:44 -0400 Subject: [PATCH 4/4] build/pkgs/openblas/spkg-configure.m4: Make pkgconfig-based detection work again --- build/pkgs/openblas/spkg-configure.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/openblas/spkg-configure.m4 b/build/pkgs/openblas/spkg-configure.m4 index 4d49c4068c3..9004e57199e 100644 --- a/build/pkgs/openblas/spkg-configure.m4 +++ b/build/pkgs/openblas/spkg-configure.m4 @@ -7,7 +7,7 @@ SAGE_SPKG_CONFIGURE([openblas], [ m4_pushdef([SAGE_OPENBLAS_MIN_VERSION_MINOR], [2]) m4_pushdef([SAGE_OPENBLAS_MIN_VERSION_MICRO], [20]) m4_pushdef([SAGE_OPENBLAS_MIN_VERSION], [SAGE_OPENBLAS_MIN_VERSION_MAJOR.SAGE_OPENBLAS_MIN_VERSION_MINOR.SAGE_OPENBLAS_MIN_VERSION_MICRO]) - PKG_CHECK_MODULES([OPENBLAS], [openblas >= 999]SAGE_OPENBLAS_MIN_VERSION, [ + PKG_CHECK_MODULES([OPENBLAS], [openblas >= ]SAGE_OPENBLAS_MIN_VERSION, [ LIBS="$OPENBLAS_LIBS $LIBS" CFLAGS="$OPENBLAS_CFLAGS $CFLAGS" PKG_CHECK_VAR([OPENBLASPCDIR], [openblas], [pcfiledir], [