From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id E5D4E385AC2C; Mon, 7 Nov 2022 13:40:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E5D4E385AC2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667828459; bh=0MTO+JsIc4kdjMWuP5GPSCl6rS52cUGcOaCCD5E9rEE=; h=From:To:Subject:Date:From; b=f5x0UOpEU+8twEZBGpNN7oUjM/7Iab1pLhCsF1eEKiXTDh6ufoFg023Km3Xa8C339 h3iaV01MwIN33AGJdpbQD69GgZzkiEl9Mn+zPo4WumxHG3vTstNA8k1eko2WYpJB3C 1EvyVsScL2jRuxN9aJLf4/NWEzZm0elmo0qK+KAQ= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc] Rewrite find_cxx_header config configure.ac X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/master X-Git-Oldrev: d1d0162e50afe7fa1e2fc4a901eb411db48acd7b X-Git-Newrev: 596183a1eed0699be96bdcd495ab1b497370afda Message-Id: <20221107134059.E5D4E385AC2C@sourceware.org> Date: Mon, 7 Nov 2022 13:40:59 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=596183a1eed0699be96bdcd495ab1b497370afda commit 596183a1eed0699be96bdcd495ab1b497370afda Author: Adhemerval Zanella Date: Wed Nov 2 11:55:57 2022 -0300 Rewrite find_cxx_header config configure.ac With clang if the main file is , 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 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)"