Skip to content

Commit

Permalink
updating configures
Browse files Browse the repository at this point in the history
  • Loading branch information
michellepistner committed May 31, 2024
1 parent 49aafeb commit ab7169d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
13 changes: 13 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -3252,6 +3252,19 @@ cd "${BUILDDIR}"
# MPN: These updates were from a (very, very useful) help question posted to r-package-devel
# Credit goes to Ivan Krylov.

cat > test-omp.cpp <<EOF
#include <omp.h>
extern "C" void configtest(int * arg) {
*arg = omp_get_num_threads();
}
EOF
# Without the following you're relying on the GNU/Linux-like behaviour
# w.r.t. undefined symbols (see WRE 1.2.1.1):
cat > Makevars <<EOF
PKG_CXXFLAGS = \$(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = \$(SHLIB_OPENMP_CXXFLAGS)
EOF

# compile and link the shared object
"${R_HOME}/bin/R" CMD SHLIB test-omp.cpp
# load it and use a function from the inside
Expand Down
16 changes: 16 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,22 @@ mkdir -p "${BUILDDIR}"
owd=$(pwd)
cd "${BUILDDIR}"

# MPN: These updates were from a (very, very useful) help question posted to r-package-devel
# Credit goes to Ivan Krylov.

cat > test-omp.cpp <<EOF
#include <omp.h>
extern "C" void configtest(int * arg) {
*arg = omp_get_num_threads();
}
EOF
# Without the following you're relying on the GNU/Linux-like behaviour
# w.r.t. undefined symbols (see WRE 1.2.1.1):
cat > Makevars <<EOF
PKG_CXXFLAGS = \$(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = \$(SHLIB_OPENMP_CXXFLAGS)
EOF

# compile and link the shared object
"${R_HOME}/bin/R" CMD SHLIB test-omp.cpp
# load it and use a function from the inside
Expand Down

0 comments on commit ab7169d

Please sign in to comment.