prereq-build: test for static zlib availability
authorJo-Philipp Wich <jow@openwrt.org>
Wed, 16 Sep 2015 08:44:53 +0000 (08:44 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Wed, 16 Sep 2015 08:44:53 +0000 (08:44 +0000)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
SVN-Revision: 46976

include/prereq-build.mk

index 211201af3da1e0aaf85a2b3701f78c3bd0d6f499..f5fb9e270a0dc08c965abbbb2550c83c0e814801 100644 (file)
@@ -60,10 +60,16 @@ $(eval $(call TestHostCommand,ncurses, \
        echo 'int main(int argc, char **argv) { initscr(); return 0; }' | \
                gcc -include ncurses.h -x c -o $(TMP_DIR)/a.out - -lncurses))
 
+ifeq ($(HOST_OS),Linux)
+  zlib_link_flags := -Wl,-Bstatic -lz -Wl,-Bdynamic
+else
+  zlib_link_flags := -lz
+endif
+
 $(eval $(call TestHostCommand,zlib, \
-       Please install zlib. (Missing libz.so or zlib.h), \
+       Please install a static zlib. (Missing libz.a 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))
+               gcc -include zlib.h -x c -o $(TMP_DIR)/a.out - $(zlib_link_flags)))
 
 $(eval $(call TestHostCommand,libssl, \
        Please install the openssl library (with development headers), \