cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Alexander Aring <aahringo@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH dlm-tool 4/4] dlm_controld: use pkg-config to find corosync libs
Date: Tue, 11 Apr 2023 10:49:16 -0400	[thread overview]
Message-ID: <20230411144916.1231886-4-aahringo@redhat.com> (raw)
In-Reply-To: <20230411144916.1231886-1-aahringo@redhat.com>

Currently all corosync dependencies are hardcorded inside the
dlm_controld Makefile. We will determine those dependencies by
pkg-config. This allows us that dlm_controld can detect when the
corosync libaries are installed in a different place determined by
changing the PKG_CONFIG_PATH env variable.
---
 dlm_controld/Makefile | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/dlm_controld/Makefile b/dlm_controld/Makefile
index 44715982..2d97453a 100644
--- a/dlm_controld/Makefile
+++ b/dlm_controld/Makefile
@@ -50,7 +50,7 @@ BIN_CFLAGS += -I../include -I../libdlm
 LIB_CFLAGS += $(CFLAGS) -fPIC -fplugin=annobin
 
 BIN_LDFLAGS += $(LDFLAGS) -Wl,-z,relro -Wl,-z,now -pie
-BIN_LDFLAGS += -lpthread -lrt -lcpg -lcmap -lcfg -lquorum -luuid
+BIN_LDFLAGS += -lpthread -lrt -luuid
 LIB_LDFLAGS += $(LDFLAGS) -Wl,-z,relro -Wl,-z,now -pie
 
 PKG_CONFIG ?= pkg-config
@@ -67,12 +67,18 @@ else
 	SYSTEMD_LDFLAGS_STATUS := 0
 endif
 
-CPG_LDFLAGS := $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs "libquorum >= 3.1.0")
+CPG_CFLAGS := $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags libcpg libcmap libcfg "libquorum >= 3.1.0")
+CPG_CFLAGS_STATUS := $(.SHELLSTATUS)
+
+CPG_LDFLAGS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs libcpg libcmap libcfg "libquorum >= 3.1.0")
 CPG_LDFLAGS_STATUS := $(.SHELLSTATUS)
 
 all: $(LIB_TARGET) $(BIN_TARGET) $(LIB_PC)
 
 $(BIN_TARGET): $(BIN_SOURCE)
+ifneq ($(CPG_CFLAGS_STATUS),0)
+	$(error "Failed to call pkg-config for corosync cflags: $(CPG_CFLAGS)")
+endif
 ifneq ($(CPG_LDFLAGS_STATUS),0)
 	$(error "Failed to call pkg-config for corosync ldflags: $(CPG_LDFLAGS)")
 endif
@@ -82,7 +88,7 @@ endif
 ifneq ($(SYSTEMD_LDFLAGS_STATUS),0)
 	$(error "Failed to call pkg-config for systemd ldflags: $(SYSTEMD_LDFLAGS)")
 endif
-	$(CC) $(BIN_SOURCE) $(BIN_CFLAGS) $(SYSTEMD_CFLAGS) $(BIN_LDFLAGS) $(SYSTEMD_LDFLAGS) -o $@ -L.
+	$(CC) $(BIN_SOURCE) $(BIN_CFLAGS) $(CPG_CFLAGS) $(SYSTEMD_CFLAGS) $(BIN_LDFLAGS) $(CPG_LDFLAGS) $(SYSTEMD_LDFLAGS) -o $@ -L.
 
 $(LIB_TARGET): $(LIB_SOURCE)
 	$(CC) $^ $(LIB_CFLAGS) $(LIB_LDFLAGS) -shared -o $@ -Wl,-soname=$(LIB_SMAJOR)
-- 
2.31.1


  parent reply	other threads:[~2023-04-11 14:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-11 14:49 [Cluster-devel] [PATCH dlm-tool 1/4] fence: make pkg-config binary as passable make var Alexander Aring
2023-04-11 14:49 ` [Cluster-devel] [PATCH dlm-tool 2/4] fence: move pkg-config fail to bin target Alexander Aring
2023-04-11 14:49 ` [Cluster-devel] [PATCH dlm-tool 3/4] dlm_controld: " Alexander Aring
2023-04-11 14:49 ` Alexander Aring [this message]
2023-04-14 15:06 ` [Cluster-devel] [PATCH dlm-tool 1/4] fence: make pkg-config binary as passable make var Fabio M. Di Nitto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230411144916.1231886-4-aahringo@redhat.com \
    --to=aahringo@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).