604 lines
19 KiB
Diff
604 lines
19 KiB
Diff
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||
|
From: Martin Wilck <mwilck@suse.com>
|
||
|
Date: Fri, 28 Oct 2022 00:01:46 +0200
|
||
|
Subject: [PATCH] multipath-tools Makefiles: create config.mk
|
||
|
|
||
|
Rather than running the test scripts for certain system features
|
||
|
every time "make" is called, save the configuration in "config.mk"
|
||
|
and "libmultipath/autoconfig.h", and reuse it later. This reduces
|
||
|
build time, especially in subsequent builds, and the build output is
|
||
|
less garbled by compiler options.
|
||
|
|
||
|
It works by invoking the separate make file "create-config.mk" at
|
||
|
the beginning of the build process. Most of the complex makefile
|
||
|
functions are moved to "create-config.mk".
|
||
|
|
||
|
Signed-off-by: Martin Wilck <mwilck@suse.com>
|
||
|
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||
|
---
|
||
|
.github/workflows/foreign.yaml | 2 +-
|
||
|
.gitignore | 2 +
|
||
|
Makefile | 19 +++-
|
||
|
Makefile.inc | 76 +--------------
|
||
|
create-config.mk | 144 +++++++++++++++++++++++++++++
|
||
|
kpartx/Makefile | 4 -
|
||
|
kpartx/devmapper.c | 1 +
|
||
|
kpartx/kpartx.c | 1 +
|
||
|
libdmmp/test/Makefile | 1 +
|
||
|
libmultipath/Makefile | 30 +-----
|
||
|
libmultipath/devmapper.h | 2 +-
|
||
|
libmultipath/dict.c | 1 +
|
||
|
libmultipath/prioritizers/Makefile | 2 +-
|
||
|
libmultipath/propsel.c | 1 +
|
||
|
libmultipath/uevent.c | 1 +
|
||
|
multipathd/Makefile | 11 ---
|
||
|
multipathd/fpin.h | 1 +
|
||
|
multipathd/main.c | 1 +
|
||
|
rules.mk | 3 +
|
||
|
tests/Makefile | 8 --
|
||
|
20 files changed, 179 insertions(+), 132 deletions(-)
|
||
|
create mode 100644 create-config.mk
|
||
|
|
||
|
diff --git a/.github/workflows/foreign.yaml b/.github/workflows/foreign.yaml
|
||
|
index bd4e9c12..5a19913a 100644
|
||
|
--- a/.github/workflows/foreign.yaml
|
||
|
+++ b/.github/workflows/foreign.yaml
|
||
|
@@ -30,7 +30,7 @@ jobs:
|
||
|
if: ${{ matrix.arch != '' && matrix.arch != '-i386' }}
|
||
|
run: >
|
||
|
tar cfv binaries.tar
|
||
|
- Makefile*
|
||
|
+ Makefile* config.mk
|
||
|
libmpathcmd/*.so* libmultipath/*.so* libmpathutil/*.so*
|
||
|
libmultipath/checkers/*.so libmultipath/prioritizers/*.so
|
||
|
libmultipath/foreign/*.so
|
||
|
diff --git a/.gitignore b/.gitignore
|
||
|
index 83f8a552..535353e5 100644
|
||
|
--- a/.gitignore
|
||
|
+++ b/.gitignore
|
||
|
@@ -8,6 +8,7 @@
|
||
|
*.gz
|
||
|
*.d
|
||
|
\#*
|
||
|
+config.mk
|
||
|
cscope.files
|
||
|
cscope.out
|
||
|
kpartx/kpartx
|
||
|
@@ -35,5 +36,6 @@ tests/*.out
|
||
|
tests/*.vgr
|
||
|
libmultipath/nvme-ioctl.c
|
||
|
libmultipath/nvme-ioctl.h
|
||
|
+libmultipath/autoconfig.h
|
||
|
*/*-nv.version
|
||
|
reference-abi
|
||
|
diff --git a/Makefile b/Makefile
|
||
|
index 27b4641f..1b28db62 100644
|
||
|
--- a/Makefile
|
||
|
+++ b/Makefile
|
||
|
@@ -30,7 +30,14 @@ BUILDDIRS.clean := $(BUILDDIRS:=.clean) tests.clean
|
||
|
|
||
|
all: $(BUILDDIRS)
|
||
|
|
||
|
-$(BUILDDIRS):
|
||
|
+config.mk libmultipath/autoconfig.h:
|
||
|
+ @$(MAKE) -f create-config.mk
|
||
|
+ @echo ==== config.mk ====
|
||
|
+ @cat config.mk
|
||
|
+ @echo ==== autoconfig.h ====
|
||
|
+ @cat libmultipath/autoconfig.h
|
||
|
+
|
||
|
+$(BUILDDIRS): config.mk
|
||
|
$(MAKE) -C $@
|
||
|
|
||
|
$(LIB_BUILDDIRS:=.abi): $(LIB_BUILDDIRS)
|
||
|
@@ -83,7 +90,7 @@ libmultipath/checkers.install \
|
||
|
libmultipath/prioritizers.install \
|
||
|
libmultipath/foreign.install: libmultipath.install
|
||
|
|
||
|
-$(BUILDDIRS.clean):
|
||
|
+%.clean:
|
||
|
$(MAKE) -C ${@:.clean=} clean
|
||
|
|
||
|
%.install: %
|
||
|
@@ -92,8 +99,12 @@ $(BUILDDIRS.clean):
|
||
|
$(BUILDDIRS:=.uninstall):
|
||
|
$(MAKE) -C ${@:.uninstall=} uninstall
|
||
|
|
||
|
-clean: $(BUILDDIRS.clean)
|
||
|
- rm -rf abi abi.tar.gz abi-test compile_commands.json
|
||
|
+# If config.mk is missing, "make clean" in subdir either fails, or tries to
|
||
|
+# build it. Both is undesirable. Avoid it by creating config.mk temporarily.
|
||
|
+clean:
|
||
|
+ @touch config.mk
|
||
|
+ $(MAKE) $(BUILDDIRS:=.clean) tests.clean || true
|
||
|
+ rm -rf abi abi.tar.gz abi-test compile_commands.json config.mk
|
||
|
|
||
|
install: $(BUILDDIRS:=.install)
|
||
|
uninstall: $(BUILDDIRS:=.uninstall)
|
||
|
diff --git a/Makefile.inc b/Makefile.inc
|
||
|
index fe6bc088..415634f5 100644
|
||
|
--- a/Makefile.inc
|
||
|
+++ b/Makefile.inc
|
||
|
@@ -27,9 +27,9 @@ PKGCONFIG ?= pkg-config
|
||
|
ifeq ($(TOPDIR),)
|
||
|
TOPDIR = ..
|
||
|
endif
|
||
|
-
|
||
|
-SYSTEMD := $(strip $(or $(shell $(PKGCONFIG) --modversion libsystemd 2>/dev/null | awk '{print $$1}'), \
|
||
|
- $(shell systemctl --version 2>/dev/null | sed -n 's/systemd \([0-9]*\).*/\1/p')))
|
||
|
+ifneq ($(CREATE_CONFIG),1)
|
||
|
+include $(TOPDIR)/config.mk
|
||
|
+endif
|
||
|
|
||
|
# Paths. All these can be overridden on the "make" command line.
|
||
|
prefix :=
|
||
|
@@ -65,37 +65,6 @@ RM := rm -f
|
||
|
LN := ln -sf
|
||
|
INSTALL_PROGRAM := install
|
||
|
|
||
|
-# $(call TEST_CC_OPTION,option,fallback)
|
||
|
-# Test if the C compiler supports the option.
|
||
|
-# Evaluates to "option" if yes, and "fallback" otherwise.
|
||
|
-TEST_CC_OPTION = $(shell \
|
||
|
- if echo 'int main(void){return 0;}' | \
|
||
|
- $(CC) -o /dev/null -c -Werror "$(1)" -xc - >/dev/null 2>&1; \
|
||
|
- then \
|
||
|
- echo "$(1)"; \
|
||
|
- else \
|
||
|
- echo "$(2)"; \
|
||
|
- fi)
|
||
|
-
|
||
|
-# "make" on some distros will fail on explicit '#' or '\#' in the program text below
|
||
|
-__HASH__ := \#
|
||
|
-# Check if _DFORTIFY_SOURCE=3 is supported.
|
||
|
-# On some distros (e.g. Debian Buster) it will be falsely reported as supported
|
||
|
-# but it doesn't seem to make a difference wrt the compilation result.
|
||
|
-FORTIFY_OPT := $(shell \
|
||
|
- if /bin/echo -e '$(__HASH__)include <string.h>\nint main(void) { return 0; }' | \
|
||
|
- $(CC) -o /dev/null -c -O2 -Werror -D_FORTIFY_SOURCE=3 -xc - 2>/dev/null; \
|
||
|
- then \
|
||
|
- echo "-D_FORTIFY_SOURCE=3"; \
|
||
|
- else \
|
||
|
- echo "-D_FORTIFY_SOURCE=2"; \
|
||
|
- fi)
|
||
|
-
|
||
|
-STACKPROT := $(call TEST_CC_OPTION,-fstack-protector-strong,-fstack-protector)
|
||
|
-ERROR_DISCARDED_QUALIFIERS := $(call TEST_CC_OPTION,-Werror=discarded-qualifiers,)
|
||
|
-WNOCLOBBERED := $(call TEST_CC_OPTION,-Wno-clobbered -Wno-error=clobbered,)
|
||
|
-WFORMATOVERFLOW := $(call TEST_CC_OPTION,-Wformat-overflow=2,)
|
||
|
-
|
||
|
SYSTEMD_CPPFLAGS := $(if $(SYSTEMD),-DUSE_SYSTEMD=$(SYSTEMD))
|
||
|
SYSTEMD_LIBDEPS := $(if $(SYSTEMD),$(if $(shell test $(SYSTEMD) -gt 209 && echo 1),-lsystemd,-lsystemd-daemon))
|
||
|
|
||
|
@@ -133,45 +102,6 @@ LIBS = $(DEVLIB).$(SONAME)
|
||
|
VERSION_SCRIPT = $(DEVLIB:%.so=%.version)
|
||
|
NV_VERSION_SCRIPT = $(DEVLIB:%.so=%-nv.version)
|
||
|
|
||
|
-# Check whether a function with name $1 has been declared in header file $2.
|
||
|
-check_func = $(shell \
|
||
|
- if grep -Eq "^[^[:blank:]]+[[:blank:]]+$1[[:blank:]]*(.*)*" "$2"; then \
|
||
|
- found=1; \
|
||
|
- status="yes"; \
|
||
|
- else \
|
||
|
- found=0; \
|
||
|
- status="no"; \
|
||
|
- fi; \
|
||
|
- echo 1>&2 "Checking for $1 in $2 ... $$status"; \
|
||
|
- echo "$$found" \
|
||
|
- )
|
||
|
-
|
||
|
-# Checker whether a file with name $1 exists
|
||
|
-check_file = $(shell \
|
||
|
- if [ -f "$1" ]; then \
|
||
|
- found=1; \
|
||
|
- status="yes"; \
|
||
|
- else \
|
||
|
- found=0; \
|
||
|
- status="no"; \
|
||
|
- fi; \
|
||
|
- echo 1>&2 "Checking if $1 exists ... $$status"; \
|
||
|
- echo "$$found" \
|
||
|
- )
|
||
|
-
|
||
|
-# Check whether a file contains a variable with name $1 in header file $2
|
||
|
-check_var = $(shell \
|
||
|
- if grep -Eq "(^|[[:blank:]])$1([[:blank:]]|=|$$)" "$2"; then \
|
||
|
- found=1; \
|
||
|
- status="yes"; \
|
||
|
- else \
|
||
|
- found=0; \
|
||
|
- status="no"; \
|
||
|
- fi; \
|
||
|
- echo 1>&2 "Checking for $1 in $2 ... $$status"; \
|
||
|
- echo "$$found" \
|
||
|
- )
|
||
|
-
|
||
|
%.o: %.c
|
||
|
@echo building $@ because of $?
|
||
|
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
|
||
|
diff --git a/create-config.mk b/create-config.mk
|
||
|
new file mode 100644
|
||
|
index 00000000..2cc5284f
|
||
|
--- /dev/null
|
||
|
+++ b/create-config.mk
|
||
|
@@ -0,0 +1,144 @@
|
||
|
+# Copyright (c) SUSE LLC
|
||
|
+# SPDX-License-Identifier: GPL-2.0-or-later
|
||
|
+
|
||
|
+TOPDIR := .
|
||
|
+CREATE_CONFIG := 1
|
||
|
+include $(TOPDIR)/Makefile.inc
|
||
|
+
|
||
|
+# Check whether a function with name $1 has been declared in header file $2.
|
||
|
+check_func = $(shell \
|
||
|
+ if grep -Eq "^[^[:blank:]]+[[:blank:]]+$1[[:blank:]]*(.*)*" "$2"; then \
|
||
|
+ found=1; \
|
||
|
+ status="yes"; \
|
||
|
+ else \
|
||
|
+ found=0; \
|
||
|
+ status="no"; \
|
||
|
+ fi; \
|
||
|
+ echo 1>&2 "Checking for $1 in $2 ... $$status"; \
|
||
|
+ echo "$$found" \
|
||
|
+ )
|
||
|
+
|
||
|
+# Checker whether a file with name $1 exists
|
||
|
+check_file = $(shell \
|
||
|
+ if [ -f "$1" ]; then \
|
||
|
+ found=1; \
|
||
|
+ status="yes"; \
|
||
|
+ else \
|
||
|
+ found=0; \
|
||
|
+ status="no"; \
|
||
|
+ fi; \
|
||
|
+ echo 1>&2 "Checking if $1 exists ... $$status"; \
|
||
|
+ echo "$$found" \
|
||
|
+ )
|
||
|
+
|
||
|
+# Check whether a file contains a variable with name $1 in header file $2
|
||
|
+check_var = $(shell \
|
||
|
+ if grep -Eq "(^|[[:blank:]])$1([[:blank:]]|=|$$)" "$2"; then \
|
||
|
+ found=1; \
|
||
|
+ status="yes"; \
|
||
|
+ else \
|
||
|
+ found=0; \
|
||
|
+ status="no"; \
|
||
|
+ fi; \
|
||
|
+ echo 1>&2 "Checking for $1 in $2 ... $$status"; \
|
||
|
+ echo "$$found" \
|
||
|
+ )
|
||
|
+
|
||
|
+# Test special behavior of gcc 4.8 with nested initializers
|
||
|
+# gcc 4.8 compiles blacklist.c only with -Wno-missing-field-initializers
|
||
|
+TEST_MISSING_INITIALIZERS = $(shell \
|
||
|
+ echo 'struct A {int a, b;}; struct B {struct A a; int b;} b = {.a.a=1};' | \
|
||
|
+ $(CC) -c -Werror -Wmissing-field-initializers -o /dev/null -xc - >/dev/null 2>&1 \
|
||
|
+ || echo -Wno-missing-field-initializers)
|
||
|
+
|
||
|
+DEFINES :=
|
||
|
+
|
||
|
+ifneq ($(call check_func,dm_task_no_flush,$(devmapper_incdir)/libdevmapper.h),0)
|
||
|
+ DEFINES += LIBDM_API_FLUSH
|
||
|
+endif
|
||
|
+
|
||
|
+ifneq ($(call check_func,dm_task_get_errno,$(devmapper_incdir)/libdevmapper.h),0)
|
||
|
+ DEFINES += LIBDM_API_GET_ERRNO
|
||
|
+endif
|
||
|
+
|
||
|
+ifneq ($(call check_func,dm_task_set_cookie,$(devmapper_incdir)/libdevmapper.h),0)
|
||
|
+ DEFINES += LIBDM_API_COOKIE
|
||
|
+endif
|
||
|
+
|
||
|
+ifneq ($(call check_func,udev_monitor_set_receive_buffer_size,$(libudev_incdir)/libudev.h),0)
|
||
|
+ DEFINES += LIBUDEV_API_RECVBUF
|
||
|
+endif
|
||
|
+
|
||
|
+ifneq ($(call check_func,dm_task_deferred_remove,$(devmapper_incdir)/libdevmapper.h),0)
|
||
|
+ DEFINES += LIBDM_API_DEFERRED
|
||
|
+endif
|
||
|
+
|
||
|
+ifneq ($(call check_func,dm_hold_control_dev,$(devmapper_incdir)/libdevmapper.h),0)
|
||
|
+ DEFINES += LIBDM_API_HOLD_CONTROL
|
||
|
+endif
|
||
|
+
|
||
|
+ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(kernel_incdir)/scsi/fc/fc_els.h),0)
|
||
|
+ DEFINES += FPIN_EVENT_HANDLER
|
||
|
+ FPIN_SUPPORT = 1
|
||
|
+endif
|
||
|
+
|
||
|
+ifneq ($(call check_file,$(kernel_incdir)/linux/nvme_ioctl.h),0)
|
||
|
+ ANA_SUPPORT := 1
|
||
|
+endif
|
||
|
+
|
||
|
+ifeq ($(ENABLE_DMEVENTS_POLL),0)
|
||
|
+ DEFINES += -DNO_DMEVENTS_POLL
|
||
|
+endif
|
||
|
+
|
||
|
+SYSTEMD := $(strip $(or $(shell $(PKGCONFIG) --modversion libsystemd 2>/dev/null | awk '{print $$1}'), \
|
||
|
+ $(shell systemctl --version 2>/dev/null | sed -n 's/systemd \([0-9]*\).*/\1/p')))
|
||
|
+
|
||
|
+
|
||
|
+# $(call TEST_CC_OPTION,option,fallback)
|
||
|
+# Test if the C compiler supports the option.
|
||
|
+# Evaluates to "option" if yes, and "fallback" otherwise.
|
||
|
+TEST_CC_OPTION = $(shell \
|
||
|
+ if echo 'int main(void){return 0;}' | \
|
||
|
+ $(CC) -o /dev/null -c -Werror "$(1)" -xc - >/dev/null 2>&1; \
|
||
|
+ then \
|
||
|
+ echo "$(1)"; \
|
||
|
+ else \
|
||
|
+ echo "$(2)"; \
|
||
|
+ fi)
|
||
|
+
|
||
|
+# "make" on some distros will fail on explicit '#' or '\#' in the program text below
|
||
|
+__HASH__ := \#
|
||
|
+# Check if _DFORTIFY_SOURCE=3 is supported.
|
||
|
+# On some distros (e.g. Debian Buster) it will be falsely reported as supported
|
||
|
+# but it doesn't seem to make a difference wrt the compilation result.
|
||
|
+FORTIFY_OPT := $(shell \
|
||
|
+ if /bin/echo -e '$(__HASH__)include <string.h>\nint main(void) { return 0; }' | \
|
||
|
+ $(CC) -o /dev/null -c -O2 -Werror -D_FORTIFY_SOURCE=3 -xc - 2>/dev/null; \
|
||
|
+ then \
|
||
|
+ echo "-D_FORTIFY_SOURCE=3"; \
|
||
|
+ else \
|
||
|
+ echo "-D_FORTIFY_SOURCE=2"; \
|
||
|
+ fi)
|
||
|
+
|
||
|
+STACKPROT :=
|
||
|
+
|
||
|
+all: $(multipathdir)/autoconfig.h $(TOPDIR)/config.mk
|
||
|
+
|
||
|
+$(multipathdir)/autoconfig.h:
|
||
|
+ @echo creating $@
|
||
|
+ @echo '#ifndef _AUTOCONFIG_H' >$@
|
||
|
+ @echo '#define _AUTOCONFIG_H' >>$@
|
||
|
+ @for x in $(DEFINES); do echo "#define $$x" >>$@; done
|
||
|
+ @echo '#endif' >>$@
|
||
|
+
|
||
|
+$(TOPDIR)/config.mk:
|
||
|
+ @echo creating $@
|
||
|
+ @echo "FPIN_SUPPORT := $(FPIN_SUPPORT)" >$@
|
||
|
+ @echo "FORTIFY_OPT := $(FORTIFY_OPT)" >>$@
|
||
|
+ @echo "SYSTEMD := $(SYSTEMD)" >>$@
|
||
|
+ @echo "ANA_SUPPORT := $(ANA_SUPPORT)" >>$@
|
||
|
+ @echo "STACKPROT := $(call TEST_CC_OPTION,-fstack-protector-strong,-fstack-protector)" >>$@
|
||
|
+ @echo "ERROR_DISCARDED_QUALIFIERS := $(call TEST_CC_OPTION,-Werror=discarded-qualifiers,)" >>$@
|
||
|
+ @echo "WNOCLOBBERED := $(call TEST_CC_OPTION,-Wno-clobbered -Wno-error=clobbered,)" >>$@
|
||
|
+ @echo "WFORMATOVERFLOW := $(call TEST_CC_OPTION,-Wformat-overflow=2,)" >>$@
|
||
|
+ @echo "W_MISSING_INITIALIZERS := $(call TEST_MISSING_INITIALIZERS)" >>$@
|
||
|
diff --git a/kpartx/Makefile b/kpartx/Makefile
|
||
|
index 7ceae96b..31b1138a 100644
|
||
|
--- a/kpartx/Makefile
|
||
|
+++ b/kpartx/Makefile
|
||
|
@@ -6,10 +6,6 @@ include ../Makefile.inc
|
||
|
EXEC := kpartx
|
||
|
|
||
|
CPPFLAGS += -I. -I$(multipathdir) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
|
||
|
-ifneq ($(call check_func,dm_task_set_cookie,$(devmapper_incdir)/libdevmapper.h),0)
|
||
|
- CPPFLAGS += -DLIBDM_API_COOKIE
|
||
|
-endif
|
||
|
-
|
||
|
CFLAGS += $(BIN_CFLAGS)
|
||
|
LDFLAGS += $(BIN_LDFLAGS)
|
||
|
LIBDEPS += -ldevmapper
|
||
|
diff --git a/kpartx/devmapper.c b/kpartx/devmapper.c
|
||
|
index bf14c784..f12762c5 100644
|
||
|
--- a/kpartx/devmapper.c
|
||
|
+++ b/kpartx/devmapper.c
|
||
|
@@ -9,6 +9,7 @@
|
||
|
#include <ctype.h>
|
||
|
#include <errno.h>
|
||
|
#include <sys/sysmacros.h>
|
||
|
+#include "autoconfig.h"
|
||
|
#include "devmapper.h"
|
||
|
#include "kpartx.h"
|
||
|
|
||
|
diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c
|
||
|
index 1d568c9e..46cb76ba 100644
|
||
|
--- a/kpartx/kpartx.c
|
||
|
+++ b/kpartx/kpartx.c
|
||
|
@@ -34,6 +34,7 @@
|
||
|
#include <ctype.h>
|
||
|
#include <libdevmapper.h>
|
||
|
|
||
|
+#include "autoconfig.h"
|
||
|
#include "devmapper.h"
|
||
|
#include "crc32.h"
|
||
|
#include "lopart.h"
|
||
|
diff --git a/libdmmp/test/Makefile b/libdmmp/test/Makefile
|
||
|
index 76b24d61..93de64a0 100644
|
||
|
--- a/libdmmp/test/Makefile
|
||
|
+++ b/libdmmp/test/Makefile
|
||
|
@@ -2,6 +2,7 @@
|
||
|
#
|
||
|
# Copyright (C) 2015-2016 Gris Ge <fge@redhat.com>
|
||
|
#
|
||
|
+TOPDIR := ../..
|
||
|
include ../../Makefile.inc
|
||
|
|
||
|
_libdmmpdir=../$(libdmmpdir)
|
||
|
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
|
||
|
index e24eab8a..1cc13577 100644
|
||
|
--- a/libmultipath/Makefile
|
||
|
+++ b/libmultipath/Makefile
|
||
|
@@ -9,34 +9,6 @@ CFLAGS += $(LIB_CFLAGS)
|
||
|
LIBDEPS += -lpthread -ldl -ldevmapper -ludev -L$(mpathutildir) -lmpathutil -L$(mpathcmddir) -lmpathcmd \
|
||
|
-lurcu -laio $(SYSTEMD_LIBDEPS)
|
||
|
|
||
|
-ifneq ($(call check_func,dm_task_no_flush,$(devmapper_incdir)/libdevmapper.h),0)
|
||
|
- CPPFLAGS += -DLIBDM_API_FLUSH
|
||
|
-endif
|
||
|
-
|
||
|
-ifneq ($(call check_func,dm_task_get_errno,$(devmapper_incdir)/libdevmapper.h),0)
|
||
|
- CPPFLAGS += -DLIBDM_API_GET_ERRNO
|
||
|
-endif
|
||
|
-
|
||
|
-ifneq ($(call check_func,dm_task_set_cookie,$(devmapper_incdir)/libdevmapper.h),0)
|
||
|
- CPPFLAGS += -DLIBDM_API_COOKIE
|
||
|
-endif
|
||
|
-
|
||
|
-ifneq ($(call check_func,udev_monitor_set_receive_buffer_size,$(libudev_incdir)/libudev.h),0)
|
||
|
- CPPFLAGS += -DLIBUDEV_API_RECVBUF
|
||
|
-endif
|
||
|
-
|
||
|
-ifneq ($(call check_func,dm_task_deferred_remove,$(devmapper_incdir)/libdevmapper.h),0)
|
||
|
- CPPFLAGS += -DLIBDM_API_DEFERRED
|
||
|
-endif
|
||
|
-
|
||
|
-ifneq ($(call check_func,dm_hold_control_dev,$(devmapper_incdir)/libdevmapper.h),0)
|
||
|
- CPPFLAGS += -DLIBDM_API_HOLD_CONTROL
|
||
|
-endif
|
||
|
-
|
||
|
-ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(kernel_incdir)/scsi/fc/fc_els.h),0)
|
||
|
- CPPFLAGS += -DFPIN_EVENT_HANDLER
|
||
|
-endif
|
||
|
-
|
||
|
# object files referencing MULTIPATH_DIR or CONFIG_DIR
|
||
|
# they need to be recompiled for unit tests
|
||
|
OBJS-U := prio.o checkers.o foreign.o config.o
|
||
|
@@ -97,7 +69,7 @@ uninstall:
|
||
|
$(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
|
||
|
|
||
|
clean: dep_clean
|
||
|
- $(RM) core *.a *.o *.so *.so.* *.abi nvme-ioctl.c nvme-ioctl.h $(NV_VERSION_SCRIPT)
|
||
|
+ $(RM) core *.a *.o *.so *.so.* *.abi nvme-ioctl.c nvme-ioctl.h autoconfig.h $(NV_VERSION_SCRIPT)
|
||
|
|
||
|
include $(wildcard $(OBJS:.o=.d))
|
||
|
|
||
|
diff --git a/libmultipath/devmapper.h b/libmultipath/devmapper.h
|
||
|
index 703f3bf8..42f8eccd 100644
|
||
|
--- a/libmultipath/devmapper.h
|
||
|
+++ b/libmultipath/devmapper.h
|
||
|
@@ -1,6 +1,6 @@
|
||
|
#ifndef _DEVMAPPER_H
|
||
|
#define _DEVMAPPER_H
|
||
|
-
|
||
|
+#include "autoconfig.h"
|
||
|
#include "structs.h"
|
||
|
|
||
|
#define TGT_MPATH "multipath"
|
||
|
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
|
||
|
index aa93fe43..6fc77315 100644
|
||
|
--- a/libmultipath/dict.c
|
||
|
+++ b/libmultipath/dict.c
|
||
|
@@ -24,6 +24,7 @@
|
||
|
#include <errno.h>
|
||
|
#include <inttypes.h>
|
||
|
#include <libudev.h>
|
||
|
+#include "autoconfig.h"
|
||
|
#include "mpath_cmd.h"
|
||
|
#include "dict.h"
|
||
|
#include "strbuf.h"
|
||
|
diff --git a/libmultipath/prioritizers/Makefile b/libmultipath/prioritizers/Makefile
|
||
|
index 72eefe49..a699e8a6 100644
|
||
|
--- a/libmultipath/prioritizers/Makefile
|
||
|
+++ b/libmultipath/prioritizers/Makefile
|
||
|
@@ -26,7 +26,7 @@ LIBS = \
|
||
|
libpriopath_latency.so \
|
||
|
libpriosysfs.so
|
||
|
|
||
|
-ifneq ($(call check_file,$(kernel_incdir)/linux/nvme_ioctl.h),0)
|
||
|
+ifneq ($(ANA_SUPPORT),1)
|
||
|
LIBS += libprioana.so
|
||
|
CPPFLAGS += -I../nvme
|
||
|
endif
|
||
|
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
|
||
|
index d4f19897..d1d5cc25 100644
|
||
|
--- a/libmultipath/propsel.c
|
||
|
+++ b/libmultipath/propsel.c
|
||
|
@@ -5,6 +5,7 @@
|
||
|
*/
|
||
|
#include <stdio.h>
|
||
|
|
||
|
+#include "autoconfig.h"
|
||
|
#include "nvme-lib.h"
|
||
|
#include "checkers.h"
|
||
|
#include "vector.h"
|
||
|
diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c
|
||
|
index 57447ca0..bbc8e9e5 100644
|
||
|
--- a/libmultipath/uevent.c
|
||
|
+++ b/libmultipath/uevent.c
|
||
|
@@ -42,6 +42,7 @@
|
||
|
#include <sys/time.h>
|
||
|
#include <libudev.h>
|
||
|
|
||
|
+#include "autoconfig.h"
|
||
|
#include "debug.h"
|
||
|
#include "list.h"
|
||
|
#include "uevent.h"
|
||
|
diff --git a/multipathd/Makefile b/multipathd/Makefile
|
||
|
index bb8f7770..587bb916 100644
|
||
|
--- a/multipathd/Makefile
|
||
|
+++ b/multipathd/Makefile
|
||
|
@@ -8,17 +8,6 @@ CPPFLAGS += -I$(multipathdir) -I$(mpathutildir) -I$(mpathpersistdir) -I$(mpathcm
|
||
|
awk -F. '{ printf("-DURCU_VERSION=0x%06x", 256 * ( 256 * $$1 + $$2) + $$3); }') \
|
||
|
-DBINDIR='"$(bindir)"' $(SYSTEMD_CPPFLAGS)
|
||
|
|
||
|
-ifeq ($(ENABLE_DMEVENTS_POLL),0)
|
||
|
- CPPFLAGS += -DNO_DMEVENTS_POLL
|
||
|
-endif
|
||
|
-ifneq ($(call check_func,dm_task_get_errno,$(devmapper_incdir)/libdevmapper.h),0)
|
||
|
- CPPFLAGS += -DLIBDM_API_GET_ERRNO
|
||
|
-endif
|
||
|
-ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(kernel_incdir)/scsi/fc/fc_els.h),0)
|
||
|
- CPPFLAGS += -DFPIN_EVENT_HANDLER
|
||
|
- FPIN_SUPPORT = 1
|
||
|
-endif
|
||
|
-
|
||
|
#
|
||
|
# debugging stuff
|
||
|
#
|
||
|
diff --git a/multipathd/fpin.h b/multipathd/fpin.h
|
||
|
index bfcc1ce2..3c374441 100644
|
||
|
--- a/multipathd/fpin.h
|
||
|
+++ b/multipathd/fpin.h
|
||
|
@@ -1,5 +1,6 @@
|
||
|
#ifndef __FPIN_H__
|
||
|
#define __FPIN_H__
|
||
|
+#include "autoconfig.h"
|
||
|
|
||
|
#ifdef FPIN_EVENT_HANDLER
|
||
|
void *fpin_fabric_notification_receiver(void *unused);
|
||
|
diff --git a/multipathd/main.c b/multipathd/main.c
|
||
|
index ba52d393..1e1b254f 100644
|
||
|
--- a/multipathd/main.c
|
||
|
+++ b/multipathd/main.c
|
||
|
@@ -4,6 +4,7 @@
|
||
|
* Copyright (c) 2005 Benjamin Marzinski, Redhat
|
||
|
* Copyright (c) 2005 Edward Goggin, EMC
|
||
|
*/
|
||
|
+#include "autoconfig.h"
|
||
|
#include <unistd.h>
|
||
|
#include <sys/stat.h>
|
||
|
#include <libdevmapper.h>
|
||
|
diff --git a/rules.mk b/rules.mk
|
||
|
index c1d80820..d8612527 100644
|
||
|
--- a/rules.mk
|
||
|
+++ b/rules.mk
|
||
|
@@ -13,3 +13,6 @@ $(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
|
||
|
-Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
|
||
|
|
||
|
abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)
|
||
|
+
|
||
|
+$(TOPDIR)/config.mk $(multipathdir)/autoconfig.h:
|
||
|
+ $(MAKE) -C $(TOPDIR) -f create-config.mk
|
||
|
diff --git a/tests/Makefile b/tests/Makefile
|
||
|
index 3a5b161c..d9856d17 100644
|
||
|
--- a/tests/Makefile
|
||
|
+++ b/tests/Makefile
|
||
|
@@ -3,14 +3,6 @@ include ../Makefile.inc
|
||
|
# directory where to run the tests
|
||
|
TESTDIR := $(CURDIR)
|
||
|
|
||
|
-# Test special behavior of gcc 4.8 with nested initializers
|
||
|
-# gcc 4.8 compiles blacklist.c only with -Wno-missing-field-initializers
|
||
|
-TEST_MISSING_INITIALIZERS = $(shell \
|
||
|
- echo 'struct A {int a, b;}; struct B {struct A a; int b;} b = {.a.a=1};' | \
|
||
|
- $(CC) -c -Werror -Wmissing-field-initializers -o /dev/null -xc - >/dev/null 2>&1 \
|
||
|
- || echo -Wno-missing-field-initializers)
|
||
|
-W_MISSING_INITIALIZERS := $(call TEST_MISSING_INITIALIZERS)
|
||
|
-
|
||
|
CPPFLAGS += -I$(multipathdir) -I$(mpathutildir) -I$(mpathcmddir) -I$(daemondir) \
|
||
|
-DTESTCONFDIR=\"$(TESTDIR)/conf.d\"
|
||
|
CFLAGS += $(BIN_CFLAGS) -Wno-unused-parameter $(W_MISSING_INITIALIZERS)
|