Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,25 @@ 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
uses: actions/checkout@v4

- name: Setup
uses: eddelbuettel/github-actions/r-ci@master
with:
dev_version: 'TRUE'

- name: Configure
run: ./configure; cat src/Makevars

- name: Dependencies
run: ./run.sh install_deps
Expand Down
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

* inst/include/current/: Sync with Armadillo 15.2

2025-10-18 Dirk Eddelbuettel <edd@debian.org>

* configure.ac: Simplified OpenMP setup
* configure: Idem

2025-10-17 Dirk Eddelbuettel <edd@debian.org>

* src/RcppArmadillo.cpp (armadillo_version_typed): Added
Expand Down
157 changes: 21 additions & 136 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -3264,154 +3264,40 @@ 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

## Check for Apple LLVM

{ 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
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: 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
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}: 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:${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)'
{ 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
Expand All @@ -3424,6 +3310,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; }
Expand All @@ -3432,9 +3319,7 @@ 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}"

OPENMP_FLAG="${openmp_flag}"
Expand Down
Loading