diff options
author | Florian Weimer <fweimer@redhat.com> | 2016-09-21 10:45:32 +0200 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2017-06-30 09:43:16 -0700 |
commit | 6184f4153fce2e77898c9a9c0f316ac19490fd6b (patch) | |
tree | 11814122cd3d864cfd104aad7145bc478596f0fd | |
parent | 64a9f6a8acbbc0f7cd9c9532f5f16acefef15276 (diff) | |
download | glibc-6184f4153fce2e77898c9a9c0f316ac19490fd6b.tar.gz glibc-6184f4153fce2e77898c9a9c0f316ac19490fd6b.tar.xz glibc-6184f4153fce2e77898c9a9c0f316ac19490fd6b.zip |
Avoid running $(CXX) during build to obtain header file paths
This reduces the build time somewhat and is particularly noticeable during rebuilds with few code changes. (cherry picked from commit fc3e1337be1c6935ab58bd13520f97a535cf70cc)
-rw-r--r-- | Makerules | 8 | ||||
-rw-r--r-- | config.make.in | 2 | ||||
-rwxr-xr-x | configure | 14 | ||||
-rw-r--r-- | configure.ac | 12 |
4 files changed, 30 insertions, 6 deletions
diff --git a/Makerules b/Makerules index 7e4077ee50..c338850de5 100644 --- a/Makerules +++ b/Makerules @@ -121,14 +121,10 @@ ifneq (,$(CXX)) # will be used instead of /usr/include/stdlib.h and /usr/include/math.h. before-compile := $(common-objpfx)cstdlib $(common-objpfx)cmath \ $(before-compile) -cstdlib=$(shell echo "\#include <cstdlib>" | $(CXX) -M -MP -x c++ - \ - | sed -n "/cstdlib:/{s/:$$//;p}") -$(common-objpfx)cstdlib: $(cstdlib) +$(common-objpfx)cstdlib: $(c++-cstdlib-header) $(INSTALL_DATA) $< $@T $(move-if-change) $@T $@ -cmath=$(shell echo "\#include <cmath>" | $(CXX) -M -MP -x c++ - \ - | sed -n "/cmath:/{s/:$$//;p}") -$(common-objpfx)cmath: $(cmath) +$(common-objpfx)cmath: $(c++-cmath-header) $(INSTALL_DATA) $< $@T $(move-if-change) $@T $@ endif diff --git a/config.make.in b/config.make.in index 95c6f36876..04a8b3ed7f 100644 --- a/config.make.in +++ b/config.make.in @@ -45,6 +45,8 @@ defines = @DEFINES@ sysheaders = @sysheaders@ sysincludes = @SYSINCLUDES@ c++-sysincludes = @CXX_SYSINCLUDES@ +c++-cstdlib-header = @CXX_CSTDLIB_HEADER@ +c++-cmath-header = @CXX_CMATH_HEADER@ all-warnings = @all_warnings@ enable-werror = @enable_werror@ diff --git a/configure b/configure index 9b5a486048..405ff050f4 100755 --- a/configure +++ b/configure @@ -635,6 +635,8 @@ BISON INSTALL_INFO PERL BASH_SHELL +CXX_CMATH_HEADER +CXX_CSTDLIB_HEADER CXX_SYSINCLUDES SYSINCLUDES AUTOCONF @@ -5054,6 +5056,18 @@ 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 + find_cxx_header () { + echo "#include <$1>" | $CXX -M -MP -x c++ - | sed -n "/$1:/{s/:\$//;p}" + } + CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)" + CXX_CMATH_HEADER="$(find_cxx_header cmath)" +fi + + + # Test if LD_LIBRARY_PATH contains the notation for the current directory # since this would lead to problems installing/building glibc. # LD_LIBRARY_PATH contains the current directory if one of the following diff --git a/configure.ac b/configure.ac index 8277d9f727..1905e93ff4 100644 --- a/configure.ac +++ b/configure.ac @@ -1039,6 +1039,18 @@ fi AC_SUBST(SYSINCLUDES) AC_SUBST(CXX_SYSINCLUDES) +# Obtain some C++ header file paths. This is used to make a local +# copy of those headers in Makerules. +if test -n "$CXX"; then + find_cxx_header () { + echo "#include <$1>" | $CXX -M -MP -x c++ - | sed -n "/$1:/{s/:\$//;p}" + } + CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)" + CXX_CMATH_HEADER="$(find_cxx_header cmath)" +fi +AC_SUBST(CXX_CSTDLIB_HEADER) +AC_SUBST(CXX_CMATH_HEADER) + # Test if LD_LIBRARY_PATH contains the notation for the current directory # since this would lead to problems installing/building glibc. # LD_LIBRARY_PATH contains the current directory if one of the following |