public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] Rewrite find_cxx_header config configure.ac
Date: Mon,  7 Nov 2022 13:40:59 +0000 (GMT)	[thread overview]
Message-ID: <20221107134059.E5D4E385AC2C@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=596183a1eed0699be96bdcd495ab1b497370afda

commit 596183a1eed0699be96bdcd495ab1b497370afda
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Nov 2 11:55:57 2022 -0300

    Rewrite find_cxx_header config configure.ac
    
    With clang if the main file is <stdin>, the first non-main-file
    dependency is not listed in the -MP output.  Although it was fixed
    on clang-16 [1], this change adds portability for older version.
    
    [1] https://github.com/llvm/llvm-project/commit/ff9576f74514b836e1ba0268409a2ecb919d7118
    
    Reviewed-by: Fangrui Song <maskray@google.com>

Diff:
---
 configure    | 4 ++--
 configure.ac | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index fc3d7842de..cb0996d59e 100755
--- a/configure
+++ b/configure
@@ -5669,8 +5669,8 @@ fi
 # copy of those headers in Makerules.
 if test -n "$CXX"; then
   find_cxx_header () {
-    echo "#include <$1>" | $CXX -M -MP -x c++ - 2>/dev/null \
-	 | sed -n "\,$1:,{s/:\$//;p}"
+    echo "#include <$1>" | $CXX -H -fsyntax-only -x c++ - 2>&1 \
+	 | $AWK '$1 == "."{print $2}'
   }
   CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
   CXX_CMATH_HEADER="$(find_cxx_header cmath)"
diff --git a/configure.ac b/configure.ac
index 9fc1fb1c1c..20b5e8043f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1137,8 +1137,8 @@ AC_SUBST(CXX_SYSINCLUDES)
 # copy of those headers in Makerules.
 if test -n "$CXX"; then
   find_cxx_header () {
-    echo "#include <$1>" | $CXX -M -MP -x c++ - 2>/dev/null \
-	 | sed -n "\,$1:,{s/:\$//;p}"
+    echo "#include <$1>" | $CXX -H -fsyntax-only -x c++ - 2>&1 \
+	 | $AWK '$1 == "."{print $2}'
   }
   CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
   CXX_CMATH_HEADER="$(find_cxx_header cmath)"

                 reply	other threads:[~2022-11-07 13:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20221107134059.E5D4E385AC2C@sourceware.org \
    --to=azanella@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).