tools: add zstd
[openwrt/staging/chunkeey.git] / tools / zstd / patches / 0001-build-issue-More-portable-header-prefix-usage-1987.patch
1 From 06a57cf57e3c4e887cadcf688e3081154f3f6db4 Mon Sep 17 00:00:00 2001
2 Message-Id: <06a57cf57e3c4e887cadcf688e3081154f3f6db4.1589392463.git.mschiffer@universe-factory.net>
3 From: Bimba Shrestha <bimbashrestha@fb.com>
4 Date: Thu, 6 Feb 2020 14:10:51 -0800
5 Subject: [PATCH] [build-issue] More portable header prefix usage (#) (#1987)
6
7 * make 4.3 build issue fix
8
9 * Changing header name and adding comment
10 ---
11 programs/Makefile | 11 +++++++----
12 1 file changed, 7 insertions(+), 4 deletions(-)
13
14 diff --git a/programs/Makefile b/programs/Makefile
15 index b75314a83f43..a9ee3cb5311b 100644
16 --- a/programs/Makefile
17 +++ b/programs/Makefile
18 @@ -94,9 +94,12 @@ endif
19
20 VOID = /dev/null
21
22 +# Make 4.3 doesn't support '\#' anymore (https://lwn.net/Articles/810071/)
23 +NUM_SYMBOL := \#
24 +
25 # thread detection
26 NO_THREAD_MSG := ==> no threads, building without multithreading support
27 -HAVE_PTHREAD := $(shell printf '\#include <pthread.h>\nint main(void) { return 0; }' > have_pthread.c && $(CC) $(FLAGS) -o have_pthread$(EXT) have_pthread.c -pthread 2> $(VOID) && rm have_pthread$(EXT) && echo 1 || echo 0; rm have_pthread.c)
28 +HAVE_PTHREAD := $(shell printf '$(NUM_SYMBOL)include <pthread.h>\nint main(void) { return 0; }' > have_pthread.c && $(CC) $(FLAGS) -o have_pthread$(EXT) have_pthread.c -pthread 2> $(VOID) && rm have_pthread$(EXT) && echo 1 || echo 0; rm have_pthread.c)
29 HAVE_THREAD := $(shell [ "$(HAVE_PTHREAD)" -eq "1" -o -n "$(filter Windows%,$(OS))" ] && echo 1 || echo 0)
30 ifeq ($(HAVE_THREAD), 1)
31 THREAD_MSG := ==> building with threading support
32 @@ -108,7 +111,7 @@ endif
33
34 # zlib detection
35 NO_ZLIB_MSG := ==> no zlib, building zstd without .gz support
36 -HAVE_ZLIB := $(shell printf '\#include <zlib.h>\nint main(void) { return 0; }' > have_zlib.c && $(CC) $(FLAGS) -o have_zlib$(EXT) have_zlib.c -lz 2> $(VOID) && rm have_zlib$(EXT) && echo 1 || echo 0; rm have_zlib.c)
37 +HAVE_ZLIB := $(shell printf '$(NUM_SYMBOL)include <zlib.h>\nint main(void) { return 0; }' > have_zlib.c && $(CC) $(FLAGS) -o have_zlib$(EXT) have_zlib.c -lz 2> $(VOID) && rm have_zlib$(EXT) && echo 1 || echo 0; rm have_zlib.c)
38 ifeq ($(HAVE_ZLIB), 1)
39 ZLIB_MSG := ==> building zstd with .gz compression support
40 ZLIBCPP = -DZSTD_GZCOMPRESS -DZSTD_GZDECOMPRESS
41 @@ -119,7 +122,7 @@ endif
42
43 # lzma detection
44 NO_LZMA_MSG := ==> no liblzma, building zstd without .xz/.lzma support
45 -HAVE_LZMA := $(shell printf '\#include <lzma.h>\nint main(void) { return 0; }' > have_lzma.c && $(CC) $(FLAGS) -o have_lzma$(EXT) have_lzma.c -llzma 2> $(VOID) && rm have_lzma$(EXT) && echo 1 || echo 0; rm have_lzma.c)
46 +HAVE_LZMA := $(shell printf '$(NUM_SYMBOL)include <lzma.h>\nint main(void) { return 0; }' > have_lzma.c && $(CC) $(FLAGS) -o have_lzma$(EXT) have_lzma.c -llzma 2> $(VOID) && rm have_lzma$(EXT) && echo 1 || echo 0; rm have_lzma.c)
47 ifeq ($(HAVE_LZMA), 1)
48 LZMA_MSG := ==> building zstd with .xz/.lzma compression support
49 LZMACPP = -DZSTD_LZMACOMPRESS -DZSTD_LZMADECOMPRESS
50 @@ -130,7 +133,7 @@ endif
51
52 # lz4 detection
53 NO_LZ4_MSG := ==> no liblz4, building zstd without .lz4 support
54 -HAVE_LZ4 := $(shell printf '\#include <lz4frame.h>\n\#include <lz4.h>\nint main(void) { return 0; }' > have_lz4.c && $(CC) $(FLAGS) -o have_lz4$(EXT) have_lz4.c -llz4 2> $(VOID) && rm have_lz4$(EXT) && echo 1 || echo 0; rm have_lz4.c)
55 +HAVE_LZ4 := $(shell printf '$(NUM_SYMBOL)include <lz4frame.h>\n\#include <lz4.h>\nint main(void) { return 0; }' > have_lz4.c && $(CC) $(FLAGS) -o have_lz4$(EXT) have_lz4.c -llz4 2> $(VOID) && rm have_lz4$(EXT) && echo 1 || echo 0; rm have_lz4.c)
56 ifeq ($(HAVE_LZ4), 1)
57 LZ4_MSG := ==> building zstd with .lz4 compression support
58 LZ4CPP = -DZSTD_LZ4COMPRESS -DZSTD_LZ4DECOMPRESS
59 --
60 2.26.2
61