From 2f443076981f7f2661e8bef060c26e80e2aefbc5 Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Sat, 18 Oct 2025 07:44:40 -0500 Subject: [PATCH 1/4] Simplified configure.ac, work in progress --- .github/workflows/ci.yaml | 5 +- configure | 267 +++++++++++++++++++------------------- configure.ac | 249 +++++++++++++++++++---------------- 3 files changed, 271 insertions(+), 250 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2d26d33d..c5bb68be 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,7 +14,7 @@ jobs: strategy: matrix: include: - #- {os: macOS-latest} + - {os: macOS-latest} - {os: ubuntu-latest} runs-on: ${{ matrix.os }} @@ -26,6 +26,9 @@ jobs: - name: Setup uses: eddelbuettel/github-actions/r-ci@master + - name: Configure + run: ./configure; cat src/Makevars + - name: Dependencies run: ./run.sh install_deps diff --git a/configure b/configure index 4f0e79c6..339d23f7 100755 --- a/configure +++ b/configure @@ -3227,11 +3227,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ## Is R already configured to compile things using OpenMP without ## any extra hand-holding? -openmp_already_works="no" +#openmp_already_works="no" ## default to not even thinking about OpenMP as Armadillo wants a pragma ## variant available if and only if C++11 is used with g++ 5.4 or newer -can_use_openmp="no" +#can_use_openmp="no" ## Ensure TMPDIR is set. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we have a suitable tempdir" >&5 @@ -3264,154 +3264,153 @@ if test x"$?" = x"0"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } openmp_already_works="yes" + arma_have_openmp="#define ARMA_USE_OPENMP 1" + can_use_openmp="yes" else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } + openmp_already_works="no" + arma_have_openmp="#define ARMA_DONT_USE_OPENMP 1" + can_use_openmp="no" fi ## Go back home. cd "${owd}" rm -rf "${BUILDDIR}" -## If the above checks failed, then perform other heuristics -## based on the compiler version, etc. -if test x"${openmp_already_works}" = x"no"; then - - ## Check the C++ compiler using the CXX value set - - ## If it is g++, we have GXX set so let's examine it - if test "${GXX}" = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether g++ version is sufficient" >&5 -printf %s "checking whether g++ version is sufficient... " >&6; } - gxx_version=$(${CXX} -v 2>&1 | awk '/^.*g.. version/ {print $3}') - case ${gxx_version} in - 1.*|2.*|3.*|4.0.*|4.1.*|4.2.*|4.3.*|4.4.*|4.5.*|4.6.*|4.7.0|4.7.1) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Only g++ version 4.7.2 or greater can be used with RcppArmadillo." >&5 -printf "%s\n" "$as_me: WARNING: Only g++ version 4.7.2 or greater can be used with RcppArmadillo." >&2;} - as_fn_error $? "Please use a different compiler." "$LINENO" 5 - ;; - 4.7.*|4.8.*|4.9.*|5.0*|5.1*|5.2*|5.3*) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, but without OpenMP as version ${gxx_version} (Armadillo constraint)" >&5 -printf "%s\n" "yes, but without OpenMP as version ${gxx_version} (Armadillo constraint)" >&6; } - ## we know this one is bad - can_use_openmp="no" - ;; - 5.4*|5.5*|5.6*|5.7*|5.8*|5.9*|6.*|7.*|8.*|9.*|1?.*) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, with OpenMP as version ${gxx_version}" >&5 -printf "%s\n" "yes, with OpenMP as version ${gxx_version}" >&6; } - ## we know this one is good, yay - can_use_openmp="yes" - ;; - *) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: almost" >&5 -printf "%s\n" "almost" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Compiler self-identifies as being compliant with GNUC extensions but is not g++." >&5 -printf "%s\n" "$as_me: WARNING: Compiler self-identifies as being compliant with GNUC extensions but is not g++." >&2;} - ## we know nothing, so no - can_use_openmp="no" - ;; - esac - fi +# ## If the above checks failed, then perform other heuristics +# ## based on the compiler version, etc. +# if test x"${openmp_already_works}" = x"no"; then +# +# ## Check the C++ compiler using the CXX value set +# +# ## If it is g++, we have GXX set so let's examine it +# if test "${GXX}" = yes; then +# AC_MSG_CHECKING([whether g++ version is sufficient]) +# gxx_version=$(${CXX} -v 2>&1 | awk '/^.*g.. version/ {print $3}') +# case ${gxx_version} in +# 1.*|2.*|3.*|4.0.*|4.1.*|4.2.*|4.3.*|4.4.*|4.5.*|4.6.*|4.7.0|4.7.1) +# AC_MSG_RESULT([no]) +# AC_MSG_WARN([Only g++ version 4.7.2 or greater can be used with RcppArmadillo.]) +# AC_MSG_ERROR([Please use a different compiler.]) +# ;; +# 4.7.*|4.8.*|4.9.*|5.0*|5.1*|5.2*|5.3*) +# AC_MSG_RESULT([yes, but without OpenMP as version ${gxx_version} (Armadillo constraint)]) +# ## we know this one is bad +# can_use_openmp="no" +# ;; +# 5.4*|5.5*|5.6*|5.7*|5.8*|5.9*|6.*|7.*|8.*|9.*|1?.*) +# AC_MSG_RESULT([yes, with OpenMP as version ${gxx_version}]) +# ## we know this one is good, yay +# can_use_openmp="yes" +# ;; +# *) +# AC_MSG_RESULT([almost]) +# AC_MSG_WARN([Compiler self-identifies as being compliant with GNUC extensions but is not g++.]) +# ## we know nothing, so no +# can_use_openmp="no" +# ;; +# esac +# fi +# +# ## Check for Apple LLVM +# +# AC_MSG_CHECKING([for macOS]) +# RSysinfoName=$("${R_HOME}/bin/Rscript" --vanilla -e 'cat(Sys.info()[["sysname"]])') +# +# if test x"${RSysinfoName}" = x"Darwin"; then +# AC_MSG_RESULT([found]) +# AC_MSG_CHECKING([for macOS Apple compiler]) +# +# apple_compiler=$($CXX --version 2>&1 | grep -i -c -e 'apple llvm') +# +# if test x"${apple_compiler}" = x"1"; then +# AC_MSG_RESULT([found]) +# AC_MSG_WARN([OpenMP unavailable and turned off.]) +# can_use_openmp="no" +# else +# AC_MSG_RESULT([not found]) +# AC_MSG_CHECKING([for clang compiler]) +# clang_compiler=$($CXX --version 2>&1 | grep -i -c -e 'clang ') +# +# if test x"${clang_compiler}" = x"1"; then +# AC_MSG_RESULT([found]) +# AC_MSG_CHECKING([for OpenMP compatible version of clang]) +# clang_version=$(${CXX} -v 2>&1 | awk '/^.*clang version/ {print $3}') +# +# case ${clang_version} in +# 4.*|5.*|6.*|7.*|8.*|9.*|10.*|11.*) +# AC_MSG_RESULT([found and suitable]) +# can_use_openmp="yes" +# ;; +# *) +# AC_MSG_RESULT([not found]) +# AC_MSG_WARN([OpenMP unavailable and turned off.]) +# can_use_openmp="no" +# ;; +# esac +# else +# AC_MSG_RESULT([not found]) +# AC_MSG_WARN([unsupported macOS build detected; if anything breaks, you keep the pieces.]) +# fi +# fi +# else +# AC_MSG_RESULT([no]) +# fi +# +# fi # if test x"${openmp_already_works}" = x"no" - ## Check for Apple LLVM +# ## Check for suitable LAPACK_LIBS +# AC_MSG_CHECKING([LAPACK_LIBS]) +# +# ## external LAPACK has the required function +# lapack=$(${R_HOME}/bin/R CMD config LAPACK_LIBS) +# hasRlapack=$(echo ${lapack} | grep lRlapack) +# +# ## in what follows below we substitute both side of the define/undef +# ## while this may seem a little unusual we do it to fully reproduce the +# ## previous bash-based implementation +# +# if test x"${hasRlapack}" = x""; then +# ## We are using a full Lapack and can use zgbsv -- so #undef remains +# AC_MSG_RESULT([system LAPACK found]) +# ## arma_lapack="#undef ARMA_CRIPPLED_LAPACK" +# else +# ## We are using R's subset of Lapack and CANNOT use zgbsv etc, so we mark it +# AC_MSG_RESULT([R-supplied partial LAPACK found]) +# ## AC_MSG_WARN([Some complex-valued LAPACK functions may not be available]) +# ## arma_lapack="#define ARMA_CRIPPLED_LAPACK 1" +# fi +# +# ## Default the OpenMP flag to the empty string. +# ## If and only if OpenMP is found, expand to $(SHLIB_OPENMP_CXXFLAGS) +# openmp_flag="" +# +# ## Set the fallback, by default it is nope +# arma_have_openmp="#define ARMA_DONT_USE_OPENMP 1" +# +# if test x"${openmp_already_works}" = x"yes"; then +# arma_have_openmp="#define ARMA_USE_OPENMP 1" +# openmp_flag='$(SHLIB_OPENMP_CXXFLAGS)' +# fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for macOS" >&5 +## Additional Apple check +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for macOS" >&5 printf %s "checking for macOS... " >&6; } - RSysinfoName=$("${R_HOME}/bin/Rscript" --vanilla -e 'cat(Sys.info()["sysname"])') - - if test x"${RSysinfoName}" = x"Darwin"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found" >&5 +RSysinfoName=$("${R_HOME}/bin/Rscript" --vanilla -e 'cat(Sys.info()["sysname"])') +if test x"${RSysinfoName}" = x"Darwin"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found" >&5 printf "%s\n" "found" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for macOS Apple compiler" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for macOS Apple compiler" >&5 printf %s "checking for macOS Apple compiler... " >&6; } - - apple_compiler=$($CXX --version 2>&1 | grep -i -c -e 'apple llvm') - - if test x"${apple_compiler}" = x"1"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found" >&5 + apple_compiler=$($CXX --version 2>&1 | grep -i -c -e 'apple llvm') + if test x"${apple_compiler}" = x"1"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found" >&5 printf "%s\n" "found" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: OpenMP unavailable and turned off." >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: OpenMP unavailable and turned off." >&5 printf "%s\n" "$as_me: WARNING: OpenMP unavailable and turned off." >&2;} - can_use_openmp="no" - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clang compiler" >&5 -printf %s "checking for clang compiler... " >&6; } - clang_compiler=$($CXX --version 2>&1 | grep -i -c -e 'clang ') - - if test x"${clang_compiler}" = x"1"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found" >&5 -printf "%s\n" "found" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenMP compatible version of clang" >&5 -printf %s "checking for OpenMP compatible version of clang... " >&6; } - clang_version=$(${CXX} -v 2>&1 | awk '/^.*clang version/ {print $3}') - - case ${clang_version} in - 4.*|5.*|6.*|7.*|8.*|9.*|10.*|11.*) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found and suitable" >&5 -printf "%s\n" "found and suitable" >&6; } - can_use_openmp="yes" - ;; - *) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: OpenMP unavailable and turned off." >&5 -printf "%s\n" "$as_me: WARNING: OpenMP unavailable and turned off." >&2;} - can_use_openmp="no" - ;; - esac - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unsupported macOS build detected; if anything breaks, you keep the pieces." >&5 -printf "%s\n" "$as_me: WARNING: unsupported macOS build detected; if anything breaks, you keep the pieces." >&2;} - fi - fi - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + can_use_openmp="no" fi - -fi # if test x"${openmp_already_works}" = x"no" - -## Check for suitable LAPACK_LIBS -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking LAPACK_LIBS" >&5 -printf %s "checking LAPACK_LIBS... " >&6; } - -## external LAPACK has the required function -lapack=$(${R_HOME}/bin/R CMD config LAPACK_LIBS) -hasRlapack=$(echo ${lapack} | grep lRlapack) - -## in what follows below we substitute both side of the define/undef -## while this may seem a little unusual we do it to fully reproduce the -## previous bash-based implementation - -if test x"${hasRlapack}" = x""; then - ## We are using a full Lapack and can use zgbsv -- so #undef remains - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: system LAPACK found" >&5 -printf "%s\n" "system LAPACK found" >&6; } - ## arma_lapack="#undef ARMA_CRIPPLED_LAPACK" -else - ## We are using R's subset of Lapack and CANNOT use zgbsv etc, so we mark it - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: R-supplied partial LAPACK found" >&5 -printf "%s\n" "R-supplied partial LAPACK found" >&6; } - ## AC_MSG_WARN([Some complex-valued LAPACK functions may not be available]) - ## arma_lapack="#define ARMA_CRIPPLED_LAPACK 1" -fi - -## Default the OpenMP flag to the empty string. -## If and only if OpenMP is found, expand to $(SHLIB_OPENMP_CXXFLAGS) -openmp_flag="" - -## Set the fallback, by default it is nope -arma_have_openmp="#define ARMA_DONT_USE_OPENMP 1" - -if test x"${openmp_already_works}" = x"yes"; then - arma_have_openmp="#define ARMA_USE_OPENMP 1" - openmp_flag='$(SHLIB_OPENMP_CXXFLAGS)' fi if test x"${can_use_openmp}" = x"yes"; then @@ -3424,6 +3423,7 @@ printf %s "checking for OpenMP... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: missing" >&5 printf "%s\n" "missing" >&6; } arma_have_openmp="#define ARMA_DONT_USE_OPENMP 1" + openmp_flag="" else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found and suitable" >&5 printf "%s\n" "found and suitable" >&6; } @@ -3432,7 +3432,6 @@ printf "%s\n" "found and suitable" >&6; } fi fi - ## now use all these ## AC_SUBST([ARMA_LAPACK],["${arma_lapack}"]) ARMA_HAVE_OPENMP="${arma_have_openmp}" diff --git a/configure.ac b/configure.ac index 9c315336..839ca046 100644 --- a/configure.ac +++ b/configure.ac @@ -30,11 +30,11 @@ AC_PROG_CXX ## Is R already configured to compile things using OpenMP without ## any extra hand-holding? -openmp_already_works="no" +#openmp_already_works="no" ## default to not even thinking about OpenMP as Armadillo wants a pragma ## variant available if and only if C++11 is used with g++ 5.4 or newer -can_use_openmp="no" +#can_use_openmp="no" ## Ensure TMPDIR is set. AC_MSG_CHECKING([whether we have a suitable tempdir]) @@ -63,128 +63,147 @@ EOF if test x"$?" = x"0"; then AC_MSG_RESULT([yes]) openmp_already_works="yes" + arma_have_openmp="#define ARMA_USE_OPENMP 1" + can_use_openmp="yes" else AC_MSG_RESULT([no]) + openmp_already_works="no" + arma_have_openmp="#define ARMA_DONT_USE_OPENMP 1" + can_use_openmp="no" fi ## Go back home. cd "${owd}" rm -rf "${BUILDDIR}" -## If the above checks failed, then perform other heuristics -## based on the compiler version, etc. -if test x"${openmp_already_works}" = x"no"; then - - ## Check the C++ compiler using the CXX value set - - ## If it is g++, we have GXX set so let's examine it - if test "${GXX}" = yes; then - AC_MSG_CHECKING([whether g++ version is sufficient]) - gxx_version=$(${CXX} -v 2>&1 | awk '/^.*g.. version/ {print $3}') - case ${gxx_version} in - 1.*|2.*|3.*|4.0.*|4.1.*|4.2.*|4.3.*|4.4.*|4.5.*|4.6.*|4.7.0|4.7.1) - AC_MSG_RESULT([no]) - AC_MSG_WARN([Only g++ version 4.7.2 or greater can be used with RcppArmadillo.]) - AC_MSG_ERROR([Please use a different compiler.]) - ;; - 4.7.*|4.8.*|4.9.*|5.0*|5.1*|5.2*|5.3*) - AC_MSG_RESULT([yes, but without OpenMP as version ${gxx_version} (Armadillo constraint)]) - ## we know this one is bad - can_use_openmp="no" - ;; - 5.4*|5.5*|5.6*|5.7*|5.8*|5.9*|6.*|7.*|8.*|9.*|1?.*) - AC_MSG_RESULT([yes, with OpenMP as version ${gxx_version}]) - ## we know this one is good, yay - can_use_openmp="yes" - ;; - *) - AC_MSG_RESULT([almost]) - AC_MSG_WARN([Compiler self-identifies as being compliant with GNUC extensions but is not g++.]) - ## we know nothing, so no - can_use_openmp="no" - ;; - esac - fi - - ## Check for Apple LLVM - - AC_MSG_CHECKING([for macOS]) - RSysinfoName=$("${R_HOME}/bin/Rscript" --vanilla -e 'cat(Sys.info()[["sysname"]])') - - if test x"${RSysinfoName}" = x"Darwin"; then +# ## If the above checks failed, then perform other heuristics +# ## based on the compiler version, etc. +# if test x"${openmp_already_works}" = x"no"; then +# +# ## Check the C++ compiler using the CXX value set +# +# ## If it is g++, we have GXX set so let's examine it +# if test "${GXX}" = yes; then +# AC_MSG_CHECKING([whether g++ version is sufficient]) +# gxx_version=$(${CXX} -v 2>&1 | awk '/^.*g.. version/ {print $3}') +# case ${gxx_version} in +# 1.*|2.*|3.*|4.0.*|4.1.*|4.2.*|4.3.*|4.4.*|4.5.*|4.6.*|4.7.0|4.7.1) +# AC_MSG_RESULT([no]) +# AC_MSG_WARN([Only g++ version 4.7.2 or greater can be used with RcppArmadillo.]) +# AC_MSG_ERROR([Please use a different compiler.]) +# ;; +# 4.7.*|4.8.*|4.9.*|5.0*|5.1*|5.2*|5.3*) +# AC_MSG_RESULT([yes, but without OpenMP as version ${gxx_version} (Armadillo constraint)]) +# ## we know this one is bad +# can_use_openmp="no" +# ;; +# 5.4*|5.5*|5.6*|5.7*|5.8*|5.9*|6.*|7.*|8.*|9.*|1?.*) +# AC_MSG_RESULT([yes, with OpenMP as version ${gxx_version}]) +# ## we know this one is good, yay +# can_use_openmp="yes" +# ;; +# *) +# AC_MSG_RESULT([almost]) +# AC_MSG_WARN([Compiler self-identifies as being compliant with GNUC extensions but is not g++.]) +# ## we know nothing, so no +# can_use_openmp="no" +# ;; +# esac +# fi +# +# ## Check for Apple LLVM +# +# AC_MSG_CHECKING([for macOS]) +# RSysinfoName=$("${R_HOME}/bin/Rscript" --vanilla -e 'cat(Sys.info()[["sysname"]])') +# +# if test x"${RSysinfoName}" = x"Darwin"; then +# AC_MSG_RESULT([found]) +# AC_MSG_CHECKING([for macOS Apple compiler]) +# +# apple_compiler=$($CXX --version 2>&1 | grep -i -c -e 'apple llvm') +# +# if test x"${apple_compiler}" = x"1"; then +# AC_MSG_RESULT([found]) +# AC_MSG_WARN([OpenMP unavailable and turned off.]) +# can_use_openmp="no" +# else +# AC_MSG_RESULT([not found]) +# AC_MSG_CHECKING([for clang compiler]) +# clang_compiler=$($CXX --version 2>&1 | grep -i -c -e 'clang ') +# +# if test x"${clang_compiler}" = x"1"; then +# AC_MSG_RESULT([found]) +# AC_MSG_CHECKING([for OpenMP compatible version of clang]) +# clang_version=$(${CXX} -v 2>&1 | awk '/^.*clang version/ {print $3}') +# +# case ${clang_version} in +# 4.*|5.*|6.*|7.*|8.*|9.*|10.*|11.*) +# AC_MSG_RESULT([found and suitable]) +# can_use_openmp="yes" +# ;; +# *) +# AC_MSG_RESULT([not found]) +# AC_MSG_WARN([OpenMP unavailable and turned off.]) +# can_use_openmp="no" +# ;; +# esac +# else +# AC_MSG_RESULT([not found]) +# AC_MSG_WARN([unsupported macOS build detected; if anything breaks, you keep the pieces.]) +# fi +# fi +# else +# AC_MSG_RESULT([no]) +# fi +# +# fi # if test x"${openmp_already_works}" = x"no" + +# ## Check for suitable LAPACK_LIBS +# AC_MSG_CHECKING([LAPACK_LIBS]) +# +# ## external LAPACK has the required function +# lapack=$(${R_HOME}/bin/R CMD config LAPACK_LIBS) +# hasRlapack=$(echo ${lapack} | grep lRlapack) +# +# ## in what follows below we substitute both side of the define/undef +# ## while this may seem a little unusual we do it to fully reproduce the +# ## previous bash-based implementation +# +# if test x"${hasRlapack}" = x""; then +# ## We are using a full Lapack and can use zgbsv -- so #undef remains +# AC_MSG_RESULT([system LAPACK found]) +# ## arma_lapack="#undef ARMA_CRIPPLED_LAPACK" +# else +# ## We are using R's subset of Lapack and CANNOT use zgbsv etc, so we mark it +# AC_MSG_RESULT([R-supplied partial LAPACK found]) +# ## AC_MSG_WARN([Some complex-valued LAPACK functions may not be available]) +# ## arma_lapack="#define ARMA_CRIPPLED_LAPACK 1" +# fi +# +# ## Default the OpenMP flag to the empty string. +# ## If and only if OpenMP is found, expand to $(SHLIB_OPENMP_CXXFLAGS) +# openmp_flag="" +# +# ## Set the fallback, by default it is nope +# arma_have_openmp="#define ARMA_DONT_USE_OPENMP 1" +# +# if test x"${openmp_already_works}" = x"yes"; then +# arma_have_openmp="#define ARMA_USE_OPENMP 1" +# openmp_flag='$(SHLIB_OPENMP_CXXFLAGS)' +# fi + +## Additional Apple check +AC_MSG_CHECKING([for macOS]) +RSysinfoName=$("${R_HOME}/bin/Rscript" --vanilla -e 'cat(Sys.info()[["sysname"]])') +if test x"${RSysinfoName}" = x"Darwin"; then + AC_MSG_RESULT([found]) + AC_MSG_CHECKING([for macOS Apple compiler]) + apple_compiler=$($CXX --version 2>&1 | grep -i -c -e 'apple llvm') + if test x"${apple_compiler}" = x"1"; then AC_MSG_RESULT([found]) - AC_MSG_CHECKING([for macOS Apple compiler]) - - apple_compiler=$($CXX --version 2>&1 | grep -i -c -e 'apple llvm') - - if test x"${apple_compiler}" = x"1"; then - AC_MSG_RESULT([found]) - AC_MSG_WARN([OpenMP unavailable and turned off.]) - can_use_openmp="no" - else - AC_MSG_RESULT([not found]) - AC_MSG_CHECKING([for clang compiler]) - clang_compiler=$($CXX --version 2>&1 | grep -i -c -e 'clang ') - - if test x"${clang_compiler}" = x"1"; then - AC_MSG_RESULT([found]) - AC_MSG_CHECKING([for OpenMP compatible version of clang]) - clang_version=$(${CXX} -v 2>&1 | awk '/^.*clang version/ {print $3}') - - case ${clang_version} in - 4.*|5.*|6.*|7.*|8.*|9.*|10.*|11.*) - AC_MSG_RESULT([found and suitable]) - can_use_openmp="yes" - ;; - *) - AC_MSG_RESULT([not found]) - AC_MSG_WARN([OpenMP unavailable and turned off.]) - can_use_openmp="no" - ;; - esac - else - AC_MSG_RESULT([not found]) - AC_MSG_WARN([unsupported macOS build detected; if anything breaks, you keep the pieces.]) - fi - fi - else - AC_MSG_RESULT([no]) + AC_MSG_WARN([OpenMP unavailable and turned off.]) + can_use_openmp="no" fi - -fi # if test x"${openmp_already_works}" = x"no" - -## Check for suitable LAPACK_LIBS -AC_MSG_CHECKING([LAPACK_LIBS]) - -## external LAPACK has the required function -lapack=$(${R_HOME}/bin/R CMD config LAPACK_LIBS) -hasRlapack=$(echo ${lapack} | grep lRlapack) - -## in what follows below we substitute both side of the define/undef -## while this may seem a little unusual we do it to fully reproduce the -## previous bash-based implementation - -if test x"${hasRlapack}" = x""; then - ## We are using a full Lapack and can use zgbsv -- so #undef remains - AC_MSG_RESULT([system LAPACK found]) - ## arma_lapack="#undef ARMA_CRIPPLED_LAPACK" -else - ## We are using R's subset of Lapack and CANNOT use zgbsv etc, so we mark it - AC_MSG_RESULT([R-supplied partial LAPACK found]) - ## AC_MSG_WARN([Some complex-valued LAPACK functions may not be available]) - ## arma_lapack="#define ARMA_CRIPPLED_LAPACK 1" -fi - -## Default the OpenMP flag to the empty string. -## If and only if OpenMP is found, expand to $(SHLIB_OPENMP_CXXFLAGS) -openmp_flag="" - -## Set the fallback, by default it is nope -arma_have_openmp="#define ARMA_DONT_USE_OPENMP 1" - -if test x"${openmp_already_works}" = x"yes"; then - arma_have_openmp="#define ARMA_USE_OPENMP 1" - openmp_flag='$(SHLIB_OPENMP_CXXFLAGS)' fi if test x"${can_use_openmp}" = x"yes"; then @@ -195,6 +214,7 @@ if test x"${can_use_openmp}" = x"yes"; then if test x"${hasOpenMP}" = x""; then AC_MSG_RESULT([missing]) arma_have_openmp="#define ARMA_DONT_USE_OPENMP 1" + openmp_flag="" else AC_MSG_RESULT([found and suitable]) arma_have_openmp="#define ARMA_USE_OPENMP 1" @@ -202,7 +222,6 @@ if test x"${can_use_openmp}" = x"yes"; then fi fi - ## now use all these ## AC_SUBST([ARMA_LAPACK],["${arma_lapack}"]) AC_SUBST([ARMA_HAVE_OPENMP], ["${arma_have_openmp}"]) From acdaa2815d5135fcb870d27448a2888f701986cf Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Sat, 18 Oct 2025 07:56:05 -0500 Subject: [PATCH 2/4] Enable container-based r-ci 'dev' version --- .github/workflows/ci.yaml | 9 +++++++-- src/Makevars.in | 1 - src/Makevars.win | 1 - 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c5bb68be..3375996c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,10 +14,13 @@ jobs: strategy: matrix: include: - - {os: macOS-latest} - - {os: ubuntu-latest} + - { name: container, os: ubuntu-latest, container: rocker/r2u4ci } + - { name: macos, os: macos-latest } + #- { name: ubuntu, os: ubuntu-latest } + runs-on: ${{ matrix.os }} + container: ${{ matrix.container }} steps: - name: Checkout @@ -25,6 +28,8 @@ jobs: - name: Setup uses: eddelbuettel/github-actions/r-ci@master + with: + dev_version: 'TRUE' - name: Configure run: ./configure; cat src/Makevars diff --git a/src/Makevars.in b/src/Makevars.in index c50b481f..5922ebc0 100644 --- a/src/Makevars.in +++ b/src/Makevars.in @@ -1,5 +1,4 @@ ## -*- mode: makefile; -*- - PKG_CPPFLAGS = -I../inst/include -DARMA_USE_CURRENT PKG_CXXFLAGS = @OPENMP_FLAG@ PKG_LIBS= @OPENMP_FLAG@ $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) diff --git a/src/Makevars.win b/src/Makevars.win index 6096d2ac..26f31d66 100644 --- a/src/Makevars.win +++ b/src/Makevars.win @@ -1,4 +1,3 @@ ## -*- mode: makefile; -*- - PKG_CXXFLAGS = -I../inst/include -I. $(SHLIB_OPENMP_CXXFLAGS) -DARMA_USE_CURRENT PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) From 5960acb5237f545ccf6248de3e28ded44bddc1af Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Sun, 19 Oct 2025 08:25:52 -0500 Subject: [PATCH 3/4] Missing else message added in configure.ac --- ChangeLog | 4 ++++ configure | 3 +++ configure.ac | 2 ++ 3 files changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index ab86ac72..dc7848ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,10 @@ * configure: Idem * inst/include/current/: Sync with Armadillo 15.2 +2025-10-18 Dirk Eddelbuettel + + * configure.ac: Simplified OpenMP setup + * configure: Idem 2025-10-17 Dirk Eddelbuettel diff --git a/configure b/configure index 339d23f7..314d3c41 100755 --- a/configure +++ b/configure @@ -3411,6 +3411,9 @@ printf "%s\n" "found" >&6; } printf "%s\n" "$as_me: WARNING: OpenMP unavailable and turned off." >&2;} can_use_openmp="no" fi +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +printf "%s\n" "not found" >&6; } fi if test x"${can_use_openmp}" = x"yes"; then diff --git a/configure.ac b/configure.ac index 839ca046..03a8d8e5 100644 --- a/configure.ac +++ b/configure.ac @@ -204,6 +204,8 @@ if test x"${RSysinfoName}" = x"Darwin"; then AC_MSG_WARN([OpenMP unavailable and turned off.]) can_use_openmp="no" fi +else + AC_MSG_RESULT([not found]) fi if test x"${can_use_openmp}" = x"yes"; then From 97cc354f10290127ef4f866e8289a8be387ca6b2 Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Mon, 20 Oct 2025 07:52:56 -0500 Subject: [PATCH 4/4] Remove commented-out code from configure.ac --- ChangeLog | 1 + configure | 117 --------------------------------------------------- configure.ac | 117 --------------------------------------------------- inst/NEWS.Rd | 1 + 4 files changed, 2 insertions(+), 234 deletions(-) diff --git a/ChangeLog b/ChangeLog index dc7848ae..9e3121c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ * configure: Idem * inst/include/current/: Sync with Armadillo 15.2 + 2025-10-18 Dirk Eddelbuettel * configure.ac: Simplified OpenMP setup diff --git a/configure b/configure index 314d3c41..b85f34b2 100755 --- a/configure +++ b/configure @@ -3278,122 +3278,6 @@ fi cd "${owd}" rm -rf "${BUILDDIR}" -# ## If the above checks failed, then perform other heuristics -# ## based on the compiler version, etc. -# if test x"${openmp_already_works}" = x"no"; then -# -# ## Check the C++ compiler using the CXX value set -# -# ## If it is g++, we have GXX set so let's examine it -# if test "${GXX}" = yes; then -# AC_MSG_CHECKING([whether g++ version is sufficient]) -# gxx_version=$(${CXX} -v 2>&1 | awk '/^.*g.. version/ {print $3}') -# case ${gxx_version} in -# 1.*|2.*|3.*|4.0.*|4.1.*|4.2.*|4.3.*|4.4.*|4.5.*|4.6.*|4.7.0|4.7.1) -# AC_MSG_RESULT([no]) -# AC_MSG_WARN([Only g++ version 4.7.2 or greater can be used with RcppArmadillo.]) -# AC_MSG_ERROR([Please use a different compiler.]) -# ;; -# 4.7.*|4.8.*|4.9.*|5.0*|5.1*|5.2*|5.3*) -# AC_MSG_RESULT([yes, but without OpenMP as version ${gxx_version} (Armadillo constraint)]) -# ## we know this one is bad -# can_use_openmp="no" -# ;; -# 5.4*|5.5*|5.6*|5.7*|5.8*|5.9*|6.*|7.*|8.*|9.*|1?.*) -# AC_MSG_RESULT([yes, with OpenMP as version ${gxx_version}]) -# ## we know this one is good, yay -# can_use_openmp="yes" -# ;; -# *) -# AC_MSG_RESULT([almost]) -# AC_MSG_WARN([Compiler self-identifies as being compliant with GNUC extensions but is not g++.]) -# ## we know nothing, so no -# can_use_openmp="no" -# ;; -# esac -# fi -# -# ## Check for Apple LLVM -# -# AC_MSG_CHECKING([for macOS]) -# RSysinfoName=$("${R_HOME}/bin/Rscript" --vanilla -e 'cat(Sys.info()[["sysname"]])') -# -# if test x"${RSysinfoName}" = x"Darwin"; then -# AC_MSG_RESULT([found]) -# AC_MSG_CHECKING([for macOS Apple compiler]) -# -# apple_compiler=$($CXX --version 2>&1 | grep -i -c -e 'apple llvm') -# -# if test x"${apple_compiler}" = x"1"; then -# AC_MSG_RESULT([found]) -# AC_MSG_WARN([OpenMP unavailable and turned off.]) -# can_use_openmp="no" -# else -# AC_MSG_RESULT([not found]) -# AC_MSG_CHECKING([for clang compiler]) -# clang_compiler=$($CXX --version 2>&1 | grep -i -c -e 'clang ') -# -# if test x"${clang_compiler}" = x"1"; then -# AC_MSG_RESULT([found]) -# AC_MSG_CHECKING([for OpenMP compatible version of clang]) -# clang_version=$(${CXX} -v 2>&1 | awk '/^.*clang version/ {print $3}') -# -# case ${clang_version} in -# 4.*|5.*|6.*|7.*|8.*|9.*|10.*|11.*) -# AC_MSG_RESULT([found and suitable]) -# can_use_openmp="yes" -# ;; -# *) -# AC_MSG_RESULT([not found]) -# AC_MSG_WARN([OpenMP unavailable and turned off.]) -# can_use_openmp="no" -# ;; -# esac -# else -# AC_MSG_RESULT([not found]) -# AC_MSG_WARN([unsupported macOS build detected; if anything breaks, you keep the pieces.]) -# fi -# fi -# else -# AC_MSG_RESULT([no]) -# fi -# -# fi # if test x"${openmp_already_works}" = x"no" - -# ## Check for suitable LAPACK_LIBS -# AC_MSG_CHECKING([LAPACK_LIBS]) -# -# ## external LAPACK has the required function -# lapack=$(${R_HOME}/bin/R CMD config LAPACK_LIBS) -# hasRlapack=$(echo ${lapack} | grep lRlapack) -# -# ## in what follows below we substitute both side of the define/undef -# ## while this may seem a little unusual we do it to fully reproduce the -# ## previous bash-based implementation -# -# if test x"${hasRlapack}" = x""; then -# ## We are using a full Lapack and can use zgbsv -- so #undef remains -# AC_MSG_RESULT([system LAPACK found]) -# ## arma_lapack="#undef ARMA_CRIPPLED_LAPACK" -# else -# ## We are using R's subset of Lapack and CANNOT use zgbsv etc, so we mark it -# AC_MSG_RESULT([R-supplied partial LAPACK found]) -# ## AC_MSG_WARN([Some complex-valued LAPACK functions may not be available]) -# ## arma_lapack="#define ARMA_CRIPPLED_LAPACK 1" -# fi -# -# ## Default the OpenMP flag to the empty string. -# ## If and only if OpenMP is found, expand to $(SHLIB_OPENMP_CXXFLAGS) -# openmp_flag="" -# -# ## Set the fallback, by default it is nope -# arma_have_openmp="#define ARMA_DONT_USE_OPENMP 1" -# -# if test x"${openmp_already_works}" = x"yes"; then -# arma_have_openmp="#define ARMA_USE_OPENMP 1" -# openmp_flag='$(SHLIB_OPENMP_CXXFLAGS)' -# fi - ## Additional Apple check { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for macOS" >&5 printf %s "checking for macOS... " >&6; } @@ -3436,7 +3320,6 @@ printf "%s\n" "found and suitable" >&6; } fi ## now use all these -## AC_SUBST([ARMA_LAPACK],["${arma_lapack}"]) ARMA_HAVE_OPENMP="${arma_have_openmp}" OPENMP_FLAG="${openmp_flag}" diff --git a/configure.ac b/configure.ac index 03a8d8e5..c2083efe 100644 --- a/configure.ac +++ b/configure.ac @@ -76,122 +76,6 @@ fi cd "${owd}" rm -rf "${BUILDDIR}" -# ## If the above checks failed, then perform other heuristics -# ## based on the compiler version, etc. -# if test x"${openmp_already_works}" = x"no"; then -# -# ## Check the C++ compiler using the CXX value set -# -# ## If it is g++, we have GXX set so let's examine it -# if test "${GXX}" = yes; then -# AC_MSG_CHECKING([whether g++ version is sufficient]) -# gxx_version=$(${CXX} -v 2>&1 | awk '/^.*g.. version/ {print $3}') -# case ${gxx_version} in -# 1.*|2.*|3.*|4.0.*|4.1.*|4.2.*|4.3.*|4.4.*|4.5.*|4.6.*|4.7.0|4.7.1) -# AC_MSG_RESULT([no]) -# AC_MSG_WARN([Only g++ version 4.7.2 or greater can be used with RcppArmadillo.]) -# AC_MSG_ERROR([Please use a different compiler.]) -# ;; -# 4.7.*|4.8.*|4.9.*|5.0*|5.1*|5.2*|5.3*) -# AC_MSG_RESULT([yes, but without OpenMP as version ${gxx_version} (Armadillo constraint)]) -# ## we know this one is bad -# can_use_openmp="no" -# ;; -# 5.4*|5.5*|5.6*|5.7*|5.8*|5.9*|6.*|7.*|8.*|9.*|1?.*) -# AC_MSG_RESULT([yes, with OpenMP as version ${gxx_version}]) -# ## we know this one is good, yay -# can_use_openmp="yes" -# ;; -# *) -# AC_MSG_RESULT([almost]) -# AC_MSG_WARN([Compiler self-identifies as being compliant with GNUC extensions but is not g++.]) -# ## we know nothing, so no -# can_use_openmp="no" -# ;; -# esac -# fi -# -# ## Check for Apple LLVM -# -# AC_MSG_CHECKING([for macOS]) -# RSysinfoName=$("${R_HOME}/bin/Rscript" --vanilla -e 'cat(Sys.info()[["sysname"]])') -# -# if test x"${RSysinfoName}" = x"Darwin"; then -# AC_MSG_RESULT([found]) -# AC_MSG_CHECKING([for macOS Apple compiler]) -# -# apple_compiler=$($CXX --version 2>&1 | grep -i -c -e 'apple llvm') -# -# if test x"${apple_compiler}" = x"1"; then -# AC_MSG_RESULT([found]) -# AC_MSG_WARN([OpenMP unavailable and turned off.]) -# can_use_openmp="no" -# else -# AC_MSG_RESULT([not found]) -# AC_MSG_CHECKING([for clang compiler]) -# clang_compiler=$($CXX --version 2>&1 | grep -i -c -e 'clang ') -# -# if test x"${clang_compiler}" = x"1"; then -# AC_MSG_RESULT([found]) -# AC_MSG_CHECKING([for OpenMP compatible version of clang]) -# clang_version=$(${CXX} -v 2>&1 | awk '/^.*clang version/ {print $3}') -# -# case ${clang_version} in -# 4.*|5.*|6.*|7.*|8.*|9.*|10.*|11.*) -# AC_MSG_RESULT([found and suitable]) -# can_use_openmp="yes" -# ;; -# *) -# AC_MSG_RESULT([not found]) -# AC_MSG_WARN([OpenMP unavailable and turned off.]) -# can_use_openmp="no" -# ;; -# esac -# else -# AC_MSG_RESULT([not found]) -# AC_MSG_WARN([unsupported macOS build detected; if anything breaks, you keep the pieces.]) -# fi -# fi -# else -# AC_MSG_RESULT([no]) -# fi -# -# fi # if test x"${openmp_already_works}" = x"no" - -# ## Check for suitable LAPACK_LIBS -# AC_MSG_CHECKING([LAPACK_LIBS]) -# -# ## external LAPACK has the required function -# lapack=$(${R_HOME}/bin/R CMD config LAPACK_LIBS) -# hasRlapack=$(echo ${lapack} | grep lRlapack) -# -# ## in what follows below we substitute both side of the define/undef -# ## while this may seem a little unusual we do it to fully reproduce the -# ## previous bash-based implementation -# -# if test x"${hasRlapack}" = x""; then -# ## We are using a full Lapack and can use zgbsv -- so #undef remains -# AC_MSG_RESULT([system LAPACK found]) -# ## arma_lapack="#undef ARMA_CRIPPLED_LAPACK" -# else -# ## We are using R's subset of Lapack and CANNOT use zgbsv etc, so we mark it -# AC_MSG_RESULT([R-supplied partial LAPACK found]) -# ## AC_MSG_WARN([Some complex-valued LAPACK functions may not be available]) -# ## arma_lapack="#define ARMA_CRIPPLED_LAPACK 1" -# fi -# -# ## Default the OpenMP flag to the empty string. -# ## If and only if OpenMP is found, expand to $(SHLIB_OPENMP_CXXFLAGS) -# openmp_flag="" -# -# ## Set the fallback, by default it is nope -# arma_have_openmp="#define ARMA_DONT_USE_OPENMP 1" -# -# if test x"${openmp_already_works}" = x"yes"; then -# arma_have_openmp="#define ARMA_USE_OPENMP 1" -# openmp_flag='$(SHLIB_OPENMP_CXXFLAGS)' -# fi - ## Additional Apple check AC_MSG_CHECKING([for macOS]) RSysinfoName=$("${R_HOME}/bin/Rscript" --vanilla -e 'cat(Sys.info()[["sysname"]])') @@ -225,7 +109,6 @@ if test x"${can_use_openmp}" = x"yes"; then fi ## now use all these -## AC_SUBST([ARMA_LAPACK],["${arma_lapack}"]) AC_SUBST([ARMA_HAVE_OPENMP], ["${arma_have_openmp}"]) AC_SUBST([OPENMP_FLAG], ["${openmp_flag}"]) AC_CONFIG_FILES([inst/include/RcppArmadillo/config/RcppArmadilloConfigGenerated.h src/Makevars]) diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index ccfed639..ed8b2a85 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -14,6 +14,7 @@ \item Reworked detection of aliasing, leading to more efficient compiled code } + \item OpenMP detection in \code{configure} has been simplified } }