diff mbox

[OpenWrt-Devel,2/3] prereq-build: use HOST* variables to test host compiler

Message ID e70bbe8a66c0728202509c90c2e8503ebdb77888.1437468019.git.larry@elder-gods.org
State Changes Requested
Delegated to: Felix Fietkau
Headers show

Commit Message

Lawrence D'Anna July 21, 2015, 8:40 a.m. UTC
We might need HOST_CPPFLAGS and HOST_LDFLAGS to find libraries.
---
 include/prereq-build.mk | 28 +++++++++-------------------
 1 file changed, 9 insertions(+), 19 deletions(-)
diff mbox

Patch

diff --git a/include/prereq-build.mk b/include/prereq-build.mk
index 53eac37..6c8cbf1 100644
--- a/include/prereq-build.mk
+++ b/include/prereq-build.mk
@@ -26,49 +26,39 @@  $(eval $(call TestHostCommand,case-sensitive-fs, \
 
 $(eval $(call SetupHostCommand,gcc, \
 	Please install the GNU C Compiler (gcc), \
-	$(CC) --version | grep gcc, \
-	gcc --version | grep gcc, \
-	gcc49 --version | grep gcc, \
-	gcc48 --version | grep gcc, \
-	gcc47 --version | grep gcc, \
-	gcc46 --version | grep gcc, \
-	gcc --version | grep Apple.LLVM ))
+	$(HOSTCC) --version | grep gcc, \
+	$(HOSTCC) --version | grep Apple.LLVM ))
 
 $(eval $(call TestHostCommand,working-gcc, \
 	Please reinstall the GNU C Compiler - it appears to be broken, \
 	echo 'int main(int argc, char **argv) { return 0; }' | \
-		gcc -x c -o $(TMP_DIR)/a.out -))
+		$(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -x c -o $(TMP_DIR)/a.out -))
 
 $(eval $(call SetupHostCommand,g++, \
 	Please install the GNU C++ Compiler (g++), \
-	$(CXX) --version | grep g++, \
-	g++ --version | grep g++, \
-	g++49 --version | grep g++, \
-	g++48 --version | grep g++, \
-	g++47 --version | grep g++, \
-	g++46 --version | grep g++, \
-	g++ --version | grep Apple.LLVM ))
+	$(HOSTCXX) --version | grep g++, \
+	$(HOSTCXX) --version | grep Apple.LLVM ))
 
 $(eval $(call TestHostCommand,working-g++, \
 	Please reinstall the GNU C++ Compiler - it appears to be broken, \
 	echo 'int main(int argc, char **argv) { return 0; }' | \
-		g++ -x c++ -o $(TMP_DIR)/a.out - -lstdc++ && \
+		$(HOSTCXX) $(HOST_CFLAGS) $(HOST_LDFLAGS) -x c++ -o $(TMP_DIR)/a.out - -lstdc++ && \
 		$(TMP_DIR)/a.out))
 
 $(eval $(call TestHostCommand,ncurses, \
 	Please install ncurses. (Missing libncurses.so or ncurses.h), \
 	echo 'int main(int argc, char **argv) { initscr(); return 0; }' | \
-		gcc -include ncurses.h -x c -o $(TMP_DIR)/a.out - -lncurses))
+		$(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -include ncurses.h -x c -o $(TMP_DIR)/a.out - -lncurses))
 
 $(eval $(call TestHostCommand,zlib, \
 	Please install zlib. (Missing libz.so or zlib.h), \
 	echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
-		gcc -include zlib.h -x c -o $(TMP_DIR)/a.out - -lz))
+		$(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -include zlib.h -x c -o $(TMP_DIR)/a.out - -lz))
 
 $(eval $(call TestHostCommand,libssl, \
 	Please install the openssl library (with development headers), \
 	echo 'int main(int argc, char **argv) { SSL_library_init(); return 0; }' | \
-		gcc -include openssl/ssl.h -x c -o $(TMP_DIR)/a.out - -lcrypto -lssl))
+		$(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -include openssl/ssl.h -x c -o $(TMP_DIR)/a.out - -lcrypto -lssl))
 
 
 $(eval $(call SetupHostCommand,tar,Please install GNU 'tar', \