Skip to content

work in private build dir during configure #296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 6, 2020
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
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2020-05-06 Dirk Eddelbuettel <edd@debian.org>

* configure.ac: Rebasing and rewording

2020-05-05 Kevin Ushey <kevinushey@gmail.com>

* configure.ac: Improve temporary directory determination and use

2020-05-05 Dirk Eddelbuettel <edd@debian.org>

* configure.ac: Tweaks to wording, whitespace and cleanup
Expand Down
45 changes: 29 additions & 16 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.870.2.0.
# Generated by GNU Autoconf 2.69 for RcppArmadillo 0.9.870.2.0.1.
#
#
# 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.870.2.0'
PACKAGE_STRING='RcppArmadillo 0.9.870.2.0'
PACKAGE_VERSION='0.9.870.2.0.1'
PACKAGE_STRING='RcppArmadillo 0.9.870.2.0.1'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''

Expand Down Expand Up @@ -1197,7 +1197,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.870.2.0 to adapt to many kinds of systems.
\`configure' configures RcppArmadillo 0.9.870.2.0.1 to adapt to many kinds of systems.

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

Expand Down Expand Up @@ -1259,7 +1259,7 @@ fi

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

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

Copyright (C) 2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -1431,7 +1431,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.870.2.0, which was
It was created by RcppArmadillo $as_me 0.9.870.2.0.1, which was
generated by GNU Autoconf 2.69. Invocation command line was

$ $0 $@
Expand Down Expand Up @@ -2706,12 +2706,23 @@ openmp_already_works="no"
## variant available if and only if C++11 is used with g++ 5.4 or newer
can_use_openmp="no"

## Ensure TMPDIR is set.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we have a suitable tempdir" >&5
$as_echo_n "checking whether we have a suitable tempdir... " >&6; }
TMPDIR=$("${R_HOME}/bin/R" --vanilla --slave -e "cat(dirname(tempdir()))")
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${TMPDIR}" >&5
$as_echo "${TMPDIR}" >&6; }

## 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 already compile programs using OpenMP" >&5
$as_echo_n "checking whether R can already compile programs using OpenMP... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether R CMD SHLIB can already compile programs using OpenMP" >&5
$as_echo_n "checking whether R CMD SHLIB can already compile programs using OpenMP... " >&6; }

## Create private directory in TMPDIR.
BUILDDIR="${TMPDIR}/rcpparmadillo-$$-$RANDOM"
mkdir -p "${BUILDDIR}"

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

cat <<EOF > test-omp.cpp
#include <omp.h>
Expand All @@ -2720,7 +2731,8 @@ int main() {
}
EOF

${R_HOME}/bin/R CMD SHLIB --clean test-omp.cpp >/dev/null 2>&1
## Execute R CMD SHLIB.
"${R_HOME}/bin/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; }
Expand All @@ -2730,11 +2742,12 @@ else
$as_echo "no" >&6; }
fi

## cleanup, the .o was already removed by added --clean
rm -f test-omp.cpp test-omp.dylib test-omp.so

## 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
Expand Down Expand Up @@ -3444,7 +3457,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.870.2.0, which was
This file was extended by RcppArmadillo $as_me 0.9.870.2.0.1, which was
generated by GNU Autoconf 2.69. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -3497,7 +3510,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.870.2.0
RcppArmadillo config.status 0.9.870.2.0.1
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

Expand Down
23 changes: 17 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,20 @@ openmp_already_works="no"
## variant available if and only if C++11 is used with g++ 5.4 or newer
can_use_openmp="no"

## Ensure TMPDIR is set.
AC_MSG_CHECKING([whether we have a suitable tempdir])
TMPDIR=$("${R_HOME}/bin/R" --vanilla --slave -e "cat(dirname(tempdir()))")
AC_MSG_RESULT([${TMPDIR}])

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

## Create private directory in TMPDIR.
BUILDDIR="${TMPDIR}/rcpparmadillo-$$-$RANDOM"
mkdir -p "${BUILDDIR}"

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

cat <<EOF > test-omp.cpp
#include <omp.h>
Expand All @@ -50,19 +59,21 @@ int main() {
}
EOF

${R_HOME}/bin/R CMD SHLIB --clean test-omp.cpp >/dev/null 2>&1
## Execute R CMD SHLIB.
"${R_HOME}/bin/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

## cleanup, the .o was already removed by added --clean
rm -f test-omp.cpp test-omp.dylib test-omp.so

## 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
Expand Down
4 changes: 2 additions & 2 deletions inst/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
\item Upgraded to Armadillo release 9.xxx.x (xxxxxxxxxxxxxxxxx)
\itemize{
}
\item OpenMP capability is tested explicitlu (Kevin Ushey in
\ghpr{294} fixing \ghit{290}, Dirk in \ghpr{295})
\item OpenMP capability is tested explicitly (Kevin Ushey and Dirk
in \ghpr{294}, ghpr{295}, and \ghpr{296} all fixing \ghit{290}).
}
}

Expand Down