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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.Rproj.user
.Rhistory
.RData
inst/include/RcppArmadilloConfigGenerated.h

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because these are generated by their corresponding .in files, I think we can just .gitignore them.

src/Makevars
src/*.o
src/*.so
src/*.dll
Expand Down
86 changes: 58 additions & 28 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for RcppArmadillo 0.9.850.1.0.1.
# Generated by GNU Autoconf 2.69 for RcppArmadillo 0.9.860.2.0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -576,8 +576,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='RcppArmadillo'
PACKAGE_TARNAME='rcpparmadillo'
PACKAGE_VERSION='0.9.850.1.0.1'
PACKAGE_STRING='RcppArmadillo 0.9.850.1.0.1'
PACKAGE_VERSION='0.9.860.2.0'
PACKAGE_STRING='RcppArmadillo 0.9.860.2.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''

Expand Down Expand Up @@ -613,7 +613,6 @@ infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
Expand Down Expand Up @@ -685,7 +684,6 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
Expand Down Expand Up @@ -938,15 +936,6 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;

-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;

-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
Expand Down Expand Up @@ -1084,7 +1073,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir runstatedir
libdir localedir mandir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
Expand Down Expand Up @@ -1197,7 +1186,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures RcppArmadillo 0.9.850.1.0.1 to adapt to many kinds of systems.
\`configure' configures RcppArmadillo 0.9.860.2.0 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

Expand Down Expand Up @@ -1237,7 +1226,6 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
Expand All @@ -1259,7 +1247,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of RcppArmadillo 0.9.850.1.0.1:";;
short | recursive ) echo "Configuration of RcppArmadillo 0.9.860.2.0:";;
esac
cat <<\_ACEOF

Expand Down Expand Up @@ -1339,7 +1327,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
RcppArmadillo configure 0.9.850.1.0.1
RcppArmadillo configure 0.9.860.2.0
generated by GNU Autoconf 2.69

Copyright (C) 2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -1431,7 +1419,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by RcppArmadillo $as_me 0.9.850.1.0.1, which was
It was created by RcppArmadillo $as_me 0.9.860.2.0, which was
generated by GNU Autoconf 2.69. Invocation command line was

$ $0 $@
Expand Down Expand Up @@ -1785,7 +1773,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -z "${R_HOME}"; then
as_fn_error $? "Could not determine R_HOME." "$LINENO" 5
fi

## Use R to set CXX and CXXFLAGS
R=${R_HOME}/bin/R
CXX=$(${R_HOME}/bin/R CMD config CXX)
CXXFLAGS=$("${R_HOME}/bin/R" CMD config CXXFLAGS)

Expand Down Expand Up @@ -2439,12 +2429,6 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu




## 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=""

## Check the C++ compiler using the CXX value set
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
Expand Down Expand Up @@ -2702,6 +2686,45 @@ ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
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"

## 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"

## Check if R is configured to compile programs using OpenMP out-of-the-box.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether R can compile programs using OpenMP already" >&5
$as_echo_n "checking whether R can compile programs using OpenMP already... " >&6; }

owd=$(pwd)
cd "${TMPDIR}"

cat <<EOF > test-omp.cpp
#include <omp.h>
int main() {
return omp_get_num_threads();
}
EOF

"${R}" CMD SHLIB test-omp.cpp >/dev/null 2>&1
if test x"$?" = x"0"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
openmp_already_works="yes"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi

cd "${owd}"

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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether g++ version is sufficient" >&5
Expand Down Expand Up @@ -2798,6 +2821,8 @@ else
$as_echo "no" >&6; }
fi

fi # if test x"${openmp_already_works}" = x"no"

## Check for suitable LAPACK_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking LAPACK_LIBS" >&5
$as_echo_n "checking LAPACK_LIBS... " >&6; }
Expand Down Expand Up @@ -2827,9 +2852,14 @@ 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"
fi

if test x"${can_use_openmp}" = x"yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenMP" >&5
$as_echo_n "checking for OpenMP... " >&6; }
Expand Down Expand Up @@ -3400,7 +3430,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by RcppArmadillo $as_me 0.9.850.1.0.1, which was
This file was extended by RcppArmadillo $as_me 0.9.860.2.0, which was
generated by GNU Autoconf 2.69. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -3453,7 +3483,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
RcppArmadillo config.status 0.9.850.1.0.1
RcppArmadillo config.status 0.9.860.2.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

Expand Down
43 changes: 41 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,52 @@ AC_INIT(RcppArmadillo, m4_esyscmd_s([awk -e '/^Version:/ {print $2}' DESCRIPTION
if test -z "${R_HOME}"; then
AC_MSG_ERROR([Could not determine R_HOME.])
fi

## Use R to set CXX and CXXFLAGS
R=${R_HOME}/bin/R

@eddelbuettel eddelbuettel May 5, 2020 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One can do this, and then use R as below, I found it helpful to to keep the longer ${R_HOME}/bin/R
to remind myself of the many time KH had to remind me to not use use R from the path. So weak personal preference for the longer form.

CXX=$(${R_HOME}/bin/R CMD config CXX)
CXXFLAGS=$("${R_HOME}/bin/R" CMD config CXXFLAGS)

## We are using C++
AC_LANG(C++)
AC_REQUIRE_CPP
AC_PROG_CXX

## Is R already configured to compile things using OpenMP without
## any extra hand-holding?
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=""
can_use_openmp="no"

## Check if R is configured to compile programs using OpenMP out-of-the-box.
AC_MSG_CHECKING([whether R can compile programs using OpenMP already])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That trailing 'already' looks a little wooden, I may reword that 'eventually',


owd=$(pwd)
cd "${TMPDIR}"

cat <<EOF > test-omp.cpp
#include <omp.h>
int main() {
return omp_get_num_threads();
}
EOF

"${R}" CMD SHLIB test-omp.cpp >/dev/null 2>&1
if test x"$?" = x"0"; then
AC_MSG_RESULT([yes])
openmp_already_works="yes"
else
AC_MSG_RESULT([no])
fi

cd "${owd}"

if test x"${openmp_already_works}" = x"no"; then

## Check the C++ compiler using the CXX value set
AC_PROG_CXX

## If it is g++, we have GXX set so let's examine it
if test "${GXX}" = yes; then
AC_MSG_CHECKING([whether g++ version is sufficient])
Expand Down Expand Up @@ -107,6 +139,8 @@ else
AC_MSG_RESULT([no])
fi

fi # if test x"${openmp_already_works}" = x"no"

## Check for suitable LAPACK_LIBS
AC_MSG_CHECKING([LAPACK_LIBS])

Expand All @@ -132,9 +166,14 @@ 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"
fi

if test x"${can_use_openmp}" = x"yes"; then
AC_MSG_CHECKING([for OpenMP])
## if R has -fopenmp we should be good
Expand Down