From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [80.241.56.161]) by sourceware.org (Postfix) with ESMTPS id 9B1803857B8E for ; Mon, 7 Aug 2023 11:19:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9B1803857B8E Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=aarsen.me Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=aarsen.me Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4RKDNn0RXMz9snx; Mon, 7 Aug 2023 13:19:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aarsen.me; s=MBO0001; t=1691407161; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vJTN+PYio+DW+Cfoqjxve9gngJ/RyOVIi1zg6Wsf2w0=; b=lohaknh0aZ5mg+d089L7AE6yyEkLlDwYQqX8NKTFcFXuJp1qXgzRugJ/NuHk/SkBFOWFhc E5VlbeNeov6stqtLV8+ZoWBUftAyHBoKJkIV+lOYr/DBgGZWO2R/VvXnR0v/1NAWbB1+Cg 3ppkjXybfEHYyvOK+J5wWLvL5y7qpQwUbKkqSVQiN5mqpW6HyuE8PU9CkXtdv0b3vE2vNz /+4sOGII1qiMXCGewOniH1oFqq98k53Cn/qhYEDsIiUOqLHc0GFuKMitcmQxdfTwIsQbj6 vlNLE7U7R9r9fuUKmN2L8HszFpJAES+kG5xKOIxn6j5H08PhdUND/LmKX7mq8g== From: =?UTF-8?q?Arsen=20Arsenovi=C4=87?= To: gcc-patches@gcc.gnu.org Cc: Simon Marchi Subject: [PATCH 12/24] Pass PKG_CONFIG_PATH down from top-level Makefile Date: Mon, 7 Aug 2023 12:32:54 +0200 Message-ID: <20230807105935.2098236-13-arsen@aarsen.me> In-Reply-To: <20230807105935.2098236-1-arsen@aarsen.me> References: <20230807105935.2098236-1-arsen@aarsen.me> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4RKDNn0RXMz9snx X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_INFOUSMEBIZ,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Simon Marchi [Sending to binutils, gdb-patches and gcc-patches, since it touches the top-level Makefile/configure] I have my debuginfod library installed in a non-standard location (/opt/debuginfod), which requires me to set PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config. If I just set it during configure: $ PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config ./configure --with-debuginfod $ make or $ ./configure --with-debuginfod PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config $ make Then PKG_CONFIG_PATH is only present (and ignored) during the top-level configure. When running make (which runs gdb's and binutils' configure), PKG_CONFIG_PATH is not set, which results in their configure script not finding the library: checking for libdebuginfod >= 0.179... no configure: error: "--with-debuginfod was given, but libdebuginfod is missing or unusable." Change the top-level configure/Makefile system to capture the value passed when configuring the top-level and pass it down to subdirectories (similar to CFLAGS, LDFLAGS, etc). I don't know much about the top-level build system, so I really don't know if I did this correctly. The changes are: - Use AC_SUBST(PKG_CONFIG_PATH) in configure.ac, so that @PKG_CONFIG_PATH@ gets replaced with the actual PKG_CONFIG_PATH value in config files (i.e. Makefile) - Add a PKG_CONFIG_PATH Makefile variable in Makefile.tpl, initialized to @PKG_CONFIG_PATH@ - Add PKG_CONFIG_PATH to HOST_EXPORTS in Makefile.tpl, which are the variables set when running the sub-configures I initially added PKG_CONFIG_PATH to flags_to_pass, in Makefile.def, but I don't think it's needed. AFAIU, this defines the flags to pass down when calling "make" in subdirectories. We only need PKG_CONFIG_PATH to be passed down during configure. After that, it's captured in gdb/config.status, so even if a "make" causes a re-configure later (because gdb/configure has changed, for example), the PKG_CONFIG_PATH value will be remembered. Change-Id: I91138dfca41c43b05e53e445f62e4b27882536bf ChangeLog: * configure.ac: Add AC_SUBST(PKG_CONFIG_PATH). * configure: Re-generate. * Makefile.tpl (HOST_EXPORTS): Pass PKG_CONFIG_PATH. (PKG_CONFIG_PATH): New. * Makefile.in: Re-generate. --- Makefile.in | 3 +++ Makefile.tpl | 3 +++ configure | 2 ++ configure.ac | 1 + 4 files changed, 9 insertions(+) diff --git a/Makefile.in b/Makefile.in index f177ce176fb..214a2a15544 100644 --- a/Makefile.in +++ b/Makefile.in @@ -221,6 +221,7 @@ HOST_EXPORTS = \ OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ OTOOL="$(OTOOL)"; export OTOOL; \ + PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"; export PKG_CONFIG_PATH; \ READELF="$(READELF)"; export READELF; \ AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \ AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \ @@ -447,6 +448,8 @@ GOCFLAGS = $(CFLAGS) GDCFLAGS = @GDCFLAGS@ GM2FLAGS = $(CFLAGS) +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ + # Pass additional PGO and LTO compiler options to the PGO build. BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS) override CFLAGS += $(BUILD_CFLAGS) diff --git a/Makefile.tpl b/Makefile.tpl index 6586e907964..36fa20950d4 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -224,6 +224,7 @@ HOST_EXPORTS = \ OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ OTOOL="$(OTOOL)"; export OTOOL; \ + PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"; export PKG_CONFIG_PATH; \ READELF="$(READELF)"; export READELF; \ AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \ AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \ @@ -450,6 +451,8 @@ GOCFLAGS = $(CFLAGS) GDCFLAGS = @GDCFLAGS@ GM2FLAGS = $(CFLAGS) +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ + # Pass additional PGO and LTO compiler options to the PGO build. BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS) override CFLAGS += $(BUILD_CFLAGS) diff --git a/configure b/configure index faa1aedaa04..b6b7487f834 100755 --- a/configure +++ b/configure @@ -622,6 +622,7 @@ CXX_FOR_TARGET CC_FOR_TARGET RANLIB_PLUGIN_OPTION AR_PLUGIN_OPTION +PKG_CONFIG_PATH GDCFLAGS READELF OTOOL @@ -13017,6 +13018,7 @@ fi GDCFLAGS=${GDCFLAGS-${CFLAGS}} + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -plugin option" >&5 $as_echo_n "checking for -plugin option... " >&6; } diff --git a/configure.ac b/configure.ac index a0dff0ecac8..39e5649f360 100644 --- a/configure.ac +++ b/configure.ac @@ -3708,6 +3708,7 @@ AC_SUBST(CXXFLAGS) AC_SUBST(GDC) AC_SUBST(GDCFLAGS) GDCFLAGS=${GDCFLAGS-${CFLAGS}} +AC_SUBST(PKG_CONFIG_PATH) GCC_PLUGIN_OPTION(PLUGIN_OPTION) AR_PLUGIN_OPTION= -- 2.41.0