Browse Source

Check linux/fs.h file.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Andrew Borodin 6 years ago
parent
commit
2e5cd866f9
2 changed files with 8 additions and 0 deletions
  1. 6 0
      configure.ac
  2. 2 0
      lib/vfs/vfs.c

+ 6 - 0
configure.ac

@@ -304,6 +304,12 @@ AC_EGREP_CPP([yes],
         AC_MSG_RESULT(no)
     ])
 
+dnl Check linux/fs.h for FICLONE to support BTRFS's file clone operation
+case $host_os in
+linux*)
+    AC_CHECK_HEADERS([linux/fs.h])
+esac
+
 dnl Check if the OS is supported by the console saver.
 cons_saver=""
 case $host_os in

+ 2 - 0
lib/vfs/vfs.c

@@ -46,7 +46,9 @@
 #include <stdlib.h>
 
 #ifdef __linux__
+#ifdef HAVE_LINUX_FS_H
 #include <linux/fs.h>
+#endif /* HAVE_LINUX_FS_H */
 #ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
 #endif /* HAVE_SYS_IOCTL_H */