From 3b1c5d9659718263c7f9c93af82f98221c58f171 Mon Sep 17 00:00:00 2001 From: Alexey Budankov Date: Mon, 18 Mar 2019 20:39:49 +0300 Subject: tools build: Implement libzstd feature check, LIBZSTD_DIR and NO_LIBZSTD defines Implement libzstd feature check, NO_LIBZSTD and LIBZSTD_DIR defines to override Zstd library sources or disable the feature from the command line: $ make -C tools/perf LIBZSTD_DIR=/path/to/zstd/sources/ clean all $ make -C tools/perf NO_LIBZSTD=1 clean all Auto detection feature status is reported just before compilation starts. If your system has some version of the zstd library preinstalled then the build system finds and uses it during the build. If you still prefer to compile with some other version of zstd library you have capability to refer the compilation to that version using LIBZSTD_DIR define. Signed-off-by: Alexey Budankov Reviewed-by: Jiri Olsa Cc: Alexander Shishkin Cc: Andi Kleen Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/9b4cd8b0-10a3-1f1e-8d6b-5922a7ca216b@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/build/Makefile.feature | 2 ++ tools/build/feature/Makefile | 6 +++++- tools/build/feature/test-all.c | 5 +++++ tools/build/feature/test-libzstd.c | 12 ++++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 tools/build/feature/test-libzstd.c (limited to 'tools/build') diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature index 8d3864b061f3..361207387b1b 100644 --- a/tools/build/Makefile.feature +++ b/tools/build/Makefile.feature @@ -67,6 +67,7 @@ FEATURE_TESTS_BASIC := \ sdt \ setns \ libaio \ + libzstd \ disassembler-four-args # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list @@ -120,6 +121,7 @@ FEATURE_DISPLAY ?= \ get_cpuid \ bpf \ libaio \ + libzstd \ disassembler-four-args # Set FEATURE_CHECK_(C|LD)FLAGS-all for all FEATURE_TESTS features. diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index 7ceb4441b627..4b8244ee65ce 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -62,7 +62,8 @@ FILES= \ test-clang.bin \ test-llvm.bin \ test-llvm-version.bin \ - test-libaio.bin + test-libaio.bin \ + test-libzstd.bin FILES := $(addprefix $(OUTPUT),$(FILES)) @@ -301,6 +302,9 @@ $(OUTPUT)test-clang.bin: $(OUTPUT)test-libaio.bin: $(BUILD) -lrt +$(OUTPUT)test-libzstd.bin: + $(BUILD) -lzstd + ############################### clean: diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c index 7853e6d91090..a59c53705093 100644 --- a/tools/build/feature/test-all.c +++ b/tools/build/feature/test-all.c @@ -182,6 +182,10 @@ # include "test-disassembler-four-args.c" #undef main +#define main main_test_zstd +# include "test-libzstd.c" +#undef main + int main(int argc, char *argv[]) { main_test_libpython(); @@ -224,6 +228,7 @@ int main(int argc, char *argv[]) main_test_libaio(); main_test_reallocarray(); main_test_disassembler_four_args(); + main_test_libzstd(); return 0; } diff --git a/tools/build/feature/test-libzstd.c b/tools/build/feature/test-libzstd.c new file mode 100644 index 000000000000..55268c01b84d --- /dev/null +++ b/tools/build/feature/test-libzstd.c @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0 +#include + +int main(void) +{ + ZSTD_CStream *cstream; + + cstream = ZSTD_createCStream(); + ZSTD_freeCStream(cstream); + + return 0; +} -- cgit