Skip to content

Commit 9e5c539

Browse files
wchjcheng5
authored andcommitted
Add configure script to determine when -latomic is needed (#114)
* Add configure script to detect whether -latomic is needed * Bump version and update NEWS * Add checkbashisms * Travis updates
1 parent 3d8648b commit 9e5c539

File tree

6 files changed

+48
-7
lines changed

6 files changed

+48
-7
lines changed

.travis.yml

+12-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
# R for travis: see documentation at https://docs.travis-ci.com/user/languages/r
22

33
language: r
4-
sudo: false
54
cache: packages
6-
r:
7-
- oldrel
8-
- release
9-
- devel
5+
matrix:
6+
include:
7+
- r: 3.2
8+
- r: 3.3
9+
- r: 3.4
10+
- r: 3.5
11+
- release
12+
- devel
13+
addons:
14+
apt:
15+
packages:
16+
- devscripts # For checkbashisms in R 4.0

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: later
22
Type: Package
33
Title: Utilities for Scheduling Functions to Execute Later with Event Loops
4-
Version: 1.0.0.9000
4+
Version: 1.0.0.9001
55
Authors@R: c(
66
person("Joe", "Cheng", role = c("aut", "cre"), email = "[email protected]"),
77
person(family = "RStudio", role = "cph"),

NEWS.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## later 1.0.9001
2+
3+
* Fixed [#73](https://github.com/r-lib/later/issues/73), [#109](https://github.com/r-lib/later/issues/109): Previously, later did not build on some platforms, notably ARM, because the `-latomic` linker was needed on those platforms. A configure script now detects when `-latomic` is needed. ([#114](https://github.com/r-lib/later/pull/114))
4+
15
## later 1.0.0
26

37
* Added private event loops: these are event loops that can be run independently from the global event loop. These are useful when you have code that schedules callbacks with `later()`, and you want to call `run_now()` block and wait for those callbacks to execute before continuing. Without private event loops, if you call `run_now()` to wait until a particular callback has finished, you might inadvertantly run other callbacks that were scheduled by other code. With private event loops, you can create a private loop, schedule a callback on it, then call `run_now()` on that loop until it executes, all without interfering with the global loop. ([#84](https://github.com/r-lib/later/pull/84))

cleanup

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
rm -f src/Makevars

configure

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/sh
2+
3+
echo "Running configure script"
4+
5+
# Find compiler
6+
CC=$("${R_HOME}"/bin/R CMD config CC)
7+
8+
# Detect whether -latomic is needed during linking. This is needed on some
9+
# platforms, notably ARM (Raspberry Pi).
10+
echo "#include <stdint.h>
11+
uint64_t v;
12+
int main() {
13+
return (int)__atomic_load_n(&v, __ATOMIC_ACQUIRE);
14+
}" | ${CC} -x c - -o /dev/null > /dev/null 2>&1
15+
16+
if [ $? -eq 0 ]; then
17+
echo "-latomic linker flag not needed."
18+
else
19+
echo "-latomic linker flag needed."
20+
EXTRA_PKG_LIBS=-latomic
21+
fi
22+
23+
24+
# Write to Makevars
25+
sed -e "s|@extra_pkg_libs@|$EXTRA_PKG_LIBS|" src/Makevars.in > src/Makevars
26+
27+
# Success
28+
exit 0

src/Makevars renamed to src/Makevars.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
CXX_STD=CXX11
33

44
PKG_CPPFLAGS = -pthread -DSTRICT_R_HEADERS
5-
PKG_LIBS = -pthread
5+
PKG_LIBS = -pthread @extra_pkg_libs@
66

77
#### Debugging flags ####
88
# Uncomment to enable thread assertions

0 commit comments

Comments
 (0)