Skip to content

Commit

Permalink
tools build: Add feature check for lzma library
Browse files Browse the repository at this point in the history
Will be used to decompress 'xz' objects. The check detects
the liblzma.so devel library normally delivered by xz package.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
  • Loading branch information
Jiri Olsa authored and Arnaldo Carvalho de Melo committed Mar 21, 2015
1 parent 00ae112 commit 6c6f0f6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
6 changes: 4 additions & 2 deletions tools/build/Makefile.feature
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ FEATURE_TESTS = \
stackprotector-all \
timerfd \
libdw-dwarf-unwind \
zlib
zlib \
lzma

FEATURE_DISPLAY = \
dwarf \
Expand All @@ -65,7 +66,8 @@ FEATURE_DISPLAY = \
libslang \
libunwind \
libdw-dwarf-unwind \
zlib
zlib \
lzma

# Set FEATURE_CHECK_(C|LD)FLAGS-all for all FEATURE_TESTS features.
# If in the future we need per-feature checks/flags for features not
Expand Down
8 changes: 6 additions & 2 deletions tools/build/feature/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ FILES= \
test-libbabeltrace.bin \
test-compile-32.bin \
test-compile-x32.bin \
test-zlib.bin
test-zlib.bin \
test-lzma.bin

CC := $(CROSS_COMPILE)gcc -MD
PKG_CONFIG := $(CROSS_COMPILE)pkg-config
Expand All @@ -45,7 +46,7 @@ __BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@)
###############################

test-all.bin:
$(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -laudit -I/usr/include/slang -lslang $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz
$(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -laudit -I/usr/include/slang -lslang $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -llzma

test-hello.bin:
$(BUILD)
Expand Down Expand Up @@ -152,6 +153,9 @@ test-compile-x32.bin:
test-zlib.bin:
$(BUILD) -lz

test-lzma.bin:
$(BUILD) -llzma

-include *.d

###############################
Expand Down
5 changes: 5 additions & 0 deletions tools/build/feature/test-all.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@
#undef main
#endif

#define main main_test_lzma
# include "test-lzma.c"
#undef main

int main(int argc, char *argv[])
{
main_test_libpython();
Expand All @@ -138,6 +142,7 @@ int main(int argc, char *argv[])
main_test_sync_compare_and_swap(argc, argv);
main_test_zlib();
main_test_pthread_attr_setaffinity_np();
main_test_lzma();

return 0;
}
10 changes: 10 additions & 0 deletions tools/build/feature/test-lzma.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <lzma.h>

int main(void)
{
lzma_stream strm = LZMA_STREAM_INIT;
int ret;

ret = lzma_stream_decoder(&strm, UINT64_MAX, LZMA_CONCATENATED);
return ret ? -1 : 0;
}

0 comments on commit 6c6f0f6

Please sign in to comment.