Skip to content

Commit 4fdcabe

Browse files
committed
Simplified configure.ac, work in progress
1 parent 554e7c1 commit 4fdcabe

File tree

3 files changed

+271
-254
lines changed

3 files changed

+271
-254
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 & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,6 @@ PACKAGE_URL=''
610610

611611
ac_subst_vars='LTLIBOBJS
612612
LIBOBJS
613-
OPENMP_FLAG
614613
ARMA_HAVE_OPENMP
615614
CXXCPP
616615
OBJEXT
@@ -3227,11 +3226,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
32273226

32283227
## Is R already configured to compile things using OpenMP without
32293228
## any extra hand-holding?
3230-
openmp_already_works="no"
3229+
#openmp_already_works="no"
32313230

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

32363235
## Ensure TMPDIR is set.
32373236
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we have a suitable tempdir" >&5
@@ -3264,154 +3263,153 @@ if test x"$?" = x"0"; then
32643263
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
32653264
printf "%s\n" "yes" >&6; }
32663265
openmp_already_works="yes"
3266+
arma_have_openmp="#define ARMA_USE_OPENMP 1"
3267+
can_use_openmp="yes"
32673268
else
32683269
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
32693270
printf "%s\n" "no" >&6; }
3271+
openmp_already_works="no"
3272+
arma_have_openmp="#define ARMA_DONT_USE_OPENMP 1"
3273+
can_use_openmp="no"
32703274
fi
32713275

32723276
## Go back home.
32733277
cd "${owd}"
32743278
rm -rf "${BUILDDIR}"
32753279

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

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

3320-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for macOS" >&5
3396+
## Additional Apple check
3397+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for macOS" >&5
33213398
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
3399+
RSysinfoName=$("${R_HOME}/bin/Rscript" --vanilla -e 'cat(Sys.info()["sysname"])')
3400+
if test x"${RSysinfoName}" = x"Darwin"; then
3401+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found" >&5
33263402
printf "%s\n" "found" >&6; }
3327-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for macOS Apple compiler" >&5
3403+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for macOS Apple compiler" >&5
33283404
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
3405+
apple_compiler=$($CXX --version 2>&1 | grep -i -c -e 'apple llvm')
3406+
if test x"${apple_compiler}" = x"1"; then
3407+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found" >&5
33343408
printf "%s\n" "found" >&6; }
3335-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: OpenMP unavailable and turned off." >&5
3409+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: OpenMP unavailable and turned off." >&5
33363410
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; }
3411+
can_use_openmp="no"
33763412
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)'
34153413
fi
34163414

34173415
if test x"${can_use_openmp}" = x"yes"; then
@@ -3432,13 +3430,11 @@ printf "%s\n" "found and suitable" >&6; }
34323430
fi
34333431
fi
34343432

3435-
34363433
## now use all these
34373434
## AC_SUBST([ARMA_LAPACK],["${arma_lapack}"])
34383435
ARMA_HAVE_OPENMP="${arma_have_openmp}"
34393436

3440-
OPENMP_FLAG="${openmp_flag}"
3441-
3437+
## AC_SUBST([OPENMP_FLAG], ["${openmp_flag}"])
34423438
ac_config_files="$ac_config_files inst/include/RcppArmadillo/config/RcppArmadilloConfigGenerated.h src/Makevars"
34433439

34443440
cat >confcache <<\_ACEOF

0 commit comments

Comments
 (0)