From d077ea28e30e4240883df59cc93be994b0edf70c Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Mon, 18 Nov 2019 13:41:51 +0100 Subject: [PATCH] configure: check for FUSE copy_file_range check if the version of FUSE supports copy_file_range. It fixes the build on RHEL 8. Signed-off-by: Giuseppe Scrivano --- configure.ac | 20 +++++++++++++++++++- main.c | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 789136d..f0d5525 100644 --- a/configure.ac +++ b/configure.ac @@ -49,10 +49,28 @@ void foo() ], [cache_readdir=1], [cache_readdir=0]) + + +AC_COMPILE_IFELSE( +[ +AC_LANG_SOURCE([ +#define FUSE_USE_VERSION 32 +#include +void foo() +{ + struct fuse_lowlevel_ops ops; + ops.copy_file_range = 0; +}]) +], +[fuse_has_copy_file_range=1], +[fuse_has_copy_file_range=0]) + + CFLAGS=$old_CFLAGS LDFLAGS=$old_LDFLAGS -AC_DEFINE_UNQUOTED([HAVE_FUSE_CACHE_READDIR], $cache_readdir, [Define if libfuse is available]) +AC_DEFINE_UNQUOTED([HAVE_FUSE_CACHE_READDIR], $cache_readdir, [Define if libfuse cache_readdir is available]) +AC_DEFINE_UNQUOTED([HAVE_FUSE_COPY_FILE_RANGE], $fuse_has_copy_file_range, [Define if libfuse has copy_file_range is available]) AC_SEARCH_LIBS([dlopen], [dl], [], [AC_MSG_ERROR([unable to find dlopen()])]) diff --git a/main.c b/main.c index fea2392..90e99b2 100644 --- a/main.c +++ b/main.c @@ -4887,7 +4887,7 @@ static struct fuse_lowlevel_ops ovl_oper = .fsyncdir = ovl_fsyncdir, .ioctl = ovl_ioctl, .fallocate = ovl_fallocate, -#ifdef HAVE_COPY_FILE_RANGE +#if HAVE_COPY_FILE_RANGE && HAVE_FUSE_COPY_FILE_RANGE .copy_file_range = ovl_copy_file_range, #endif };