@@ -3225,13 +3225,26 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex
32253225ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
32263226
32273227
3228+ { printf " %s\n" " $as_me :${as_lineno-$LINENO } : checking what system we are on" >&5
3229+ printf %s " checking what system we are on... " >&6 ; }
3230+ # SYSKERNEL=$(uname -s)
3231+ # SYSMACHINE=$(uname -m)
3232+ # SYSOS=$(uname -o)
3233+ # AC_MSG_RESULT([${SYSKERNEL} ${SYSMACHINE} ${SYSOS}])
3234+ # # Rely on Sys.info() from R for cross-compilation cases
3235+ SYSKERNEL=$( " ${R_HOME} /bin/Rscript" --vanilla -e ' cat(Sys.info()["sysname"])' )
3236+ SYSMACHINE=$( " ${R_HOME} /bin/Rscript" --vanilla -e ' cat(Sys.info()["machine"])' )
3237+ { printf " %s\n" " $as_me :${as_lineno-$LINENO } : result: running ${SYSKERNEL} on ${SYSMACHINE} " >&5
3238+ printf " %s\n" " running ${SYSKERNEL} on ${SYSMACHINE} " >&6 ; }
3239+
3240+
32283241# # Is R already configured to compile things using OpenMP without
32293242# # any extra hand-holding?
32303243# openmp_already_works="no"
32313244
32323245# # default to not even thinking about OpenMP as Armadillo wants a pragma
32333246# # variant available if and only if C++11 is used with g++ 5.4 or newer
3234- # can_use_openmp="no"
3247+ can_use_openmp=" no"
32353248
32363249# # Ensure TMPDIR is set.
32373250{ printf " %s\n" " $as_me :${as_lineno-$LINENO } : checking whether we have a suitable tempdir" >&5
@@ -3240,10 +3253,6 @@ TMPDIR=$("${R_HOME}/bin/R" --vanilla --slave -e "cat(dirname(tempdir()))")
32403253{ printf " %s\n" " $as_me :${as_lineno-$LINENO } : result: ${TMPDIR} " >&5
32413254printf " %s\n" " ${TMPDIR} " >&6 ; }
32423255
3243- # # Check if R is configured to compile programs using OpenMP out-of-the-box.
3244- { printf " %s\n" " $as_me :${as_lineno-$LINENO } : checking whether R CMD SHLIB can already compile programs using OpenMP" >&5
3245- printf %s " checking whether R CMD SHLIB can already compile programs using OpenMP... " >&6 ; }
3246-
32473256# # Create private directory in TMPDIR.
32483257BUILDDIR=" ${TMPDIR} /rcpparmadillo-$$ -$RANDOM "
32493258mkdir -p " ${BUILDDIR} "
@@ -3258,22 +3267,55 @@ int main() {
32583267}
32593268EOF
32603269
3261- # # Execute R CMD SHLIB.
3262- " ${R_HOME} /bin/R" CMD SHLIB test-omp.cpp > /dev/null 2>&1
3263- if test x" $? " = x" 0" ; then
3264- { printf " %s\n" " $as_me :${as_lineno-$LINENO } : result: yes" >&5
3270+ if test x" ${SYSKERNEL} " = x" Linux" ; then
3271+
3272+ # # Check if R is configured to compile programs using OpenMP out-of-the-box.
3273+ if test x" ${can_use_openmp} " = x" no" ; then
3274+ { printf " %s\n" " $as_me :${as_lineno-$LINENO } : checking whether R CMD SHLIB can already compile OpenMP programs" >&5
3275+ printf %s " checking whether R CMD SHLIB can already compile OpenMP programs... " >&6 ; }
3276+
3277+ # # Execute R CMD SHLIB.
3278+ " ${R_HOME} /bin/R" CMD SHLIB test-omp.cpp > /dev/null 2>&1
3279+ if test x" $? " = x" 0" ; then
3280+ { printf " %s\n" " $as_me :${as_lineno-$LINENO } : result: yes" >&5
32653281printf " %s\n" " yes" >&6 ; }
3266- openmp_already_works=" yes"
3267- arma_have_openmp=" #define ARMA_USE_OPENMP 1"
3268- can_use_openmp=" yes"
3269- else
3270- { printf " %s\n" " $as_me :${as_lineno-$LINENO } : result: no" >&5
3282+ openmp_already_works=" yes"
3283+ arma_have_openmp=" #define ARMA_USE_OPENMP 1"
3284+ # #FIXME can_use_openmp="yes"
3285+ else
3286+ { printf " %s\n" " $as_me :${as_lineno-$LINENO } : result: no" >&5
3287+ printf " %s\n" " no" >&6 ; }
3288+ openmp_already_works=" no"
3289+ arma_have_openmp=" #define ARMA_DONT_USE_OPENMP 1"
3290+ can_use_openmp=" no"
3291+ fi
3292+ fi
3293+
3294+ # # If needed, check if R is configured to compile programs using OpenMP with -fopenmp
3295+ if test x" ${can_use_openmp} " = x" no" ; then
3296+ { printf " %s\n" " $as_me :${as_lineno-$LINENO } : checking whether R CMD SHLIB can compile OpenMP via -fopenmp" >&5
3297+ printf %s " checking whether R CMD SHLIB can compile OpenMP via -fopenmp... " >&6 ; }
3298+
3299+ # # Execute R CMD SHLIB.
3300+ PKG_CXXFLAGS=-fopenmp PKG_LIBS=-fopen " ${R_HOME} /bin/R" CMD SHLIB -fopenmp test-omp.cpp > /dev/null 2>&1
3301+ if test x" $? " = x" 0" ; then
3302+ { printf " %s\n" " $as_me :${as_lineno-$LINENO } : result: yes" >&5
3303+ printf " %s\n" " yes" >&6 ; }
3304+ openmp_already_works=" yes"
3305+ arma_have_openmp=" #define ARMA_USE_OPENMP 1"
3306+ can_use_openmp=" yes"
3307+ else
3308+ { printf " %s\n" " $as_me :${as_lineno-$LINENO } : result: no" >&5
32713309printf " %s\n" " no" >&6 ; }
3272- openmp_already_works=" no"
3273- arma_have_openmp=" #define ARMA_DONT_USE_OPENMP 1"
3274- can_use_openmp=" no"
3310+ openmp_already_works=" no"
3311+ arma_have_openmp=" #define ARMA_DONT_USE_OPENMP 1"
3312+ can_use_openmp=" no"
3313+ fi
3314+ fi
32753315fi
32763316
3317+
3318+
32773319# # Go back home.
32783320cd " ${owd} "
32793321rm -rf " ${BUILDDIR} "
0 commit comments