From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id 216D63858CDA; Mon, 26 Sep 2022 05:12:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 216D63858CDA Received: by mail-pf1-x436.google.com with SMTP id a80so5563582pfa.4; Sun, 25 Sep 2022 22:12:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=mjlTJP8p3CW/g7Qjz73iiwMRbEvfJ50soxhi89u7mMQ=; b=Fa/+e9S4Va6cZikuvt+E2IZEnz8nKfjutq+j690Mt0biNbm/a0YT74suMLq14B4CQa 3I4pIGxvqFn7JeI6GrnvSD5wMFFQKh9/ClmxinVt/k1U3kOLWH475j9ikgIzzyT8fmPh 2kD24H4Ic86I/Mj8HMi0+9ks4PFikzS6JfuVTQ+yL2OTUGhMgKhH9BnwDpGzVC1zLCYU E8YKdBZNxHntwB6T4tGYIcwqNwj424Rsc+LZ1IHoXeWIJML6zjJqx04usyaOF4XmrhYv 6uNPK0tvIlGHW/FC41DAAMLNzmtcs6nLI+Yt5eMh6RLhpe84GZ4uG6R1QtGXkBaSKDya 2NSQ== X-Gm-Message-State: ACrzQf1wlm93OR0bHfDOTNS+fPBNmnhHY3120GpeTevJaoJwDC4D4aXv YY8B0uBzu0+0gcds3PCUyYE= X-Google-Smtp-Source: AMsMyM4/m32UBtgKBaEZyH9EQWJI0LpdYDk7boGlzmyxV6//GXQ+pfMMYL5Q8eaNdmY0JbCP3YZ1Gw== X-Received: by 2002:a62:a512:0:b0:536:e2bd:e15e with SMTP id v18-20020a62a512000000b00536e2bde15emr22304706pfm.1.1664169132958; Sun, 25 Sep 2022 22:12:12 -0700 (PDT) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:2b43:3437:da34:71c1]) by smtp.gmail.com with ESMTPSA id 2-20020a620502000000b00537f16e25d3sm10914536pff.75.2022.09.25.22.12.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Sep 2022 22:12:12 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 4AD42114076E; Mon, 26 Sep 2022 14:42:09 +0930 (ACST) Date: Mon, 26 Sep 2022 14:42:09 +0930 From: Alan Modra To: Simon Marchi Cc: Fangrui Song , Jan Beulich , Nick Clifton , binutils@sourceware.org, gdb-patches@sourceware.org Subject: Re: [PATCH v3] binutils, gdb: support zstd compressed debug sections Message-ID: References: <20220923040837.550160-1-maskray@google.com> <7eadf897-9370-5a00-ae57-8e07251b8702@polymtl.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7eadf897-9370-5a00-ae57-8e07251b8702@polymtl.ca> X-Spam-Status: No, score=-3035.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2022 05:12:37 -0000 On Fri, Sep 23, 2022 at 10:32:43AM -0400, Simon Marchi wrote: > Just one question: you moved PKG_PROG_PKG_CONFIG up in ld/configure.ac, > which I think is ok. I'm going to fix this one another way. > But what about the other configure.ac files, don't > they need PKG_PROG_PKG_CONFIG too? gdb/configure.ac, for instance, uses > pkg-config for debuginfod. So if the user passes --without-debuginfod > --with-zstd, I expect things to fail, as the pkg-config will be skipped. No, that will be fine, I think The reason being that PKG_CHECK_MODULES AC_REQUIREs PKG_PROG_PKG_CONFIG. So the expansion of AC_DEBUGINFOD will emit an expansion of PKG_PROG_PKG_CONFIG if that has not already occurred, before the entire AC_DEBUGINFOD expansion. > binutils/configure.ac probably has the same problem, since it uses > PKG_CHECK_MODULES for msgpack. I'll fix this one even though it isn't a problem now because AC_DEBUGINFOD and AM_ZSTD preceed it. We should use AS_IF more often, particularly when autoconf macros are invoked. > I would suggest using PKG_PROG_PKG_CONFIG at the top of all configure.ac > that use AM_ZSTD, out of precaution. Better to avoid the need.. binutils/ * configure.ac (msgpack): Use "AS_IF" rather than "if". * configure: Regenerate. ld/ * configure.ac (jansson): Use "AS_IF" rather than "if". * configure: Regenerate. diff --git a/binutils/configure b/binutils/configure index 1c518227f57..4c0c391e9d5 100755 --- a/binutils/configure +++ b/binutils/configure @@ -13507,8 +13507,7 @@ else fi - -if test "$with_msgpack" != no; then +if test "$with_msgpack" != no; then : pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msgpack" >&5 @@ -13592,29 +13591,23 @@ fi # Put the nasty error message in config.log where it belongs echo "$MSGPACK_PKG_ERRORS" >&5 - - if test "$with_msgpack" = yes; then - as_fn_error $? "--with-msgpack was given, but msgpack is missing or unusable." "$LINENO" 5 - fi - + if test "$with_msgpack" = yes; then : + as_fn_error $? "--with-msgpack was given, but msgpack is missing or unusable." "$LINENO" 5 +fi elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - - if test "$with_msgpack" = yes; then - as_fn_error $? "--with-msgpack was given, but msgpack is missing or unusable." "$LINENO" 5 - fi - + if test "$with_msgpack" = yes; then : + as_fn_error $? "--with-msgpack was given, but msgpack is missing or unusable." "$LINENO" 5 +fi else MSGPACK_CFLAGS=$pkg_cv_MSGPACK_CFLAGS MSGPACK_LIBS=$pkg_cv_MSGPACK_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - $as_echo "#define HAVE_MSGPACK 1" >>confdefs.h - fi fi diff --git a/binutils/configure.ac b/binutils/configure.ac index ec002d3f88f..0798d84f4d1 100644 --- a/binutils/configure.ac +++ b/binutils/configure.ac @@ -278,16 +278,11 @@ AC_ARG_WITH([msgpack], [], [with_msgpack=auto]) - -if test "$with_msgpack" != no; then - PKG_CHECK_MODULES(MSGPACK, msgpack, [ - AC_DEFINE([HAVE_MSGPACK], [1], [Define to 1 if msgpack is available.]) - ], [ - if test "$with_msgpack" = yes; then - AC_MSG_ERROR([--with-msgpack was given, but msgpack is missing or unusable.]) - fi - ]) -fi +AS_IF([test "$with_msgpack" != no], + [PKG_CHECK_MODULES(MSGPACK, msgpack, + [AC_DEFINE([HAVE_MSGPACK], [1], [Define to 1 if msgpack is available.])], + [AS_IF([test "$with_msgpack" = yes], + [AC_MSG_ERROR([--with-msgpack was given, but msgpack is missing or unusable.])])])]) # target-specific stuff: diff --git a/ld/configure b/ld/configure index a1a07005400..4efe3ef5dfc 100755 --- a/ld/configure +++ b/ld/configure @@ -15585,7 +15585,6 @@ else fi -if test "x$enable_jansson" != "xno"; then @@ -15706,8 +15705,7 @@ $as_echo "no" >&6; } PKG_CONFIG="" fi fi - if test -n "$PKG_CONFIG"; then : - +if test "x$enable_jansson" != "xno"; then : pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jansson" >&5 @@ -15791,15 +15789,11 @@ fi # Put the nasty error message in config.log where it belongs echo "$JANSSON_PKG_ERRORS" >&5 - - as_fn_error $? "Cannot find jansson library" "$LINENO" 5 - + as_fn_error $? "Cannot find jansson library" "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - - as_fn_error $? "Cannot find jansson library" "$LINENO" 5 - + as_fn_error $? "Cannot find jansson library" "$LINENO" 5 else JANSSON_CFLAGS=$pkg_cv_JANSSON_CFLAGS JANSSON_LIBS=$pkg_cv_JANSSON_LIBS @@ -15814,11 +15808,6 @@ $as_echo "#define HAVE_JANSSON 1" >>confdefs.h fi -else - - as_fn_error $? "Cannot find pkg-config" "$LINENO" 5 - -fi fi diff --git a/ld/configure.ac b/ld/configure.ac index eb55904c090..8a8bfc9a14e 100644 --- a/ld/configure.ac +++ b/ld/configure.ac @@ -296,24 +296,15 @@ AC_ARG_ENABLE([jansson], [enable_jansson=$enableval], [enable_jansson="no"]) -if test "x$enable_jansson" != "xno"; then - PKG_PROG_PKG_CONFIG - AS_IF([test -n "$PKG_CONFIG"], +AS_IF([test "x$enable_jansson" != "xno"], + [PKG_CHECK_MODULES(JANSSON, [jansson], [ - PKG_CHECK_MODULES(JANSSON, [jansson], - [ - AC_DEFINE(HAVE_JANSSON, 1, [The jansson library is to be used]) - AC_SUBST([JANSSON_CFLAGS]) - AC_SUBST([JANSSON_LIBS]) - ], - [ - AC_MSG_ERROR([Cannot find jansson library]) - ]) + AC_DEFINE(HAVE_JANSSON, 1, [The jansson library is to be used]) + AC_SUBST([JANSSON_CFLAGS]) + AC_SUBST([JANSSON_LIBS]) ], - [ - AC_MSG_ERROR([Cannot find pkg-config]) - ]) -fi + [AC_MSG_ERROR([Cannot find jansson library])]) + ]) AM_BINUTILS_WARNINGS -- Alan Modra Australia Development Lab, IBM