]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Add $(FLAGS) when testing for zlib/lzma support.
authorNick Terrell <terrelln@fb.com>
Wed, 22 Mar 2017 19:33:08 +0000 (12:33 -0700)
committerNick Terrell <terrelln@fb.com>
Wed, 22 Mar 2017 19:33:08 +0000 (12:33 -0700)
* If zlib/lzma isn't in the usual spot, it won't be used,
  even if `$CFLAGS` and `$LDFLAGS` add the location it is in.
* Update the test code snippets to not trigger any warnings.

programs/Makefile

index bb91e069af34ee0948e604a8b7a397ac68f73eae..5c3fd19e783e93cd3536f91a5fd7636399311ddc 100644 (file)
@@ -85,7 +85,7 @@ endif
 # zlib detection
 NO_ZLIB_MSG := ==> no zlib, building zstd without .gz support
 VOID = /dev/null
-HAVE_ZLIB := $(shell printf '\#include <zlib.h>\nint main(){}' | $(CC) -o have_zlib -x c - -lz 2> $(VOID) && rm have_zlib$(EXT) && echo 1 || echo 0)
+HAVE_ZLIB := $(shell printf '\#include <zlib.h>\nint main(void) { return 0; }' | $(CC) $(FLAGS) -o have_zlib -x c - -lz 2> $(VOID) && rm have_zlib$(EXT) && echo 1 || echo 0)
 ifeq ($(HAVE_ZLIB), 1)
 ZLIB_MSG := ==> building zstd with .gz compression support
 ZLIBCPP = -DZSTD_GZCOMPRESS -DZSTD_GZDECOMPRESS
@@ -95,7 +95,7 @@ ZLIB_MSG := $(NO_ZLIB_MSG)
 endif
 # lzma detection
 NO_LZMA_MSG := ==> no liblzma, building zstd without .xz/.lzma support
-HAVE_LZMA := $(shell printf '\#include <lzma.h>\nint main(){}' | $(CC) -o have_lzma -x c - -llzma 2> $(VOID) && rm have_lzma$(EXT) && echo 1 || echo 0)
+HAVE_LZMA := $(shell printf '\#include <lzma.h>\nint main(void) { return 0; }' | $(CC) $(FLAGS) -o have_lzma -x c - -llzma 2> $(VOID) && rm have_lzma$(EXT) && echo 1 || echo 0)
 ifeq ($(HAVE_LZMA), 1)
 LZMA_MSG := ==> building zstd with .xz/.lzma compression support
 LZMACPP = -DZSTD_LZMACOMPRESS -DZSTD_LZMADECOMPRESS