0026-Fix-various-_FOR_BUILD-and-related-variables.patch 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. From cd5db101e3c4e72248f988a67ce28be8e24f66d4 Mon Sep 17 00:00:00 2001
  2. From: Khem Raj <raj.khem@gmail.com>
  3. Date: Mon, 7 Dec 2015 23:42:45 +0000
  4. Subject: [PATCH] Fix various _FOR_BUILD and related variables
  5. When doing a FOR_BUILD thing, you have to override CFLAGS with
  6. CFLAGS_FOR_BUILD. And if you use C++, you also have to override
  7. CXXFLAGS with CXXFLAGS_FOR_BUILD.
  8. Without this, when building for mingw, you end up trying to use
  9. the mingw headers for a host build.
  10. The same goes for other variables as well, such as CPPFLAGS,
  11. CPP, and GMPINC.
  12. Upstream-Status: Pending
  13. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
  14. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
  15. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  16. ---
  17. Makefile.in | 6 ++++++
  18. Makefile.tpl | 5 +++++
  19. gcc/Makefile.in | 2 +-
  20. gcc/configure | 2 +-
  21. gcc/configure.ac | 2 +-
  22. 5 files changed, 14 insertions(+), 3 deletions(-)
  23. diff --git a/Makefile.in b/Makefile.in
  24. index af19589fa95..d0116a23e1a 100644
  25. --- a/Makefile.in
  26. +++ b/Makefile.in
  27. @@ -152,6 +152,7 @@ BUILD_EXPORTS = \
  28. CPP="$(CC_FOR_BUILD) -E"; export CPP; \
  29. CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
  30. CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
  31. + CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
  32. CXX="$(CXX_FOR_BUILD)"; export CXX; \
  33. CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
  34. GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
  35. @@ -171,6 +172,9 @@ BUILD_EXPORTS = \
  36. # built for the build system to override those in BASE_FLAGS_TO_PASS.
  37. EXTRA_BUILD_FLAGS = \
  38. CFLAGS="$(CFLAGS_FOR_BUILD)" \
  39. + CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
  40. + CPP="$(CC_FOR_BUILD) -E" \
  41. + CPPFLAGS="$(CPPFLAGS_FOR_BUILD)" \
  42. LDFLAGS="$(LDFLAGS_FOR_BUILD)"
  43. # This is the list of directories to built for the host system.
  44. @@ -188,6 +192,7 @@ HOST_SUBDIR = @host_subdir@
  45. HOST_EXPORTS = \
  46. $(BASE_EXPORTS) \
  47. CC="$(CC)"; export CC; \
  48. + CPP="$(CC) -E"; export CPP; \
  49. ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
  50. CFLAGS="$(CFLAGS)"; export CFLAGS; \
  51. CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
  52. @@ -776,6 +781,7 @@ BASE_FLAGS_TO_PASS = \
  53. "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
  54. "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
  55. "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
  56. + "CXXFLAGS_FOR_BUILD=$(CXXFLAGS_FOR_BUILD)" \
  57. "EXPECT=$(EXPECT)" \
  58. "FLEX=$(FLEX)" \
  59. "INSTALL=$(INSTALL)" \
  60. diff --git a/Makefile.tpl b/Makefile.tpl
  61. index 6e0337fb48f..4fcac93d3d8 100644
  62. --- a/Makefile.tpl
  63. +++ b/Makefile.tpl
  64. @@ -154,6 +154,7 @@ BUILD_EXPORTS = \
  65. CC="$(CC_FOR_BUILD)"; export CC; \
  66. CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
  67. CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
  68. + CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
  69. CXX="$(CXX_FOR_BUILD)"; export CXX; \
  70. CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
  71. GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
  72. @@ -173,6 +174,9 @@ BUILD_EXPORTS = \
  73. # built for the build system to override those in BASE_FLAGS_TO_PASS.
  74. EXTRA_BUILD_FLAGS = \
  75. CFLAGS="$(CFLAGS_FOR_BUILD)" \
  76. + CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
  77. + CPP="$(CC_FOR_BUILD) -E" \
  78. + CPPFLAGS="$(CPPFLAGS_FOR_BUILD)" \
  79. LDFLAGS="$(LDFLAGS_FOR_BUILD)"
  80. # This is the list of directories to built for the host system.
  81. @@ -190,6 +194,7 @@ HOST_SUBDIR = @host_subdir@
  82. HOST_EXPORTS = \
  83. $(BASE_EXPORTS) \
  84. CC="$(CC)"; export CC; \
  85. + CPP="$(CC) -E"; export CPP; \
  86. ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
  87. CFLAGS="$(CFLAGS)"; export CFLAGS; \
  88. CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
  89. diff --git a/gcc/Makefile.in b/gcc/Makefile.in
  90. index 9b17d120aa1..3053d05903c 100644
  91. --- a/gcc/Makefile.in
  92. +++ b/gcc/Makefile.in
  93. @@ -820,7 +820,7 @@ BUILD_LDFLAGS=@BUILD_LDFLAGS@
  94. BUILD_NO_PIE_FLAG = @BUILD_NO_PIE_FLAG@
  95. BUILD_LDFLAGS += $(BUILD_NO_PIE_FLAG)
  96. BUILD_CPPFLAGS= -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
  97. - -I$(srcdir)/../include @INCINTL@ $(CPPINC) $(CPPFLAGS)
  98. + -I$(srcdir)/../include @INCINTL@ $(CPPINC) $(CPPFLAGS_FOR_BUILD)
  99. # Actual name to use when installing a native compiler.
  100. GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
  101. diff --git a/gcc/configure b/gcc/configure
  102. index e663052cad2..b0906aa3e96 100755
  103. --- a/gcc/configure
  104. +++ b/gcc/configure
  105. @@ -12699,7 +12699,7 @@ else
  106. CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
  107. CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
  108. LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
  109. - GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
  110. + GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \
  111. ${realsrcdir}/configure \
  112. --enable-languages=${enable_languages-all} \
  113. ${enable_obsolete+--enable-obsolete="$enable_obsolete"} \
  114. diff --git a/gcc/configure.ac b/gcc/configure.ac
  115. index 2b84875b028..bfbd8946e8a 100644
  116. --- a/gcc/configure.ac
  117. +++ b/gcc/configure.ac
  118. @@ -2023,7 +2023,7 @@ else
  119. CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
  120. CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
  121. LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
  122. - GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
  123. + GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \
  124. ${realsrcdir}/configure \
  125. --enable-languages=${enable_languages-all} \
  126. ${enable_obsolete+--enable-obsolete="$enable_obsolete"} \