From c42e9a37a94d2d0c63b7227ab65e35fa8c1c88f8 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Wed, 25 Sep 2013 16:20:15 +0000 Subject: [PATCH] build: tweaks for C++11 support on Android. --- configure.ac | 13 ++++++++----- src/lol/math/functions.h | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index f3a0c2e3..0d4333f8 100644 --- a/configure.ac +++ b/configure.ac @@ -81,12 +81,18 @@ AC_ARG_ENABLE(doc, [ --enable-doc build documentation (needs doxygen and LaTeX)]) +dnl C++11 mode. Checked early so that we don't run into surprises. +LOL_TRY_CXXFLAGS(-std=c++11, + [AM_CXXFLAGS="${AM_CXXFLAGS} -std=c++11" + CXXFLAGS="${CXXFLAGS} -std=c++11"]) + + dnl Common C headers -AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h) +AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h math.h) AC_CHECK_HEADERS(fastmath.h pthread.h libutil.h util.h pty.h glob.h unistd.h) AC_CHECK_HEADERS(execinfo.h) AC_CHECK_HEADERS(sys/ioctl.h sys/ptrace.h sys/stat.h sys/syscall.h sys/user.h) -AC_CHECK_HEADERS(sys/wait.h sys/time.h) +AC_CHECK_HEADERS(sys/wait.h sys/time.h sys/types.h) AC_CHECK_HEADERS(linux/kdev_t.h linux/major.h) AC_CHECK_HEADERS(security/pam_appl.h security/pam_misc.h) AC_CHECK_HEADERS(pam/pam_appl.h pam/pam_misc.h) @@ -177,9 +183,6 @@ AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no") AM_CONDITIONAL(USE_DOT, test "${DOT}" != "no") -dnl C++11 mode -LOL_TRY_CXXFLAGS(-std=c++11, [AM_CXXFLAGS="${AM_CXXFLAGS} -std=c++11"]) - dnl No exceptions LOL_TRY_CXXFLAGS(-fno-exceptions, [AM_CXXFLAGS="${AM_CXXFLAGS} -fno-exceptions"]) LOL_TRY_CXXFLAGS(-fno-rtti, [AM_CXXFLAGS="${AM_CXXFLAGS} -fno-rtti"]) diff --git a/src/lol/math/functions.h b/src/lol/math/functions.h index 1b53599e..5f692456 100644 --- a/src/lol/math/functions.h +++ b/src/lol/math/functions.h @@ -119,7 +119,7 @@ static inline int16_t abs(int16_t x) { return std::abs(x); } static inline uint16_t abs(uint16_t x) { return x; } static inline int32_t abs(int32_t x) { return std::abs(x); } static inline uint32_t abs(uint32_t x) { return x; } -#if defined __native_client__ +#if defined __native_client__ || defined __ANDROID__ /* The pepper 19 toolchain doesn't provide abs() for long long int. */ static inline int64_t abs(int64_t x) { return x > 0 ? x : -x; } #else