From: Sean Cannella Date: Mon, 29 Jul 2013 19:36:55 +0000 (-0700) Subject: fix folly Range compilation on FreeBSD X-Git-Tag: v0.22.0~919 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b22d95e46a8a3afee60579144c59ec28376e9807;p=folly.git 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 --- 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])