Hello all,

I am sending a patch that fixes building of the HAProxy in case the
system-installed opentracing c wrapper is used for the opentracing
addon.

This resolves GitHub issue #1323.

Best regards,

--
Zaga    <miros...@zagorac.name>

What can change the nature of a man?
>From 5f5bffd72bb10ec80d3fe4cd1c6ea21945c2b498 Mon Sep 17 00:00:00 2001
From: Miroslav Zagorac <mzago...@haproxy.com>
Date: Thu, 29 Jul 2021 11:10:08 +0200
Subject: [PATCH] BUILD: opentracing: fixed build when using pkg-config utility

In case the OpenTracing C Wrapper library was installed as part of the
system (ie in a directory that pkg-config considers part of the system),
HAProxy building was not possible because in that case pkg-config did
not set the value of the OT_CFLAGS variable in the addon Makefile.

This resolves GitHub issue #1323.
---
 addons/ot/Makefile | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/addons/ot/Makefile b/addons/ot/Makefile
index 9d9b1bfee..ef48ce49d 100644
--- a/addons/ot/Makefile
+++ b/addons/ot/Makefile
@@ -8,6 +8,7 @@ OT_DEFINE    =
 OT_CFLAGS    =
 OT_LDFLAGS   =
 OT_DEBUG_EXT =
+OT_PKGSTAT   =
 OTC_WRAPPER  = opentracing-c-wrapper
 
 ifneq ($(OT_DEBUG),)
@@ -16,6 +17,7 @@ OT_DEFINE    = -DDEBUG_OT
 endif
 
 ifeq ($(OT_INC),)
+OT_PKGSTAT = $(shell pkg-config --exists $(OTC_WRAPPER)$(OT_DEBUG_EXT); echo $$?)
 OT_CFLAGS = $(shell pkg-config --silence-errors --cflags $(OTC_WRAPPER)$(OT_DEBUG_EXT))
 else
 ifneq ($(wildcard $(OT_INC)/$(OTC_WRAPPER)/.*),)
@@ -23,9 +25,15 @@ OT_CFLAGS = -I$(OT_INC) $(if $(OT_DEBUG),-DOTC_DBG_MEM)
 endif
 endif
 
+ifeq ($(OT_PKGSTAT),)
 ifeq ($(OT_CFLAGS),)
 $(error OpenTracing C wrapper : can't find headers)
 endif
+else
+ifneq ($(OT_PKGSTAT),0)
+$(error OpenTracing C wrapper : can't find package)
+endif
+endif
 
 ifeq ($(OT_LIB),)
 OT_LDFLAGS = $(shell pkg-config --silence-errors --libs $(OTC_WRAPPER)$(OT_DEBUG_EXT))
-- 
2.30.1

Reply via email to