File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ CFLAGS=`${R_HOME}/bin/R CMD config CFLAGS`
52
52
CPPFLAGS=` ${R_HOME} /bin/R CMD config CPPFLAGS`
53
53
54
54
# For debugging
55
- echo " Using PKG_CFLAGS=$PKG_CFLAGS "
55
+ echo " Testing compiler using PKG_CFLAGS=$PKG_CFLAGS "
56
56
57
57
# Test configuration
58
58
${CC} ${CPPFLAGS} ${PKG_CFLAGS} ${CFLAGS} -E ${PKG_TEST_FILE} > /dev/null 2> configure.log
100
100
fi # SONAME
101
101
fi # AUTOBREW
102
102
103
+ # Define system endianness (compile-time endianness using system/compiler
104
+ # defines isn't detected on Solaris)
105
+ # based on endian detection from the feather package by @hadley
106
+ R_ENDIAN=` ${R_HOME} /bin/Rscript -e ' cat(.Platform$endian)' `
107
+ # Trim off any warning messages that Rscript appends in front of the platform endianness
108
+ R_ENDIAN=` expr " $R_ENDIAN " : ' .*\(little\)$' `
109
+ SYS_ENDIAN=" "
110
+ if [ " $R_ENDIAN " = " little" ]; then
111
+ PKG_CFLAGS=" $PKG_CFLAGS -DIS_LITTLE_ENDIAN"
112
+ else
113
+ PKG_CFLAGS=" $PKG_CFLAGS -DIS_BIG_ENDIAN"
114
+ fi
115
+
103
116
echo " Using PKG_LIBS=$PKG_LIBS "
117
+ echo " Using PKG_CFLAGS=$PKG_CFLAGS "
118
+
104
119
105
120
# Write to Makevars
106
121
sed -e " s|@cflags@|$PKG_CFLAGS |" -e " s|@libs@|$PKG_LIBS |" src/Makevars.in > src/Makevars
Original file line number Diff line number Diff line change @@ -85,6 +85,10 @@ print_next <- function() {
85
85
)
86
86
cli :: cat_bullet(" Remove extra semi-colon at s2boolean_operation.h#376" )
87
87
cli :: cat_bullet(" Remove extra semi-colons because of FROMHOST_TYPE_MAP macro (utils/endian/endian.h#565)" )
88
+ cli :: cat_bullet(
89
+ " Check for definition of IS_LITTLE_ENDIAN and IS_BIG_ENDIAN to allow configure script " ,
90
+ " override (s2/base/port.h:273) without macro redefinition warnings"
91
+ )
88
92
cli :: cat_bullet(" Replace `abort()` with `cpp_compat_abort()`" )
89
93
cli :: cat_bullet(" Replace `cerr`/`cout` with `cpp_compat_cerr`/`cpp_compat_cout`" )
90
94
cli :: cat_bullet(" Replace `srandom()` with `cpp_compat_srandom()`" )
Original file line number Diff line number Diff line change @@ -274,6 +274,15 @@ inline void sized_delete_array(void *ptr, size_t size) {
274
274
// -----------------------------------------------------------------------------
275
275
276
276
// IS_LITTLE_ENDIAN, IS_BIG_ENDIAN
277
+
278
+ // Allow compiler -D defines to override detection here
279
+ // which occasionally fails (e.g., on CRAN Solaris)
280
+ #if defined(IS_LITTLE_ENDIAN)
281
+ #undef IS_BIG_ENDIAN
282
+ #elif defined(IS_BIG_ENDIAN)
283
+ #undef IS_LITTLE_ENDIAN
284
+ #else
285
+
277
286
#if defined __linux__ || defined OS_ANDROID || defined(__ANDROID__)
278
287
// TODO(user): http://b/21460321; use one of OS_ANDROID or __ANDROID__.
279
288
// _BIG_ENDIAN
@@ -318,6 +327,7 @@ inline void sized_delete_array(void *ptr, size_t size) {
318
327
319
328
#endif // __BYTE_ORDER
320
329
#endif // _MSC_VER
330
+ #endif // #if defined(IS_LITTLE_ENDIAN) ... #else
321
331
322
332
// byte swap functions (bswap_16, bswap_32, bswap_64).
323
333
You can’t perform that action at this time.
0 commit comments