Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 1 | From 0be174dbedd861d7694b0c7799fe26be31eb32b0 Mon Sep 17 00:00:00 2001 |
| 2 | From: Benjamin Marzinski <bmarzins@redhat.com> |
| 3 | Date: Fri, 26 May 2017 17:52:57 -0500 |
| 4 | Subject: [PATCH 08/14] libmultipath: change how RADOS checker is enabled |
| 5 | |
| 6 | Instead of making the user call "make", "make install" and "make clean" |
| 7 | with ENABLE_RADOS set correctly, have the makefile check if |
| 8 | /usr/include/rados/librados.h exists, just like it checks if specific |
| 9 | functions exist in a file. |
| 10 | |
| 11 | Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> |
| 12 | --- |
| 13 | Makefile.inc | 13 +++++++++++++ |
| 14 | libmultipath/checkers/Makefile | 3 ++- |
| 15 | 2 files changed, 15 insertions(+), 1 deletion(-) |
| 16 | |
| 17 | diff --git a/Makefile.inc b/Makefile.inc |
| 18 | index 2591fa9..e084fd1 100644 |
| 19 | --- a/Makefile.inc |
| 20 | +++ b/Makefile.inc |
| 21 | @@ -109,5 +109,18 @@ check_func = \ |
| 22 | echo "$$found" \ |
| 23 | ) |
| 24 | |
| 25 | +# Checker whether a file with name $1 exists |
| 26 | +check_file = $(shell \ |
| 27 | + if [ -f "$1" ]; then \ |
| 28 | + found=1; \ |
| 29 | + status="yes"; \ |
| 30 | + else \ |
| 31 | + found=0; \ |
| 32 | + status="no"; \ |
| 33 | + fi; \ |
| 34 | + echo 1>&2 "Checking if $1 exists ... $$status"; \ |
| 35 | + echo "$$found" \ |
| 36 | + ) |
| 37 | + |
| 38 | %.o: %.c |
| 39 | $(CC) $(CFLAGS) -c -o $@ $< |
| 40 | diff --git a/libmultipath/checkers/Makefile b/libmultipath/checkers/Makefile |
| 41 | index 732ca9d..bce6b8b 100644 |
| 42 | --- a/libmultipath/checkers/Makefile |
| 43 | +++ b/libmultipath/checkers/Makefile |
| 44 | @@ -14,7 +14,8 @@ LIBS= \ |
| 45 | libcheckemc_clariion.so \ |
| 46 | libcheckhp_sw.so \ |
| 47 | libcheckrdac.so |
| 48 | -ifneq ($(ENABLE_RADOS),0) |
| 49 | + |
| 50 | +ifneq ($(call check_file,/usr/include/rados/librados.h),0) |
| 51 | LIBS += libcheckrbd.so |
| 52 | endif |
| 53 | |
| 54 | -- |
| 55 | 2.8.1 |
| 56 | |