From 9f30df678da241d5a1fc5f9c014b224da142390c Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 11 Feb 2019 08:24:39 -0800 Subject: [PATCH] Unbreak the continuous integration build The Travis environment in which the continous integration build is run does not have the header file. Make sure that the zbdioctl.c source file builds fine without that header file. Cc: Shin'ichiro Kawasaki Cc: Chaitanya Kulkarni Fixes: d42cc3f85e0d ("src: Introduce zbdioctl program") Signed-off-by: Bart Van Assche --- src/Makefile | 10 ++++++++-- src/zbdioctl.c | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Makefile b/src/Makefile index 5a0556f..cb35497 100644 --- a/src/Makefile +++ b/src/Makefile @@ -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) diff --git a/src/zbdioctl.c b/src/zbdioctl.c index 93a0f88..9432a8a 100644 --- a/src/zbdioctl.c +++ b/src/zbdioctl.c @@ -6,7 +6,9 @@ #include #include #include +#ifdef HAVE_LINUX_BLKZONED_H #include +#endif #include #ifndef BLKGETZONESZ -- 2.51.0