From b22d95e46a8a3afee60579144c59ec28376e9807 Mon Sep 17 00:00:00 2001 From: Sean Cannella Date: Mon, 29 Jul 2013 12:36:55 -0700 Subject: [PATCH] fix folly Range compilation on FreeBSD Summary: - memrchr is GNU + Linux specific, it turns out Test Plan: - compiled on FreeBSD, contbuild Reviewed By: delong.j@fb.com FB internal diff: D900935 --- folly/Range.h | 4 ++-- folly/configure.ac | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/folly/Range.h b/folly/Range.h index 85a554c5..a1cce77f 100644 --- a/folly/Range.h +++ b/folly/Range.h @@ -705,7 +705,7 @@ inline size_t qfind(const Range& haystack, const char& needle) { return pos == nullptr ? std::string::npos : pos - haystack.data(); } -#ifdef _GNU_SOURCE // memrchr is a GNU extension +#if FOLLY_HAVE_MEMRCHR template <> inline size_t rfind(const Range& haystack, const char& needle) { auto pos = static_cast( @@ -723,7 +723,7 @@ inline size_t qfind(const Range& haystack, return pos == nullptr ? std::string::npos : pos - haystack.data(); } -#ifdef _GNU_SOURCE // memrchr is a GNU extension +#if FOLLY_HAVE_MEMRCHR template <> inline size_t rfind(const Range& haystack, const unsigned char& needle) { diff --git a/folly/configure.ac b/folly/configure.ac index 33ac2e8e..8d5765c1 100644 --- a/folly/configure.ac +++ b/folly/configure.ac @@ -86,7 +86,8 @@ AC_CHECK_FUNCS([getdelim \ pthread_yield \ rallocm \ malloc_size \ - malloc_usable_size]) + malloc_usable_size \ + memrchr]) if test "$ac_cv_func_pthread_yield" = "no"; then AC_CHECK_HEADERS([sched.h]) -- 2.34.1