]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Add clang version of find_cxx_header
authorStan Shebs <stanshebs@google.com>
Mon, 24 Sep 2018 22:31:31 +0000 (15:31 -0700)
committerFangrui Song <i@maskray.me>
Sat, 28 Aug 2021 00:23:12 +0000 (17:23 -0700)
configure
configure.ac

index 0c64f9669334f098ccf67af89749ec0ec41e1bc5..9591958b46656e2638b3aa11ea7170df76340d9e 100755 (executable)
--- a/configure
+++ b/configure
@@ -5365,10 +5365,19 @@ fi
 # Obtain some C++ header file paths.  This is used to make a local
 # copy of those headers in Makerules.
 if test -n "$CXX"; then
+  # In theory the clang and gcc regexes can be merged, but the
+  # result is incomprehensible.
+  if test "$with_clang" != no; then
+  find_cxx_header () {
+    echo "#include <$1>" | $CXX -M -MP -x c++ - 2>/dev/null \
+        | sed -n "\,^[o.-]*[ :] /.*/$1 [\]$,{s,^[o.-]*[ :] /,/,;s/ [\]$//;p}"
+  }
+  else
   find_cxx_header () {
     echo "#include <$1>" | $CXX -M -MP -x c++ - 2>/dev/null \
         | sed -n "\,$1:,{s/:\$//;p}"
   }
+  fi
   CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
   CXX_CMATH_HEADER="$(find_cxx_header cmath)"
   CXX_BITS_STD_ABS_H="$(find_cxx_header bits/std_abs.h)"
index 9899b3d8483845d963a240c2e0573ffcc751b219..cb6fb33ed94a004ef56e95ff978513427d3de8b7 100644 (file)
@@ -1067,15 +1067,26 @@ AC_SUBST(CXX_SYSINCLUDES)
 
 # Obtain some C++ header file paths.  This is used to make a local
 # copy of those headers in Makerules.
+changequote(,)dnl
 if test -n "$CXX"; then
+  # In theory the clang and gcc regexes can be merged, but the
+  # result is incomprehensible.
+  if test "$with_clang" != no; then
+  find_cxx_header () {
+    echo "#include <$1>" | $CXX -M -MP -x c++ - 2>/dev/null \
+        | sed -n "\,^[o.-]*[ :] /.*/$1 [\]$,{s,^[o.-]*[ :] /,/,;s/ [\]$//;p}"
+  }
+  else
   find_cxx_header () {
     echo "#include <$1>" | $CXX -M -MP -x c++ - 2>/dev/null \
         | sed -n "\,$1:,{s/:\$//;p}"
   }
+  fi
   CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
   CXX_CMATH_HEADER="$(find_cxx_header cmath)"
   CXX_BITS_STD_ABS_H="$(find_cxx_header bits/std_abs.h)"
 fi
+changequote([,])dnl
 AC_SUBST(CXX_CSTDLIB_HEADER)
 AC_SUBST(CXX_CMATH_HEADER)
 AC_SUBST(CXX_BITS_STD_ABS_H)