Skip to content

Commit 2f44307

Browse files
committed
Simplified configure.ac, work in progress
1 parent 0389eca commit 2f44307

File tree

3 files changed

+271
-250
lines changed

3 files changed

+271
-250
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
matrix:
1616
include:
17-
#- {os: macOS-latest}
17+
- {os: macOS-latest}
1818
- {os: ubuntu-latest}
1919

2020
runs-on: ${{ matrix.os }}
@@ -26,6 +26,9 @@ jobs:
2626
- name: Setup
2727
uses: eddelbuettel/github-actions/r-ci@master
2828

29+
- name: Configure
30+
run: ./configure; cat src/Makevars
31+
2932
- name: Dependencies
3033
run: ./run.sh install_deps
3134

configure

Lines changed: 133 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -3227,11 +3227,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
32273227

32283228
## Is R already configured to compile things using OpenMP without
32293229
## any extra hand-holding?
3230-
openmp_already_works="no"
3230+
#openmp_already_works="no"
32313231

32323232
## default to not even thinking about OpenMP as Armadillo wants a pragma
32333233
## variant available if and only if C++11 is used with g++ 5.4 or newer
3234-
can_use_openmp="no"
3234+
#can_use_openmp="no"
32353235

32363236
## Ensure TMPDIR is set.
32373237
{ 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
32643264
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
32653265
printf "%s\n" "yes" >&6; }
32663266
openmp_already_works="yes"
3267+
arma_have_openmp="#define ARMA_USE_OPENMP 1"
3268+
can_use_openmp="yes"
32673269
else
32683270
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
32693271
printf "%s\n" "no" >&6; }
3272+
openmp_already_works="no"
3273+
arma_have_openmp="#define ARMA_DONT_USE_OPENMP 1"
3274+
can_use_openmp="no"
32703275
fi
32713276

32723277
## Go back home.
32733278
cd "${owd}"
32743279
rm -rf "${BUILDDIR}"
32753280

3276-
## If the above checks failed, then perform other heuristics
3277-
## based on the compiler version, etc.
3278-
if test x"${openmp_already_works}" = x"no"; then
3279-
3280-
## Check the C++ compiler using the CXX value set
3281-
3282-
## If it is g++, we have GXX set so let's examine it
3283-
if test "${GXX}" = yes; then
3284-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether g++ version is sufficient" >&5
3285-
printf %s "checking whether g++ version is sufficient... " >&6; }
3286-
gxx_version=$(${CXX} -v 2>&1 | awk '/^.*g.. version/ {print $3}')
3287-
case ${gxx_version} in
3288-
1.*|2.*|3.*|4.0.*|4.1.*|4.2.*|4.3.*|4.4.*|4.5.*|4.6.*|4.7.0|4.7.1)
3289-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
3290-
printf "%s\n" "no" >&6; }
3291-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Only g++ version 4.7.2 or greater can be used with RcppArmadillo." >&5
3292-
printf "%s\n" "$as_me: WARNING: Only g++ version 4.7.2 or greater can be used with RcppArmadillo." >&2;}
3293-
as_fn_error $? "Please use a different compiler." "$LINENO" 5
3294-
;;
3295-
4.7.*|4.8.*|4.9.*|5.0*|5.1*|5.2*|5.3*)
3296-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, but without OpenMP as version ${gxx_version} (Armadillo constraint)" >&5
3297-
printf "%s\n" "yes, but without OpenMP as version ${gxx_version} (Armadillo constraint)" >&6; }
3298-
## we know this one is bad
3299-
can_use_openmp="no"
3300-
;;
3301-
5.4*|5.5*|5.6*|5.7*|5.8*|5.9*|6.*|7.*|8.*|9.*|1?.*)
3302-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, with OpenMP as version ${gxx_version}" >&5
3303-
printf "%s\n" "yes, with OpenMP as version ${gxx_version}" >&6; }
3304-
## we know this one is good, yay
3305-
can_use_openmp="yes"
3306-
;;
3307-
*)
3308-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: almost" >&5
3309-
printf "%s\n" "almost" >&6; }
3310-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Compiler self-identifies as being compliant with GNUC extensions but is not g++." >&5
3311-
printf "%s\n" "$as_me: WARNING: Compiler self-identifies as being compliant with GNUC extensions but is not g++." >&2;}
3312-
## we know nothing, so no
3313-
can_use_openmp="no"
3314-
;;
3315-
esac
3316-
fi
3281+
# ## If the above checks failed, then perform other heuristics
3282+
# ## based on the compiler version, etc.
3283+
# if test x"${openmp_already_works}" = x"no"; then
3284+
#
3285+
# ## Check the C++ compiler using the CXX value set
3286+
#
3287+
# ## If it is g++, we have GXX set so let's examine it
3288+
# if test "${GXX}" = yes; then
3289+
# AC_MSG_CHECKING([whether g++ version is sufficient])
3290+
# gxx_version=$(${CXX} -v 2>&1 | awk '/^.*g.. version/ {print $3}')
3291+
# case ${gxx_version} in
3292+
# 1.*|2.*|3.*|4.0.*|4.1.*|4.2.*|4.3.*|4.4.*|4.5.*|4.6.*|4.7.0|4.7.1)
3293+
# AC_MSG_RESULT([no])
3294+
# AC_MSG_WARN([Only g++ version 4.7.2 or greater can be used with RcppArmadillo.])
3295+
# AC_MSG_ERROR([Please use a different compiler.])
3296+
# ;;
3297+
# 4.7.*|4.8.*|4.9.*|5.0*|5.1*|5.2*|5.3*)
3298+
# AC_MSG_RESULT([yes, but without OpenMP as version ${gxx_version} (Armadillo constraint)])
3299+
# ## we know this one is bad
3300+
# can_use_openmp="no"
3301+
# ;;
3302+
# 5.4*|5.5*|5.6*|5.7*|5.8*|5.9*|6.*|7.*|8.*|9.*|1?.*)
3303+
# AC_MSG_RESULT([yes, with OpenMP as version ${gxx_version}])
3304+
# ## we know this one is good, yay
3305+
# can_use_openmp="yes"
3306+
# ;;
3307+
# *)
3308+
# AC_MSG_RESULT([almost])
3309+
# AC_MSG_WARN([Compiler self-identifies as being compliant with GNUC extensions but is not g++.])
3310+
# ## we know nothing, so no
3311+
# can_use_openmp="no"
3312+
# ;;
3313+
# esac
3314+
# fi
3315+
#
3316+
# ## Check for Apple LLVM
3317+
#
3318+
# AC_MSG_CHECKING([for macOS])
3319+
# RSysinfoName=$("${R_HOME}/bin/Rscript" --vanilla -e 'cat(Sys.info()[["sysname"]])')
3320+
#
3321+
# if test x"${RSysinfoName}" = x"Darwin"; then
3322+
# AC_MSG_RESULT([found])
3323+
# AC_MSG_CHECKING([for macOS Apple compiler])
3324+
#
3325+
# apple_compiler=$($CXX --version 2>&1 | grep -i -c -e 'apple llvm')
3326+
#
3327+
# if test x"${apple_compiler}" = x"1"; then
3328+
# AC_MSG_RESULT([found])
3329+
# AC_MSG_WARN([OpenMP unavailable and turned off.])
3330+
# can_use_openmp="no"
3331+
# else
3332+
# AC_MSG_RESULT([not found])
3333+
# AC_MSG_CHECKING([for clang compiler])
3334+
# clang_compiler=$($CXX --version 2>&1 | grep -i -c -e 'clang ')
3335+
#
3336+
# if test x"${clang_compiler}" = x"1"; then
3337+
# AC_MSG_RESULT([found])
3338+
# AC_MSG_CHECKING([for OpenMP compatible version of clang])
3339+
# clang_version=$(${CXX} -v 2>&1 | awk '/^.*clang version/ {print $3}')
3340+
#
3341+
# case ${clang_version} in
3342+
# 4.*|5.*|6.*|7.*|8.*|9.*|10.*|11.*)
3343+
# AC_MSG_RESULT([found and suitable])
3344+
# can_use_openmp="yes"
3345+
# ;;
3346+
# *)
3347+
# AC_MSG_RESULT([not found])
3348+
# AC_MSG_WARN([OpenMP unavailable and turned off.])
3349+
# can_use_openmp="no"
3350+
# ;;
3351+
# esac
3352+
# else
3353+
# AC_MSG_RESULT([not found])
3354+
# AC_MSG_WARN([unsupported macOS build detected; if anything breaks, you keep the pieces.])
3355+
# fi
3356+
# fi
3357+
# else
3358+
# AC_MSG_RESULT([no])
3359+
# fi
3360+
#
3361+
# fi # if test x"${openmp_already_works}" = x"no"
33173362

3318-
## Check for Apple LLVM
3363+
# ## Check for suitable LAPACK_LIBS
3364+
# AC_MSG_CHECKING([LAPACK_LIBS])
3365+
#
3366+
# ## external LAPACK has the required function
3367+
# lapack=$(${R_HOME}/bin/R CMD config LAPACK_LIBS)
3368+
# hasRlapack=$(echo ${lapack} | grep lRlapack)
3369+
#
3370+
# ## in what follows below we substitute both side of the define/undef
3371+
# ## while this may seem a little unusual we do it to fully reproduce the
3372+
# ## previous bash-based implementation
3373+
#
3374+
# if test x"${hasRlapack}" = x""; then
3375+
# ## We are using a full Lapack and can use zgbsv -- so #undef remains
3376+
# AC_MSG_RESULT([system LAPACK found])
3377+
# ## arma_lapack="#undef ARMA_CRIPPLED_LAPACK"
3378+
# else
3379+
# ## We are using R's subset of Lapack and CANNOT use zgbsv etc, so we mark it
3380+
# AC_MSG_RESULT([R-supplied partial LAPACK found])
3381+
# ## AC_MSG_WARN([Some complex-valued LAPACK functions may not be available])
3382+
# ## arma_lapack="#define ARMA_CRIPPLED_LAPACK 1"
3383+
# fi
3384+
#
3385+
# ## Default the OpenMP flag to the empty string.
3386+
# ## If and only if OpenMP is found, expand to $(SHLIB_OPENMP_CXXFLAGS)
3387+
# openmp_flag=""
3388+
#
3389+
# ## Set the fallback, by default it is nope
3390+
# arma_have_openmp="#define ARMA_DONT_USE_OPENMP 1"
3391+
#
3392+
# if test x"${openmp_already_works}" = x"yes"; then
3393+
# arma_have_openmp="#define ARMA_USE_OPENMP 1"
3394+
# openmp_flag='$(SHLIB_OPENMP_CXXFLAGS)'
3395+
# fi
33193396

3320-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for macOS" >&5
3397+
## Additional Apple check
3398+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for macOS" >&5
33213399
printf %s "checking for macOS... " >&6; }
3322-
RSysinfoName=$("${R_HOME}/bin/Rscript" --vanilla -e 'cat(Sys.info()["sysname"])')
3323-
3324-
if test x"${RSysinfoName}" = x"Darwin"; then
3325-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found" >&5
3400+
RSysinfoName=$("${R_HOME}/bin/Rscript" --vanilla -e 'cat(Sys.info()["sysname"])')
3401+
if test x"${RSysinfoName}" = x"Darwin"; then
3402+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found" >&5
33263403
printf "%s\n" "found" >&6; }
3327-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for macOS Apple compiler" >&5
3404+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for macOS Apple compiler" >&5
33283405
printf %s "checking for macOS Apple compiler... " >&6; }
3329-
3330-
apple_compiler=$($CXX --version 2>&1 | grep -i -c -e 'apple llvm')
3331-
3332-
if test x"${apple_compiler}" = x"1"; then
3333-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found" >&5
3406+
apple_compiler=$($CXX --version 2>&1 | grep -i -c -e 'apple llvm')
3407+
if test x"${apple_compiler}" = x"1"; then
3408+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found" >&5
33343409
printf "%s\n" "found" >&6; }
3335-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: OpenMP unavailable and turned off." >&5
3410+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: OpenMP unavailable and turned off." >&5
33363411
printf "%s\n" "$as_me: WARNING: OpenMP unavailable and turned off." >&2;}
3337-
can_use_openmp="no"
3338-
else
3339-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5
3340-
printf "%s\n" "not found" >&6; }
3341-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clang compiler" >&5
3342-
printf %s "checking for clang compiler... " >&6; }
3343-
clang_compiler=$($CXX --version 2>&1 | grep -i -c -e 'clang ')
3344-
3345-
if test x"${clang_compiler}" = x"1"; then
3346-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found" >&5
3347-
printf "%s\n" "found" >&6; }
3348-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenMP compatible version of clang" >&5
3349-
printf %s "checking for OpenMP compatible version of clang... " >&6; }
3350-
clang_version=$(${CXX} -v 2>&1 | awk '/^.*clang version/ {print $3}')
3351-
3352-
case ${clang_version} in
3353-
4.*|5.*|6.*|7.*|8.*|9.*|10.*|11.*)
3354-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found and suitable" >&5
3355-
printf "%s\n" "found and suitable" >&6; }
3356-
can_use_openmp="yes"
3357-
;;
3358-
*)
3359-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5
3360-
printf "%s\n" "not found" >&6; }
3361-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: OpenMP unavailable and turned off." >&5
3362-
printf "%s\n" "$as_me: WARNING: OpenMP unavailable and turned off." >&2;}
3363-
can_use_openmp="no"
3364-
;;
3365-
esac
3366-
else
3367-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5
3368-
printf "%s\n" "not found" >&6; }
3369-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unsupported macOS build detected; if anything breaks, you keep the pieces." >&5
3370-
printf "%s\n" "$as_me: WARNING: unsupported macOS build detected; if anything breaks, you keep the pieces." >&2;}
3371-
fi
3372-
fi
3373-
else
3374-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
3375-
printf "%s\n" "no" >&6; }
3412+
can_use_openmp="no"
33763413
fi
3377-
3378-
fi # if test x"${openmp_already_works}" = x"no"
3379-
3380-
## Check for suitable LAPACK_LIBS
3381-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking LAPACK_LIBS" >&5
3382-
printf %s "checking LAPACK_LIBS... " >&6; }
3383-
3384-
## external LAPACK has the required function
3385-
lapack=$(${R_HOME}/bin/R CMD config LAPACK_LIBS)
3386-
hasRlapack=$(echo ${lapack} | grep lRlapack)
3387-
3388-
## in what follows below we substitute both side of the define/undef
3389-
## while this may seem a little unusual we do it to fully reproduce the
3390-
## previous bash-based implementation
3391-
3392-
if test x"${hasRlapack}" = x""; then
3393-
## We are using a full Lapack and can use zgbsv -- so #undef remains
3394-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: system LAPACK found" >&5
3395-
printf "%s\n" "system LAPACK found" >&6; }
3396-
## arma_lapack="#undef ARMA_CRIPPLED_LAPACK"
3397-
else
3398-
## We are using R's subset of Lapack and CANNOT use zgbsv etc, so we mark it
3399-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: R-supplied partial LAPACK found" >&5
3400-
printf "%s\n" "R-supplied partial LAPACK found" >&6; }
3401-
## AC_MSG_WARN([Some complex-valued LAPACK functions may not be available])
3402-
## arma_lapack="#define ARMA_CRIPPLED_LAPACK 1"
3403-
fi
3404-
3405-
## Default the OpenMP flag to the empty string.
3406-
## If and only if OpenMP is found, expand to $(SHLIB_OPENMP_CXXFLAGS)
3407-
openmp_flag=""
3408-
3409-
## Set the fallback, by default it is nope
3410-
arma_have_openmp="#define ARMA_DONT_USE_OPENMP 1"
3411-
3412-
if test x"${openmp_already_works}" = x"yes"; then
3413-
arma_have_openmp="#define ARMA_USE_OPENMP 1"
3414-
openmp_flag='$(SHLIB_OPENMP_CXXFLAGS)'
34153414
fi
34163415

34173416
if test x"${can_use_openmp}" = x"yes"; then
@@ -3424,6 +3423,7 @@ printf %s "checking for OpenMP... " >&6; }
34243423
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: missing" >&5
34253424
printf "%s\n" "missing" >&6; }
34263425
arma_have_openmp="#define ARMA_DONT_USE_OPENMP 1"
3426+
openmp_flag=""
34273427
else
34283428
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found and suitable" >&5
34293429
printf "%s\n" "found and suitable" >&6; }
@@ -3432,7 +3432,6 @@ printf "%s\n" "found and suitable" >&6; }
34323432
fi
34333433
fi
34343434

3435-
34363435
## now use all these
34373436
## AC_SUBST([ARMA_LAPACK],["${arma_lapack}"])
34383437
ARMA_HAVE_OPENMP="${arma_have_openmp}"

0 commit comments

Comments
 (0)