aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Shebs <stanshebs@google.com>2018-09-24 15:31:31 -0700
committerFangrui Song <i@maskray.me>2021-08-27 17:23:12 -0700
commitf9bd60b7c0da8e9ad74ac5e20f0c7cb5cf690183 (patch)
tree4e220c79cb3aed980997a1cbcd53d077dfdb6cb2
parent0f93e3333fbc319d1fdb838a11babd0ad9dd0d07 (diff)
downloadglibc-f9bd60b7c0da8e9ad74ac5e20f0c7cb5cf690183.zip
glibc-f9bd60b7c0da8e9ad74ac5e20f0c7cb5cf690183.tar.gz
glibc-f9bd60b7c0da8e9ad74ac5e20f0c7cb5cf690183.tar.bz2
Add clang version of find_cxx_header
-rwxr-xr-xconfigure9
-rw-r--r--configure.ac11
2 files changed, 20 insertions, 0 deletions
diff --git a/configure b/configure
index 0c64f96..9591958 100755
--- 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)"
diff --git a/configure.ac b/configure.ac
index 9899b3d..cb6fb33 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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)