@@ -5521,7 +5521,8 @@ fi
if test -n "$CXX"; then
find_cxx_header () {
echo "#include <$1>" | $CXX -M -MP -x c++ - 2>/dev/null \
- | sed -n "\,$1:,{s/:\$//;p}"
+ | awk -vp=$1 '{ for(i=1;i<=NF;i++) if(substr($i, length($i)-length(p)+1) == p) print $i }' \
+ | head -n 1
}
CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
CXX_CMATH_HEADER="$(find_cxx_header cmath)"
@@ -1115,7 +1115,8 @@ AC_SUBST(CXX_SYSINCLUDES)
if test -n "$CXX"; then
find_cxx_header () {
echo "#include <$1>" | $CXX -M -MP -x c++ - 2>/dev/null \
- | sed -n "\,$1:,{s/:\$//;p}"
+ | awk -vp=$1 '{ for(i=1;i<=NF;i++) if(substr($i, length($i)-length(p)+1) == p) print $i }' \
+ | head -n 1
}
CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
CXX_CMATH_HEADER="$(find_cxx_header cmath)"
For some reason clang does not put the main header in the descendant lists in -M -MP, so sed doesn't pick it up. Use awk to find the correct header in the depedencies lists instead. Signed-off-by: Olivier Galibert <galibert@pobox.com> --- configure | 3 ++- configure.ac | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)