diff --git a/etc/m4/.gitignore b/etc/m4/.gitignore new file mode 100644 index 0000000..9f6dac0 --- /dev/null +++ b/etc/m4/.gitignore @@ -0,0 +1 @@ +autoconf-archive/ diff --git a/etc/m4/Makefile b/etc/m4/Makefile new file mode 100644 index 0000000..c9c9065 --- /dev/null +++ b/etc/m4/Makefile @@ -0,0 +1,19 @@ +FILES = \ + ax_blas.m4 \ + ax_cxx_compile_stdcxx.m4 \ + ax_cxx_static_cast.m4 \ + ax_lapack.m4 \ + ax_mpi.m4 \ + ax_cxx_typename.m4 \ + ax_cxx_templates.m4 \ + ax_openmp.m4 \ + ax_prog_cxx_mpi.m4 \ + ax_prog_emacs.m4 \ + ax_elisp.m4 \ + + +update: autoconf-archive + for f in $(FILES); do cp -v $ in order to use some specific BLAS +# library . 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. # -# NOTE: The above assumes that you will use $CC (or whatever) for linking -# as well as for compiling. (This is the default for automake and most -# Makefiles.) -# -# The user can force a particular library/compiler by setting the -# MPICC/MPICXX/MPIF77/MPIFC and/or MPILIBS environment variables. -# -# ACTION-IF-FOUND is a list of shell commands to run if an MPI library is -# found, and ACTION-IF-NOT-FOUND is a list of commands to run if it is not -# found. If ACTION-IF-FOUND is not specified, the default action will -# define HAVE_MPI. +# 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 -# Copyright (c) 2008 Julian C. Cummings +# Copyright (c) 2019 Geoffrey M. Oxberry # # 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 @@ -61,7 +49,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -76,117 +64,178 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 7 +#serial 17 -AU_ALIAS([ACX_MPI], [AX_MPI]) -AC_DEFUN([AX_MPI], [ -AC_PREREQ([2.50]) dnl for AC_LANG_CASE +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_LANG_CASE([C], [ - AC_REQUIRE([AC_PROG_CC]) - AC_ARG_VAR(MPICC,[MPI C compiler command]) - AC_CHECK_PROGS(MPICC, mpicc hcc mpxlc_r mpxlc mpcc cmpicc, $CC) - ax_mpi_save_CC="$CC" - CC="$MPICC" - AC_SUBST(MPICC) -], -[C++], [ - AC_REQUIRE([AC_PROG_CXX]) - AC_ARG_VAR(MPICXX,[MPI C++ compiler command]) - AC_CHECK_PROGS(MPICXX, mpic++ mpicxx mpiCC hcp mpxlC_r mpxlC mpCC cmpic++, $CXX) - ax_mpi_save_CXX="$CXX" - CXX="$MPICXX" - AC_SUBST(MPICXX) -], -[Fortran 77], [ - AC_REQUIRE([AC_PROG_F77]) - AC_ARG_VAR(MPIF77,[MPI Fortran 77 compiler command]) - AC_CHECK_PROGS(MPIF77, mpif77 hf77 mpxlf_r mpxlf mpf77 cmpifc, $F77) - ax_mpi_save_F77="$F77" - F77="$MPIF77" - AC_SUBST(MPIF77) -], -[Fortran], [ - AC_REQUIRE([AC_PROG_FC]) - AC_ARG_VAR(MPIFC,[MPI Fortran compiler command]) - AC_CHECK_PROGS(MPIFC, mpif90 mpxlf95_r mpxlf90_r mpxlf95 mpxlf90 mpf90 cmpif90c, $FC) - ax_mpi_save_FC="$FC" - FC="$MPIFC" - AC_SUBST(MPIFC) -]) +AC_ARG_WITH(blas, + [AS_HELP_STRING([--with-blas=], [use BLAS library ])]) +case $with_blas in + yes | "") ;; + no) ax_blas_ok=disable ;; + -* | */* | *.a | *.so | *.so.* | *.dylib | *.dylib.* | *.o) + BLAS_LIBS="$with_blas" + ;; + *) BLAS_LIBS="-l$with_blas" ;; +esac -if test x = x"$MPILIBS"; then - AC_LANG_CASE([C], [AC_CHECK_FUNC(MPI_Init, [MPILIBS=" "])], - [C++], [AC_CHECK_FUNC(MPI_Init, [MPILIBS=" "])], - [Fortran 77], [AC_MSG_CHECKING([for MPI_Init]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[ call MPI_Init])],[MPILIBS="" - AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])], - [Fortran], [AC_MSG_CHECKING([for MPI_Init]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[ call MPI_Init])],[MPILIBS=" " - AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])]) +# 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 -AC_LANG_CASE([Fortran 77], [ - if test x = x"$MPILIBS"; then - AC_CHECK_LIB(fmpi, MPI_Init, [MPILIBS="-lfmpi"]) - fi - if test x = x"$MPILIBS"; then - AC_CHECK_LIB(fmpich, MPI_Init, [MPILIBS="-lfmpich"]) - fi - if test x = x"$MPILIBS"; then - AC_CHECK_LIB(mpif77, MPI_Init, [MPILIBS="-lmpif77"]) - fi -], -[Fortran], [ - if test x = x"$MPILIBS"; then - AC_CHECK_LIB(fmpi, MPI_Init, [MPILIBS="-lfmpi"]) - fi - if test x = x"$MPILIBS"; then - AC_CHECK_LIB(mpichf90, MPI_Init, [MPILIBS="-lmpichf90"]) - fi -]) -if test x = x"$MPILIBS"; then - AC_CHECK_LIB(mpi, MPI_Init, [MPILIBS="-lmpi"]) -fi -if test x = x"$MPILIBS"; then - AC_CHECK_LIB(mpich, MPI_Init, [MPILIBS="-lmpich"]) fi -dnl We have to use AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[]) and not AC_CHECK_HEADER because the -dnl latter uses $CPP, not $CC (which may be mpicc). -AC_LANG_CASE([C], [if test x != x"$MPILIBS"; then - AC_MSG_CHECKING([for mpi.h]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[]])],[AC_MSG_RESULT(yes)],[MPILIBS="" - AC_MSG_RESULT(no)]) -fi], -[C++], [if test x != x"$MPILIBS"; then - AC_MSG_CHECKING([for mpi.h]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[]])],[AC_MSG_RESULT(yes)],[MPILIBS="" - AC_MSG_RESULT(no)]) -fi], -[Fortran 77], [if test x != x"$MPILIBS"; then - AC_MSG_CHECKING([for mpif.h]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[ include 'mpif.h'])],[AC_MSG_RESULT(yes)], [MPILIBS="" - AC_MSG_RESULT(no)]) -fi], -[Fortran], [if test x != x"$MPILIBS"; then - AC_MSG_CHECKING([for mpif.h]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[ include 'mpif.h'])],[AC_MSG_RESULT(yes)], [MPILIBS="" - AC_MSG_RESULT(no)]) -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 -AC_LANG_CASE([C], [CC="$ax_mpi_save_CC"], - [C++], [CXX="$ax_mpi_save_CXX"], - [Fortran 77], [F77="$ax_mpi_save_F77"], - [Fortran], [FC="$ax_mpi_save_FC"]) +# 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 -AC_SUBST(MPILIBS) +# 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 = x"$MPILIBS"; then - $2 +if test x"$ax_blas_ok" = xyes; then + ifelse([$1],,AC_DEFINE(HAVE_BLAS,1,[Define if you have a BLAS library.]),[$1]) : else - ifelse([$1],,[AC_DEFINE(HAVE_MPI,1,[Define if you have the MPI library.])],[$1]) - : + ax_blas_ok=no + $2 fi -])dnl AX_MPI +])dnl AX_BLAS diff --git a/etc/m4/ax_cxx_compile_stdcxx.m4 b/etc/m4/ax_cxx_compile_stdcxx.m4 index cc15bf8..51a3505 100644 --- a/etc/m4/ax_cxx_compile_stdcxx.m4 +++ b/etc/m4/ax_cxx_compile_stdcxx.m4 @@ -10,13 +10,13 @@ # # Check for baseline language coverage in the compiler for the specified # version of the C++ standard. If necessary, add switches to CXX and -# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard) -# or '14' (for the C++14 standard). +# CXXCPP to enable support. VERSION may be '11', '14', '17', or '20' for +# the respective C++ standard version. # # The second argument, if specified, indicates whether you insist on an # extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. # -std=c++11). If neither is specified, you get whatever works, with -# preference for an extended mode. +# preference for no added switch, and then for an extended mode. # # The third argument, if specified 'mandatory' or if left unspecified, # indicates that baseline support for the specified C++ standard is @@ -33,14 +33,17 @@ # Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov # Copyright (c) 2015 Paul Norman # Copyright (c) 2015 Moritz Klammler -# Copyright (c) 2016 Krzesimir Nowak +# Copyright (c) 2016, 2018 Krzesimir Nowak +# Copyright (c) 2019 Enji Cooper +# Copyright (c) 2020 Jason Merrill +# Copyright (c) 2021 Jörn Heusipp # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 8 +#serial 14 dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro dnl (serial version number 13). @@ -49,6 +52,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"], [$1], [14], [ax_cxx_compile_alternatives="14 1y"], [$1], [17], [ax_cxx_compile_alternatives="17 1z"], + [$1], [20], [ax_cxx_compile_alternatives="20"], [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl m4_if([$2], [], [], [$2], [ext], [], @@ -60,14 +64,16 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) AC_LANG_PUSH([C++])dnl ac_success=no - AC_CACHE_CHECK(whether $CXX supports C++$1 features by default, - ax_cv_cxx_compile_cxx$1, - [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [ax_cv_cxx_compile_cxx$1=yes], - [ax_cv_cxx_compile_cxx$1=no])]) - if test x$ax_cv_cxx_compile_cxx$1 = xyes; then - ac_success=yes - fi + + m4_if([$2], [], [dnl + AC_CACHE_CHECK(whether $CXX supports C++$1 features by default, + ax_cv_cxx_compile_cxx$1, + [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [ax_cv_cxx_compile_cxx$1=yes], + [ax_cv_cxx_compile_cxx$1=no])]) + if test x$ax_cv_cxx_compile_cxx$1 = xyes; then + ac_success=yes + fi]) m4_if([$2], [noext], [], [dnl if test x$ac_success = xno; then @@ -147,7 +153,6 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 ) - dnl Test body for checking C++14 support m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], @@ -155,12 +160,24 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 ) +dnl Test body for checking C++17 support + m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17], _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 ) +dnl Test body for checking C++20 support + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_20], + _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_20 +) + + dnl Tests for new features in C++11 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ @@ -197,11 +214,13 @@ namespace cxx11 struct Base { + virtual ~Base() {} virtual void f() {} }; struct Derived : public Base { + virtual ~Derived() override {} virtual void f() override {} }; @@ -585,20 +604,12 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[ #error "This is not a C++ compiler" -#elif __cplusplus <= 201402L +#elif __cplusplus < 201703L #error "This is not a C++17 compiler" #else -#if defined(__clang__) - #define REALLY_CLANG -#else - #if defined(__GNUC__) - #define REALLY_GCC - #endif -#endif - #include #include #include @@ -606,16 +617,12 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[ namespace cxx17 { -#if !defined(REALLY_CLANG) namespace test_constexpr_lambdas { - // TODO: test it with clang++ from git - constexpr int foo = [](){return 42;}(); } -#endif // !defined(REALLY_CLANG) namespace test::nested_namespace::definitions { @@ -850,12 +857,9 @@ namespace cxx17 } -#if !defined(REALLY_CLANG) namespace test_template_argument_deduction_for_class_templates { - // TODO: test it with clang++ from git - template struct pair { @@ -874,7 +878,6 @@ namespace cxx17 } } -#endif // !defined(REALLY_CLANG) namespace test_non_type_auto_template_parameters { @@ -888,12 +891,9 @@ namespace cxx17 } -#if !defined(REALLY_CLANG) namespace test_structured_bindings { - // TODO: test it with clang++ from git - int arr[2] = { 1, 2 }; std::pair pr = { 1, 2 }; @@ -925,14 +925,10 @@ namespace cxx17 const auto [ x3, y3 ] = f3(); } -#endif // !defined(REALLY_CLANG) -#if !defined(REALLY_CLANG) namespace test_exception_spec_type_system { - // TODO: test it with clang++ from git - struct Good {}; struct Bad {}; @@ -950,7 +946,6 @@ namespace cxx17 static_assert (std::is_same_v); } -#endif // !defined(REALLY_CLANG) namespace test_inline_variables { @@ -975,7 +970,36 @@ namespace cxx17 } // namespace cxx17 -#endif // __cplusplus <= 201402L +#endif // __cplusplus < 201703L ]]) + +dnl Tests for new features in C++20 + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_20], [[ + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 202002L + +#error "This is not a C++20 compiler" + +#else + +#include + +namespace cxx20 +{ + +// As C++20 supports feature test macros in the standard, there is no +// immediate need to actually test for feature availability on the +// Autoconf side. + +} // namespace cxx20 + +#endif // __cplusplus < 202002L + +]]) diff --git a/etc/m4/ax_cxx_static_cast.m4 b/etc/m4/ax_cxx_static_cast.m4 new file mode 100644 index 0000000..e91c521 --- /dev/null +++ b/etc/m4/ax_cxx_static_cast.m4 @@ -0,0 +1,42 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_cxx_static_cast.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CXX_STATIC_CAST +# +# DESCRIPTION +# +# If the compiler supports static_cast<>, define HAVE_STATIC_CAST. +# +# LICENSE +# +# Copyright (c) 2008 Todd Veldhuizen +# Copyright (c) 2008 Luc Maisonobe +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 8 + +AU_ALIAS([AC_CXX_STATIC_CAST], [AX_CXX_STATIC_CAST]) +AC_DEFUN([AX_CXX_STATIC_CAST], +[AC_CACHE_CHECK(whether the compiler supports static_cast<>, +ax_cv_cxx_static_cast, +[AC_LANG_PUSH([C++]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include +class Base { public : Base () {} virtual void f () = 0; }; +class Derived : public Base { public : Derived () {} virtual void f () {} }; +int g (Derived&) { return 0; }]], [[ +Derived d; Base& b = d; Derived& s = static_cast (b); return g (s);]])], + [ax_cv_cxx_static_cast=yes], [ax_cv_cxx_static_cast=no]) + AC_LANG_POP([C++]) +]) +if test "$ax_cv_cxx_static_cast" = yes; then + AC_DEFINE(HAVE_STATIC_CAST,, + [define if the compiler supports static_cast<>]) +fi +]) diff --git a/etc/m4/ax_cxx_templates.m4 b/etc/m4/ax_cxx_templates.m4 new file mode 100644 index 0000000..b426d09 --- /dev/null +++ b/etc/m4/ax_cxx_templates.m4 @@ -0,0 +1,43 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_cxx_templates.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CXX_TEMPLATES +# +# DESCRIPTION +# +# If the compiler supports basic templates, define HAVE_TEMPLATES. +# +# LICENSE +# +# Copyright (c) 2008 Todd Veldhuizen +# Copyright (c) 2008 Luc Maisonobe +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 8 + +AU_ALIAS([AC_CXX_TEMPLATES], [AX_CXX_TEMPLATES]) +AC_DEFUN([AX_CXX_TEMPLATES], +[dnl + AC_CACHE_CHECK([whether the compiler supports basic templates], + [ax_cv_cxx_templates], + [AC_LANG_PUSH([C++]) + AC_COMPILE_IFELSE([dnl + AC_LANG_PROGRAM([ + template class A {public:A(){};}; + template void f(const A& ){}; + ], + [A d; A i; f(d); f(i); return 0;])], + [ax_cv_cxx_templates=yes], + [ax_cv_cxx_templates=no]) + AC_LANG_POP([C++]) + ]) + AS_IF([test "X$ax_cv_cxx_templates" = "Xyes"], + [AC_DEFINE(HAVE_TEMPLATES,,[define if the compiler supports basic templates])]) +]) diff --git a/etc/m4/ax_cxx_typename.m4 b/etc/m4/ax_cxx_typename.m4 new file mode 100644 index 0000000..36c3d3c --- /dev/null +++ b/etc/m4/ax_cxx_typename.m4 @@ -0,0 +1,38 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_cxx_typename.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CXX_TYPENAME +# +# DESCRIPTION +# +# If the compiler recognizes the typename keyword, define HAVE_TYPENAME. +# +# LICENSE +# +# Copyright (c) 2008 Todd Veldhuizen +# Copyright (c) 2008 Luc Maisonobe +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 8 + +AU_ALIAS([AC_CXX_TYPENAME], [AX_CXX_TYPENAME]) +AC_DEFUN([AX_CXX_TYPENAME], +[AC_CACHE_CHECK(whether the compiler recognizes typename, +ax_cv_cxx_typename, +[AC_LANG_PUSH([C++]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[templateclass X {public:X(){}};]], + [[X z; return 0;]])], + [ax_cv_cxx_typename=yes], [ax_cv_cxx_typename=no]) + AC_LANG_POP([C++]) +]) +if test "$ax_cv_cxx_typename" = yes; then + AC_DEFINE(HAVE_TYPENAME,,[define if the compiler recognizes typename]) +fi +]) diff --git a/etc/m4/ax_elisp.m4 b/etc/m4/ax_elisp.m4 new file mode 100644 index 0000000..09da26d --- /dev/null +++ b/etc/m4/ax_elisp.m4 @@ -0,0 +1,170 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_elisp.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_ELISP_CONFIG_FILE(FILENAME) +# AX_ELISP_CHECK(SYMBOL,DESCRIPTION,BODY,SUCCESS-EXPR) +# AX_ELISP_CHECK_FEATURE(SYMBOL) +# AX_ELISP_CHECK_FBOUNDP(SYMBOL,[FEATURE [...]]) +# AX_ELISP_CHECK_BOUNDP(SYMBOL,[FEATURE [...]]) +# +# DESCRIPTION +# +# This is a simple library to check the Emacs reality by way of Emacs Lisp +# forms evaluated under $EMACS --batch -Q. This means you MUST have the +# shell variable EMACS set to a valid Emacs executable prior to the first +# call to any of the AX_ELISP_CHECK et al macros. Those work by saving +# their results to the file defined by calling AX_ELISP_CONFIG_FILE so you +# MUST call that prior, too. For example: +# +# dnl Arrange to save config answers in $top_builddir/lisp/config.el. +# AX_ELISP_CONFIG_FILE([lisp/config.el]) +# +# dnl Set shell variable EMACS and AC_SUBST it, too. +# dnl (NB: This is a separate Autoconf Archive macro.) +# AX_PROG_EMACS +# +# In the following detailed descriptions, SYMBOL stands for an Emacs Lisp +# symbol, which may contain hyphens, e.g., 'define-error' or 'org-src'. +# Likewise, FEATURE is an Emacs Lisp symbol (naming a feature). BODY and +# SUCCESS-EXPR are Emacs Lisp forms, zero or more for BODY and exactly one +# for SUCCESS-EXPR. In these forms you must take care to avoid apostrophe +# (U+27). Instead of 'foo, write (quote foo). +# +# * AX_ELISP_CONFIG_FILE(FILENAME) +# +# This arranges for future AX_ELISP_CHECK (et al) calls to save their +# results in FILENAME. May be called multiple times. FILENAME should be +# relative to the top build dir. +# +# * AX_ELISP_CHECK(SYMBOL,DESCRIPTION,BODY,SUCCESS-EXPR) +# +# This is the general macro that the other AX_ELISP_CHECK* macros use. It +# constructs a short Emacs Lisp file comprising BODY and evaluates it via +# $EMACS --batch -Q. The exit value of this script depends on the result +# of evaluating SUCCESS-EXPR: non-nil is success and nil is failure. On +# success, append SYMBOL on a line of its own to the config file. This +# macro uses AC_CACHE_CHECK and passes DESCRIPTION to it. +# +# * AX_ELISP_CHECK_FEATURE(FEATURE) +# +# This checks if (require (quote FEATURE)) is successful. If so, add +# featurep-FEATURE to the config file (NB the "featurep-" prefix). +# +# * AX_ELISP_CHECK_FBOUNDP(SYMBOL,[FEATURE [...]]) +# +# This checks if (fboundp (quote SYMBOL)) is successful. If so, append +# SYMBOL to the config file. Optional 2nd arg is a space-separated list of +# features to require prior to the fboundp check. +# +# * AX_ELISP_CHECK_BOUNDP(SYMBOL,[FEATURE [...]]) +# +# This checks if (boundp (quote SYMBOL)) is successful. If so, append +# SYMBOL to the config file. Optional 2nd arg is a space-separated list of +# features to require prior to the boundp check. +# +# LICENSE +# +# Copyright (c) 2016-2017 Thien-Thi Nguyen +# +# 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 . +# +# 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 2 + +AC_DEFUN([AX_ELISP_CONFIG_FILE],[dnl +dnl 1 -- relative filename (from 'top_srcdir') +m4_define([AX_ELISP__CONFIG_FILENAME],[$1])dnl +])dnl + + +AC_DEFUN([AX_ELISP__PREP],[dnl +AS_IF([AS_VAR_TEST_SET([EMACS])],,dnl + [AC_MSG_ERROR([No value for EMACS])]) +dnl FIXME: Check at autoconf-time that AX_ELISP__CONFIG_FILENAME is set. +dnl (If not, or if the value is unsuitable, throw fatal error.) +rm -f AX_ELISP__CONFIG_FILENAME +touch AX_ELISP__CONFIG_FILENAME +])dnl + + +AC_DEFUN([AX_ELISP_CHECK],[dnl +dnl 1 -- Emacs Lisp symbol to add to config file if "success" +dnl 2 -- description +dnl 3 -- Emacs Lisp body (zero or more forms) +dnl 4 -- Emacs Lisp expression for "success" +AC_REQUIRE([AX_ELISP__PREP])dnl +AS_VAR_PUSHDEF([CV],[elisp_cv_$1])dnl +AC_CACHE_CHECK([$2],[CV],[dnl +cat >conftest.el <&5 2>&5],[CV=yes],[CV=no])]) +AS_IF([test yes = $[]CV],[echo "$1" >> AX_ELISP__CONFIG_FILENAME]) +AS_VAR_POPDEF([CV])dnl +])dnl + + +AC_DEFUN([AX_ELISP_CHECK_FEATURE],[dnl +dnl 1 -- Emacs Lisp symbol (a feature name) +AC_REQUIRE([AX_ELISP__PREP])dnl +AX_ELISP_CHECK([featurep-$1],[if $EMACS supports feature '$1'],[dnl +(require (quote $1)) +],[dnl +(featurep (quote $1)) +])]) + + +AC_DEFUN([AX_ELISP_CHECK_FBOUNDP],[dnl +dnl 1 -- Emacs Lisp symbol +dnl 2 -- (optional) space-separated list of features to 'require' +AX_ELISP_CHECK([$1],[if '$1' is defined],[dnl +m4_foreach([FEATURE],m4_split(m4_normalize($2)),[dnl +(require 'FEATURE) +])],[(fboundp '$1)])])dnl + + +AC_DEFUN([AX_ELISP_CHECK_BOUNDP],[dnl +dnl 1 -- Emacs Lisp symbol +dnl 2 -- (optional) space-separated list of features to 'require' +AX_ELISP_CHECK([$1],[if '$1' is defined],[dnl +m4_foreach([FEATURE],m4_split(m4_normalize($2)),[dnl +(require 'FEATURE) +])],[(boundp '$1)])])dnl + + +dnl TODO: +dnl - Add error checking (see FIXME in code). +dnl - Validate m4 mumblings -- is this the right crazy?! +dnl - Add customization of $EMACS invocation. +dnl +dnl Local variables: +dnl mode: autoconf +dnl End: +dnl ax_elisp.m4 ends here diff --git a/etc/m4/ax_lapack.m4 b/etc/m4/ax_lapack.m4 new file mode 100644 index 0000000..abaff9d --- /dev/null +++ b/etc/m4/ax_lapack.m4 @@ -0,0 +1,134 @@ +# =========================================================================== +# 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= in order to use some specific +# LAPACK library . 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 +# Copyright (c) 2019 Geoffrey M. Oxberry +# +# 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 . +# +# 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 10 + +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=], [use LAPACK library ])]) +case $with_lapack in + yes | "") ;; + no) ax_lapack_ok=disable ;; + -* | */* | *.a | *.so | *.so.* | *.dylib | *.dylib.* | *.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/etc/m4/ax_mpi.m4 b/etc/m4/ax_mpi.m4 index 8a9e9df..f6db3d0 100644 --- a/etc/m4/ax_mpi.m4 +++ b/etc/m4/ax_mpi.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_mpi.html +# https://www.gnu.org/software/autoconf-archive/ax_mpi.html # =========================================================================== # # SYNOPSIS @@ -19,26 +19,13 @@ # are needed for linking MPI (e.g. -lmpi or -lfmpi, if a special # MPICC/MPICXX/MPIF77/MPIFC was not found). # -# If you want to compile everything with MPI, you should use something -# like this for C: -# -# if test -z "$CC" && test -n "$MPICC"; then -# CC="$MPICC" -# fi -# AC_PROG_CC -# AX_MPI -# CC="$MPICC" -# LIBS="$MPILIBS $LIBS" -# -# and similar for C++ (change all instances of CC to CXX), Fortran 77 -# (with F77 instead of CC) or Fortran (with FC instead of CC). -# -# NOTE: The above assumes that you will use $CC (or whatever) for linking -# as well as for compiling. (This is the default for automake and most -# Makefiles.) -# -# The user can force a particular library/compiler by setting the -# MPICC/MPICXX/MPIF77/MPIFC and/or MPILIBS environment variables. +# Note that this macro should be used only if you just have a few source +# files that need to be compiled using MPI. In particular, you should +# neither overwrite CC/CXX/F77/FC with the values of +# MPICC/MPICXX/MPIF77/MPIFC, nor assume that you can use the same flags +# etc. as the standard compilers. If you want to compile a whole program +# using the MPI compiler commands, use one of the macros +# AX_PROG_{CC,CXX,FC}_MPI. # # ACTION-IF-FOUND is a list of shell commands to run if an MPI library is # found, and ACTION-IF-NOT-FOUND is a list of commands to run if it is not @@ -61,7 +48,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -76,11 +63,11 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 7 +#serial 9 AU_ALIAS([ACX_MPI], [AX_MPI]) AC_DEFUN([AX_MPI], [ -AC_PREREQ([2.50]) dnl for AC_LANG_CASE +AC_PREREQ(2.50) dnl for AC_LANG_CASE AC_LANG_CASE([C], [ AC_REQUIRE([AC_PROG_CC]) @@ -119,7 +106,7 @@ if test x = x"$MPILIBS"; then AC_LANG_CASE([C], [AC_CHECK_FUNC(MPI_Init, [MPILIBS=" "])], [C++], [AC_CHECK_FUNC(MPI_Init, [MPILIBS=" "])], [Fortran 77], [AC_MSG_CHECKING([for MPI_Init]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[ call MPI_Init])],[MPILIBS="" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[ call MPI_Init])],[MPILIBS=" " AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])], [Fortran], [AC_MSG_CHECKING([for MPI_Init]) AC_LINK_IFELSE([AC_LANG_PROGRAM([],[ call MPI_Init])],[MPILIBS=" " @@ -132,9 +119,6 @@ AC_LANG_CASE([Fortran 77], [ if test x = x"$MPILIBS"; then AC_CHECK_LIB(fmpich, MPI_Init, [MPILIBS="-lfmpich"]) fi - if test x = x"$MPILIBS"; then - AC_CHECK_LIB(mpif77, MPI_Init, [MPILIBS="-lmpif77"]) - fi ], [Fortran], [ if test x = x"$MPILIBS"; then @@ -151,16 +135,16 @@ if test x = x"$MPILIBS"; then AC_CHECK_LIB(mpich, MPI_Init, [MPILIBS="-lmpich"]) fi -dnl We have to use AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[]) and not AC_CHECK_HEADER because the +dnl We have to use AC_TRY_COMPILE and not AC_CHECK_HEADER because the dnl latter uses $CPP, not $CC (which may be mpicc). AC_LANG_CASE([C], [if test x != x"$MPILIBS"; then AC_MSG_CHECKING([for mpi.h]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[]])],[AC_MSG_RESULT(yes)],[MPILIBS="" + AC_TRY_COMPILE([#include ],[],[AC_MSG_RESULT(yes)], [MPILIBS="" AC_MSG_RESULT(no)]) fi], [C++], [if test x != x"$MPILIBS"; then AC_MSG_CHECKING([for mpi.h]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[]])],[AC_MSG_RESULT(yes)],[MPILIBS="" + AC_TRY_COMPILE([#include ],[],[AC_MSG_RESULT(yes)], [MPILIBS="" AC_MSG_RESULT(no)]) fi], [Fortran 77], [if test x != x"$MPILIBS"; then diff --git a/etc/m4/ax_openmp.m4 b/etc/m4/ax_openmp.m4 index 4d5d88b..866e1d6 100644 --- a/etc/m4/ax_openmp.m4 +++ b/etc/m4/ax_openmp.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_openmp.html +# https://www.gnu.org/software/autoconf-archive/ax_openmp.html # =========================================================================== # # SYNOPSIS @@ -39,6 +39,7 @@ # # Copyright (c) 2008 Steven G. Johnson # Copyright (c) 2015 John W. Peterson +# Copyright (c) 2016 Nick R. Papior # # 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 @@ -51,7 +52,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -66,16 +67,19 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 11 +#serial 13 AC_DEFUN([AX_OPENMP], [ AC_PREREQ([2.69]) dnl for _AC_LANG_PREFIX AC_CACHE_CHECK([for OpenMP flag of _AC_LANG compiler], ax_cv_[]_AC_LANG_ABBREV[]_openmp, [save[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS ax_cv_[]_AC_LANG_ABBREV[]_openmp=unknown -# Flags to try: -fopenmp (gcc), -openmp (icc), -mp (SGI & PGI), -# -xopenmp (Sun), -omp (Tru64), -qsmp=omp (AIX), none -ax_openmp_flags="-fopenmp -openmp -mp -xopenmp -omp -qsmp=omp none" +# Flags to try: -fopenmp (gcc), -mp (SGI & PGI), +# -qopenmp (icc>=15), -openmp (icc), +# -xopenmp (Sun), -omp (Tru64), +# -qsmp=omp (AIX), +# none +ax_openmp_flags="-fopenmp -openmp -qopenmp -mp -xopenmp -omp -qsmp=omp none" if test "x$OPENMP_[]_AC_LANG_PREFIX[]FLAGS" != x; then ax_openmp_flags="$OPENMP_[]_AC_LANG_PREFIX[]FLAGS $ax_openmp_flags" fi diff --git a/etc/m4/ax_prog_cxx_mpi.m4 b/etc/m4/ax_prog_cxx_mpi.m4 new file mode 100644 index 0000000..36b66f0 --- /dev/null +++ b/etc/m4/ax_prog_cxx_mpi.m4 @@ -0,0 +1,178 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_prog_cxx_mpi.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_CXX_MPI([MPI-WANTED-TEST[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]]) +# +# DESCRIPTION +# +# This macro tries to find out how to compile C++ programs that use MPI +# (Message Passing Interface), a standard API for parallel process +# communication (see http://www-unix.mcs.anl.gov/mpi/). The macro has to +# be used instead of the standard macro AC_PROG_CXX and will replace the +# standard variable CXX with the found compiler. +# +# MPI-WANTED-TEST is used to test whether MPI is actually wanted by the +# user. If MPI-WANTED_TEST is omitted or if it succeeds, the macro will +# try to find out how to use MPI, if it fails, the macro will call +# AC_PROG_CC to find a standard C compiler instead. +# +# When MPI is found, ACTION-IF-FOUND will be executed, if MPI is not found +# (or MPI-WANTED-TEST fails) ACTION-IF-NOT-FOUND is executed. If +# ACTION-IF-FOUND is not set, the macro will define HAVE_MPI. +# +# The following example demonstrates usage of the macro: +# +# # If --with-mpi=auto is used, try to find MPI, but use standard C compiler if it is not found. +# # If --with-mpi=yes is used, try to find MPI and fail if it isn't found. +# # If --with-mpi=no is used, use a standard C compiler instead. +# AC_ARG_WITH(mpi, [AS_HELP_STRING([--with-mpi], +# [compile with MPI (parallelization) support. If none is found, +# MPI is not used. Default: auto]) +# ],,[with_mpi=auto]) +# +# AX_PROG_CXX_MPI([test x"$with_mpi" != xno],[use_mpi=yes],[ +# use_mpi=no +# if test x"$with_mpi" = xyes; then +# AC_MSG_FAILURE([MPI compiler requested, but couldn't use MPI.]) +# else +# AC_MSG_WARN([No MPI compiler found, won't use MPI.]) +# fi +# ]) +# +# LICENSE +# +# Copyright (c) 2010,2011 Olaf Lenz +# +# 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 . +# +# 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 3 + +AC_DEFUN([AX_PROG_CXX_MPI], [ +AC_PREREQ(2.50) + +# Check for compiler +# Needs to be split off into an extra macro to ensure right expansion +# order. +AC_REQUIRE([_AX_PROG_CXX_MPI],[_AX_PROG_CXX_MPI([$1])]) + +AS_IF([test x"$_ax_prog_cxx_mpi_mpi_wanted" = xno], + [ _ax_prog_cxx_mpi_mpi_found=no ], + [ + AC_LANG_PUSH([C++]) + + # test whether MPI_Init() is available + # We do not use AC_SEARCH_LIBS here, as it caches its outcome and + # thus disallows corresponding calls in the other AX_PROG_*_MPI + # macros. + for lib in NONE mpi mpich; do + save_LIBS=$LIBS + if test x"$lib" = xNONE; then + AC_MSG_CHECKING([for function MPI_Init]) + else + AC_MSG_CHECKING([for function MPI_Init in -l$lib]) + LIBS="-l$lib $LIBS" + fi + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ +extern "C" { void MPI_Init(); } +],[MPI_Init();])], + [ _ax_prog_cxx_mpi_mpi_found=yes ], + [ _ax_prog_cxx_mpi_mpi_found=no ]) + AC_MSG_RESULT($_ax_prog_cxx_mpi_mpi_found) + if test "x$_ax_prog_cxx_mpi_mpi_found" = "xyes"; then + break; + fi + LIBS=$save_LIBS + done + + # Check for header + AS_IF([test x"$_ax_prog_cxx_mpi_mpi_found" = xyes], [ + AC_MSG_CHECKING([for mpi.h]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ])], + [ AC_MSG_RESULT(yes)], + [ AC_MSG_RESULT(no) + _ax_prog_cxx_mpi_mpi_found=no + ]) + ]) + AC_LANG_POP([C++]) +]) + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +AS_IF([test x"$_ax_prog_cxx_mpi_mpi_found" = xyes], [ + ifelse([$2],,[AC_DEFINE(HAVE_MPI,1,[Define if you have the MPI library.])],[$2]) + : +],[ + $3 + : +]) + +])dnl AX_PROG_CXX_MPI + +dnl _AX_PROG_CXX_MPI is an internal macro required by AX_PROG_CXX_MPI. +dnl To ensure the right expansion order, the main function AX_PROG_CXX_MPI +dnl has to be split into two parts. +dnl +dnl Known MPI C++ compilers: +dnl mpic++ +dnl mpicxx +dnl mpiCC +dnl sxmpic++ NEC SX +dnl hcp +dnl mpxlC_r +dnl mpxlC +dnl mpixlcxx_r +dnl mpixlcxx +dnl mpg++ +dnl mpc++ +dnl mpCC +dnl cmpic++ +dnl mpiFCC Fujitsu +dnl CC +dnl +AC_DEFUN([_AX_PROG_CXX_MPI], [ + AC_ARG_VAR(MPICXX,[MPI C++ compiler command]) + ifelse([$1],,[_ax_prog_cxx_mpi_mpi_wanted=yes],[ + AC_MSG_CHECKING([whether to compile using MPI]) + if $1; then + _ax_prog_cxx_mpi_mpi_wanted=yes + else + _ax_prog_cxx_mpi_mpi_wanted=no + fi + AC_MSG_RESULT($_ax_prog_cxx_mpi_mpi_wanted) + ]) + if test x"$_ax_prog_cxx_mpi_mpi_wanted" = xyes; then + if test -z "$CXX" && test -n "$MPICXX"; then + CXX="$MPICXX" + else + AC_CHECK_TOOLS([CXX], [mpic++ mpicxx mpiCC sxmpic++ hcp mpxlC_r mpxlC mpixlcxx_r mpixlcxx mpg++ mpc++ mpCC cmpic++ mpiFCC CCicpc pgCC pathCC sxc++ xlC_r xlC bgxlC_r bgxlC openCC sunCC crayCC g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC]) + fi + fi + AC_PROG_CXX +])dnl _AX_PROG_CXX_MPI diff --git a/etc/m4/ax_prog_emacs.m4 b/etc/m4/ax_prog_emacs.m4 new file mode 100644 index 0000000..8ca142b --- /dev/null +++ b/etc/m4/ax_prog_emacs.m4 @@ -0,0 +1,68 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_prog_emacs.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_EMACS +# +# DESCRIPTION +# +# This macro allows the end user to specify a particular Emacs executable +# via a configure script command-line arg. For example: +# +# ./configure EMACS=$HOME/build/GNU/emacs/src/emacs +# +# It also arranges to mention env var EMACS in the './configure --help' +# output. See info node "(autoconf) Generic Programs" for details. +# +# More precisely... +# +# If env var EMACS is set, try to use its value directly, but avoid +# getting fooled by value 't' (set by older Emacsen for subprocesses). If +# no joy from the environment, search for "emacs" via AC_CHECK_PROG. If +# still no joy, display "Emacs not found; required!" and make configure +# exit failurefully. Otherwise, set shell var EMACS and AC_SUBST it, too. +# +# LICENSE +# +# Copyright (c) 2016-2017 Thien-Thi Nguyen +# +# 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 . +# +# 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 2 + +AC_DEFUN([AX_PROG_EMACS],[dnl +AC_ARG_VAR([EMACS],[Use this Emacs to byte-compile the Emacs Lisp files.]) +dnl Allow env override but do not get fooled by 'EMACS=t'. +test t = "$EMACS" && unset EMACS +dnl The next line does nothing if var 'EMACS' is already set. +AC_CHECK_PROG([EMACS], [emacs], [emacs]) +AS_IF([test "x$EMACS" = x],[AC_MSG_ERROR([Emacs not found; required!])]) +])dnl + +dnl ax_prog_emacs.m4 ends here