diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2012-09-27 07:23:38 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-09-27 09:56:40 -0400 |
commit | 4d29089c2b70ffeb61656ffd1b9c9c52602ddd44 (patch) | |
tree | 8452e449fe38baaaba5cba636e62f343b7cde8fb /tools | |
parent | 9ec60972a38011ad8a5676f4cd5e51ac508c36b6 (diff) |
perf tools: Check libaudit availability for perf-trace builtin
The newly added trace command requires an external audit library.
However it can cause a build error because it's not checked whether the
libaudit is installed on system:
CC builtin-trace.o
builtin-trace.c:7:22: fatal error: libaudit.h: No such file or directory
compilation terminated.
make: *** [builtin-trace.o] Error 1
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1348745018-21744-1-git-send-email-namhyung@kernel.org
[ committer note: Added ", disables 'trace tool' to the feature warning msg ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/Makefile | 16 | ||||
-rw-r--r-- | tools/perf/config/feature-tests.mak | 11 | ||||
-rw-r--r-- | tools/perf/perf.c | 2 |
3 files changed, 27 insertions, 2 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 6958ba4f5dcb..e5e71e7d95a0 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -102,7 +102,7 @@ ifdef PARSER_DEBUG | |||
102 | endif | 102 | endif |
103 | 103 | ||
104 | CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS) | 104 | CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS) |
105 | EXTLIBS = -lpthread -lrt -lelf -lm -laudit | 105 | EXTLIBS = -lpthread -lrt -lelf -lm |
106 | ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE | 106 | ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE |
107 | ALL_LDFLAGS = $(LDFLAGS) | 107 | ALL_LDFLAGS = $(LDFLAGS) |
108 | STRIP ?= strip | 108 | STRIP ?= strip |
@@ -442,7 +442,6 @@ BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o | |||
442 | BUILTIN_OBJS += $(OUTPUT)builtin-lock.o | 442 | BUILTIN_OBJS += $(OUTPUT)builtin-lock.o |
443 | BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o | 443 | BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o |
444 | BUILTIN_OBJS += $(OUTPUT)builtin-test.o | 444 | BUILTIN_OBJS += $(OUTPUT)builtin-test.o |
445 | BUILTIN_OBJS += $(OUTPUT)builtin-trace.o | ||
446 | BUILTIN_OBJS += $(OUTPUT)builtin-inject.o | 445 | BUILTIN_OBJS += $(OUTPUT)builtin-inject.o |
447 | 446 | ||
448 | PERFLIBS = $(LIB_FILE) $(LIBTRACEEVENT) | 447 | PERFLIBS = $(LIB_FILE) $(LIBTRACEEVENT) |
@@ -560,6 +559,19 @@ else | |||
560 | LIB_OBJS += $(OUTPUT)util/unwind.o | 559 | LIB_OBJS += $(OUTPUT)util/unwind.o |
561 | endif | 560 | endif |
562 | 561 | ||
562 | ifdef NO_LIBAUDIT | ||
563 | BASIC_CFLAGS += -DNO_LIBAUDIT_SUPPORT | ||
564 | else | ||
565 | FLAGS_LIBAUDIT = $(ALL_CFLAGS) $(ALL_LDFLAGS) -laudit | ||
566 | ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT)),y) | ||
567 | msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev); | ||
568 | BASIC_CFLAGS += -DNO_LIBAUDIT_SUPPORT | ||
569 | else | ||
570 | BUILTIN_OBJS += $(OUTPUT)builtin-trace.o | ||
571 | EXTLIBS += -laudit | ||
572 | endif | ||
573 | endif | ||
574 | |||
563 | ifdef NO_NEWT | 575 | ifdef NO_NEWT |
564 | BASIC_CFLAGS += -DNO_NEWT_SUPPORT | 576 | BASIC_CFLAGS += -DNO_NEWT_SUPPORT |
565 | else | 577 | else |
diff --git a/tools/perf/config/feature-tests.mak b/tools/perf/config/feature-tests.mak index 116690a669d2..4add41bb0c7e 100644 --- a/tools/perf/config/feature-tests.mak +++ b/tools/perf/config/feature-tests.mak | |||
@@ -193,3 +193,14 @@ int main(void) | |||
193 | } | 193 | } |
194 | endef | 194 | endef |
195 | endif | 195 | endif |
196 | |||
197 | ifndef NO_LIBAUDIT | ||
198 | define SOURCE_LIBAUDIT | ||
199 | #include <libaudit.h> | ||
200 | |||
201 | int main(void) | ||
202 | { | ||
203 | return audit_open(); | ||
204 | } | ||
205 | endef | ||
206 | endif \ No newline at end of file | ||
diff --git a/tools/perf/perf.c b/tools/perf/perf.c index 3fb052c9a27f..fc2f770e3027 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c | |||
@@ -55,7 +55,9 @@ static struct cmd_struct commands[] = { | |||
55 | { "lock", cmd_lock, 0 }, | 55 | { "lock", cmd_lock, 0 }, |
56 | { "kvm", cmd_kvm, 0 }, | 56 | { "kvm", cmd_kvm, 0 }, |
57 | { "test", cmd_test, 0 }, | 57 | { "test", cmd_test, 0 }, |
58 | #ifndef NO_LIBAUDIT_SUPPORT | ||
58 | { "trace", cmd_trace, 0 }, | 59 | { "trace", cmd_trace, 0 }, |
60 | #endif | ||
59 | { "inject", cmd_inject, 0 }, | 61 | { "inject", cmd_inject, 0 }, |
60 | }; | 62 | }; |
61 | 63 | ||