From patchwork Wed Jul 10 10:38:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 93634 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C94583870C23 for ; Wed, 10 Jul 2024 10:38:20 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 34E483861828 for ; Wed, 10 Jul 2024 10:38:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 34E483861828 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 34E483861828 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720607896; cv=none; b=q1uQUkMg9oc6Z7uAlQvJyWAGw8wECPcOdsnhQNdwL+B/aItipT7KzTYXYKGJDFNir1egD5WlXE1TlOlr3P5AUMp8FoVSdra52/QvS0t+cn1PmpJ5l6TFox9zVzCyIO+4EpFkP3hIVmw0VoMWHHLVzVzH6I8XY4B1zAd3FU7HUgo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720607896; c=relaxed/simple; bh=uvSIA55bLnQlOyUR5dHVPOPVppdl+F6T1D9u7vxkaaU=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=MDNldBs4q9EowU9Zo+WrpuA7iM14hvxbzobikYRuEROz5iUnmvn7fxUxwWEIXhQUZEVipiSaJPcsbP5luK/kuwPE8YAzk1+DzfMn2bwuEvG86xSX6wSUF7am9w94Pp420/lqzMsfnbv9VmY2cOblhODvEVYphoDR7eJpQVn/+l0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0A15B106F for ; Wed, 10 Jul 2024 03:38:39 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.oss.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6F7DA3F762 for ; Wed, 10 Jul 2024 03:38:13 -0700 (PDT) From: Ross Burton To: libabigail@sourceware.org Subject: [PATCH] configure.ac: improve fts checks Date: Wed, 10 Jul 2024 11:38:05 +0100 Message-Id: <20240710103805.120680-1-ross.burton@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_NONE, SPF_NONE, 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 X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org The current code checks explicitly for musl and if so uses pkg-config to find fts-standalone. This is suboptimal because musl may not be the only libc to need a standalone fts implementation, and fts-standalone is an old gentoo-specific name[1] so libabigail won't build on any other system against musl. Instead, use AC_SEARCH_LIBS to look for fts_open in libc then libfts. Do this before the check for behaviour just in case someone has a standalone and broken implementation. I assume that the standalone fts is installed on the standard search path, which should be a fair assumption. As we're not using pkg-config anymore the required link flags are now in LIBS, so remove all instances of FTS_CFLAGS and FTS_LIBS. [1] https://gitweb.gentoo.org/repo/gentoo.git/commit/sys-libs/fts-standalone?id=a403fe6c61d1aaeecd58d521f3def2f6d3513449 Signed-off-by: Ross Burton Signed-off-by: Ross Burton Signed-off-by: Dodji Seketeli --- configure.ac | 9 ++++----- src/Makefile.am | 4 ++-- tools/Makefile.am | 2 -- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index e118a9c0..0aff2ec2 100644 --- a/configure.ac +++ b/configure.ac @@ -281,6 +281,10 @@ fi AC_SUBST(VISIBILITY_FLAGS) +# glibc and BSD include fts into their libc, but musl does not so check if we +# need to explicitly link to the standalone musl-fts. +AC_SEARCH_LIBS([fts_open], [fts]) + dnl Older glibc had a broken fts that didn't work with Large File Systems. dnl We want the version that can handler LFS, but include workaround if we dnl get a bad one. Add define to CFLAGS (not AC_DEFINE it) since we need to @@ -295,11 +299,6 @@ AS_IF([test "x$ac_cv_bad_fts" = "xyes"], [CFLAGS="$CFLAGS -DBAD_FTS=1", CXXFLAGS="$CXXFLAGS -DBAD_FTS=1"]) -dnl On musl, we need to find fts-standalone -AS_CASE( - [${host_os}], [*-musl*], [ - PKG_CHECK_MODULES([FTS], [fts-standalone]) -]) dnl Check for dependency: libelf, libdw, libebl (elfutils) dnl Note that we need to use at least elfutils 0.159 but diff --git a/src/Makefile.am b/src/Makefile.am index 3044c136..1c98bf84 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -52,12 +52,12 @@ if BTF_READER libabigail_la_SOURCES += abg-btf-reader.cc endif -libabigail_la_LIBADD = $(DEPS_LIBS) $(FTS_LIBS) +libabigail_la_LIBADD = $(DEPS_LIBS) libabigail_la_LDFLAGS = -lpthread -Wl,--as-needed -no-undefined -version-info $(LIBABIGAIL_SO_CURRENT):$(LIBABIGAIL_SO_REVISION):$(LIBABIGAIL_SO_AGE) CUSTOM_MACROS = -DABIGAIL_ROOT_SYSTEM_LIBDIR=\"${libdir}\" AM_CPPFLAGS=\ -$(CUSTOM_MACROS) $(DEPS_CPPFLAGS) $(FTS_CFLAGS) \ +$(CUSTOM_MACROS) $(DEPS_CPPFLAGS) \ -Wall -I$(abs_top_srcdir) -I$(abs_top_srcdir)/include \ -I$(abs_top_builddir)/include -I$(abs_top_builddir) diff --git a/tools/Makefile.am b/tools/Makefile.am index cbb5ce10..ea2d300c 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -41,8 +41,6 @@ abicompatdir = $(bindir) abipkgdiff_SOURCES = abipkgdiff.cc abipkgdiffdir = $(bindir) -abipkgdiff_CPPFLAGS = $(FTS_CFLAGS) -abipkgdiff_LDADD = $(FTS_LIBS) abipkgdiff_LDFLAGS = $(abs_top_builddir)/src/libabigail.la -pthread kmidiff_SOURCES = kmidiff.cc