diff --git a/ChangeLog b/ChangeLog index 91bf5907..b3886294 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2025-11-13 Dirk Eddelbuettel + + * R/inline.R (inlineCxxPlugin): No longer special-case macOS for + OpenMP but rely on "$(SHLIB_OPENMP_CFLAGS)" as everywhere else + + * inst/include/RcppArmadillo/config/RcppArmadilloConfigGenerated.h.in: + Refine macOS OpenMP detection, respect RCPPARMADILLO_MACOS_DISABLE_OPENMP + + * inst/include/RcppArmadillo/config/RcppArmadilloConfig.h: + ARMA_CRIPPLED_LAPACK is only defined if 'LEGACY' Armadillo selected + 2025-11-04 Dirk Eddelbuettel * README.md: Minor edits diff --git a/R/inline.R b/R/inline.R index 02a6ee1c..547ea4a1 100644 --- a/R/inline.R +++ b/R/inline.R @@ -1,4 +1,4 @@ -## Copyright (C) 2010 - 2024 Dirk Eddelbuettel, Romain Francois and Douglas Bates +## Copyright (C) 2010 - 2025 Dirk Eddelbuettel, Romain Francois and Douglas Bates ## ## This file is part of RcppArmadillo. ## @@ -16,8 +16,7 @@ ## along with RcppArmadillo. If not, see . inlineCxxPlugin <- function(...) { - ismacos <- Sys.info()[["sysname"]] == "Darwin" - openmpflag <- if (ismacos) "" else "$(SHLIB_OPENMP_CFLAGS)" + openmpflag <- "$(SHLIB_OPENMP_CFLAGS)" plugin <- Rcpp::Rcpp.plugin.maker(include.before = "#include ", libs = paste(openmpflag, "$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)"), package = "RcppArmadillo") diff --git a/inst/include/RcppArmadillo/config/RcppArmadilloConfig.h b/inst/include/RcppArmadillo/config/RcppArmadilloConfig.h index eecb7e7e..e5184fd4 100644 --- a/inst/include/RcppArmadillo/config/RcppArmadilloConfig.h +++ b/inst/include/RcppArmadillo/config/RcppArmadilloConfig.h @@ -1,9 +1,9 @@ // RcppArmadilloConfig.h: Rcpp/Armadillo glue // -// Copyright (C) 2010 - 2022 Dirk Eddelbuettel, Romain Francois and Douglas Bates -// Copyright (C) 2016 - 2022 George G. Vega Yon -// Copyright (C) 2017 - 2022 Serguei Sokol +// Copyright (C) 2010 - 2025 Dirk Eddelbuettel, Romain Francois and Douglas Bates +// Copyright (C) 2016 - 2025 George G. Vega Yon +// Copyright (C) 2017 - 2025 Serguei Sokol // // This file is part of RcppArmadillo. // @@ -99,7 +99,12 @@ // R can be built with its own Rlapack library, or use an external // one. Only the latter has zgesdd, a complex-valued SVD using divide-and-conquer // on Windows we do not assume ZGESDD - #define ARMA_CRIPPLED_LAPACK 1 + // + // Update 2025-Nov: R now generally has good enough LAPACK/BLAS, and newer Arma + // versions whine so protecting this now for use with Armadillo older than 15.* + #if defined(ARMA_SELECTED_LEGACY_VERSION) + #define ARMA_CRIPPLED_LAPACK 1 + #endif // on Windows we can now assume OpenMP with Rtools / gcc 4.9.3 // note that performance is said to still be poor // cf https://cran.r-project.org/doc/manuals/r-devel/R-admin.html#The-MinGW_002dw64-toolchain diff --git a/inst/include/RcppArmadillo/config/RcppArmadilloConfigGenerated.h.in b/inst/include/RcppArmadillo/config/RcppArmadilloConfigGenerated.h.in index c67db9bd..9a05d376 100644 --- a/inst/include/RcppArmadillo/config/RcppArmadilloConfigGenerated.h.in +++ b/inst/include/RcppArmadillo/config/RcppArmadilloConfigGenerated.h.in @@ -1,7 +1,8 @@ -// RcppArmadilloGenerated.h: Autoconf-updated file for LAPACK and OpenMP choices +// RcppArmadilloConfigGenerated.h: Autoconf-updated file for LAPACK and OpenMP choices // -// Copyright (C) 2013 - 2021 Dirk Eddelbuettel +// Copyright (C) 2013 - 2025 Dirk Eddelbuettel +// 2025 James J. Balamuta // // This file is part of RcppArmadillo. // @@ -21,9 +22,19 @@ #ifndef RcppArmadillo__RcppArmadilloConfigGenerated__h #define RcppArmadillo__RcppArmadilloConfigGenerated__h -#ifndef ARMA_USE_OPENMP -// from configure test for OpenMP based on how R is configured, and whether g++ new enough -@ARMA_HAVE_OPENMP@ +// macOS special case as discussed in https://github.com/RcppCore/RcppArmadillo/issues/493 +#if !defined(ARMA_USE_OPENMP) + #if defined(__APPLE__) && defined(_OPENMP) + // User has OpenMP available, but check if they want it disabled + #ifndef RCPPARMADILLO_MACOS_DISABLE_OPENMP + #define ARMA_USE_OPENMP 1 + #else + #define ARMA_DONT_USE_OPENMP 1 + #endif + #else + // from configure test for OpenMP based on how R is configured + @ARMA_HAVE_OPENMP@ + #endif #endif #endif