]> www.infradead.org Git - users/hch/blktests.git/commitdiff
Unbreak the continuous integration build
authorBart Van Assche <bvanassche@acm.org>
Mon, 11 Feb 2019 16:24:39 +0000 (08:24 -0800)
committerBart Van Assche <bvanassche@acm.org>
Mon, 11 Feb 2019 16:34:27 +0000 (08:34 -0800)
The Travis environment in which the continous integration build is run
does not have the <linux/blkzoned.h> header file. Make sure that the
zbdioctl.c source file builds fine without that header file.

Cc: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
Fixes: d42cc3f85e0d ("src: Introduce zbdioctl program")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
src/Makefile
src/zbdioctl.c

index 5a0556f2a37f26ff639b88045bfc873b35c995fe..cb35497a60892be8a5e7d48dd1bcb901de63b1b9 100644 (file)
@@ -1,3 +1,7 @@
+HAVE_C_HEADER = $(shell if echo "\#include <$(1)>" |                   \
+                 $(CC) -x c -c - 2>/dev/null; then echo "$(2)";        \
+                 else echo "$(3)"; fi)
+
 C_TARGETS := \
        loblksize \
        loop_get_status_null \
@@ -13,9 +17,11 @@ CXX_TARGETS := \
 
 TARGETS := $(C_TARGETS) $(CXX_TARGETS)
 
-override CFLAGS   := -O2 -Wall -Wshadow $(CFLAGS)
+CONFIG_DEFS := $(call HAVE_C_HEADER,linux/blkzoned.h,-DHAVE_LINUX_BLKZONED_H)
+
+override CFLAGS   := -O2 -Wall -Wshadow $(CFLAGS) $(CONFIG_DEFS)
 override CXXFLAGS := -O2 -std=c++11 -Wall -Wextra -Wshadow -Wno-sign-compare \
-                    -Werror $(CXXFLAGS)
+                    -Werror $(CXXFLAGS) $(CONFIG_DEFS)
 
 all: $(TARGETS)
 
index 93a0f88431b5d6412ca0516823796a3496a938af..9432a8a95b1d377281a8c7780ae41550c6be76e3 100644 (file)
@@ -6,7 +6,9 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/ioctl.h>
+#ifdef HAVE_LINUX_BLKZONED_H
 #include <linux/blkzoned.h>
+#endif
 #include <linux/types.h>
 
 #ifndef BLKGETZONESZ