From d2004b15f1e90efafedc367335c07ad4636d291d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Fri, 7 Apr 2017 16:04:40 +0200 Subject: text: add mem{r,}chr(3) based byte search functions These are generally implemented efficiently in libc. While memrchr(3) is non-standard, it is a common extension. If it is not available, we use a simple C implementation from musl. --- configure | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'configure') diff --git a/configure b/configure index f12b96b..8cfd512 100755 --- a/configure +++ b/configure @@ -594,6 +594,25 @@ EOF fi fi +printf "checking for memrchr... " + +cat > "$tmpc" < + +int main(int argc, char *argv[]) { + return !memrchr("\n", '\n', 1); +} +EOF + +if $CC $CFLAGS "$tmpc" $LDFLAGS -o "$tmpo" >/dev/null 2>&1; then + HAVE_MEMRCHR=1 + printf "%s\n" "yes" +else + HAVE_MEMRCHR=0 + printf "%s\n" "no" +fi + printf "completing config.mk... " exec 3>&1 1>>config.mk @@ -621,6 +640,7 @@ LDFLAGS_ACL = $LDFLAGS_ACL CONFIG_SELINUX = $CONFIG_SELINUX CFLAGS_SELINUX = $CFLAGS_SELINUX LDFLAGS_SELINUX = $LDFLAGS_SELINUX +CFLAGS_LIBC = -DHAVE_MEMRCHR=$HAVE_MEMRCHR EOF exec 1>&3 3>&- -- cgit v1.2.3