Only build t/read-to-pipe-async if pread() is available
authorBart Van Assche <bvanassche@acm.org>
Fri, 3 Jan 2020 20:41:33 +0000 (12:41 -0800)
committerBart Van Assche <bvanassche@acm.org>
Sat, 4 Jan 2020 00:40:37 +0000 (16:40 -0800)
Reported-by: Vincent Fu <vincent.fu@wdc.com>
Fixes: 5ad80fa7cf5b ("Makefile: Build more test code")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Makefile
configure

index dc2a05150a0ed340a3754371eceabc230e677787..dd26afca16fe413e440ba728d4292116e493c305 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -314,7 +314,9 @@ T_PROGS += $(T_BTRACE_FIO_PROGS)
 T_PROGS += $(T_DEDUPE_PROGS)
 T_PROGS += $(T_VS_PROGS)
 T_TEST_PROGS += $(T_MEMLOCK_PROGS)
+ifdef CONFIG_PREAD
 T_TEST_PROGS += $(T_PIPE_ASYNC_PROGS)
+endif
 ifneq (,$(findstring Linux,$(CONFIG_TARGET_OS)))
 T_TEST_PROGS += $(T_IOU_RING_PROGS)
 endif
index 9020b158ab4a38c90d8fea3d16242d43cb2bfba4..f7f082da25994e23c8a660ff802e6ceb40b40dbe 100755 (executable)
--- a/configure
+++ b/configure
@@ -1110,6 +1110,23 @@ if compile_prog "" "" "fdatasync"; then
 fi
 print_config "fdatasync" "$fdatasync"
 
+##########################################
+# pread() probe
+if test "$pread" != "yes" ; then
+  pread="no"
+fi
+cat > $TMPC << EOF
+#include <unistd.h>
+int main(int argc, char **argv)
+{
+  return pread(0, NULL, 0, 0);
+}
+EOF
+if compile_prog "" "" "pread"; then
+  pread="yes"
+fi
+print_config "pread()" "$pread"
+
 ##########################################
 # sync_file_range() probe
 if test "$sync_file_range" != "yes" ; then
@@ -2493,6 +2510,9 @@ fi
 if test "$fdatasync" = "yes" ; then
   output_sym "CONFIG_FDATASYNC"
 fi
+if test "$pread" = "yes" ; then
+  output_sym "CONFIG_PREAD"
+fi
 if test "$sync_file_range" = "yes" ; then
   output_sym "CONFIG_SYNC_FILE_RANGE"
 fi