Commit 89fe808a authored by Ingo Molnar's avatar Ingo Molnar

tools/perf: Standardize feature support define names to: HAVE_{FEATURE}_SUPPORT

Standardize all the feature flags based on the HAVE_{FEATURE}_SUPPORT naming convention:

		HAVE_ARCH_X86_64_SUPPORT
		HAVE_BACKTRACE_SUPPORT
		HAVE_CPLUS_DEMANGLE_SUPPORT
		HAVE_DWARF_SUPPORT
		HAVE_ELF_GETPHDRNUM_SUPPORT
		HAVE_GTK2_SUPPORT
		HAVE_GTK_INFO_BAR_SUPPORT
		HAVE_LIBAUDIT_SUPPORT
		HAVE_LIBELF_MMAP_SUPPORT
		HAVE_LIBELF_SUPPORT
		HAVE_LIBNUMA_SUPPORT
		HAVE_LIBUNWIND_SUPPORT
		HAVE_ON_EXIT_SUPPORT
		HAVE_PERF_REGS_SUPPORT
		HAVE_SLANG_SUPPORT
		HAVE_STRLCPY_SUPPORT

Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/n/tip-u3zvqejddfZhtrbYbfhi3spa@git.kernel.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 429eb051
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include "../../util/types.h" #include "../../util/types.h"
#include <asm/perf_regs.h> #include <asm/perf_regs.h>
#ifndef ARCH_X86_64 #ifndef HAVE_ARCH_X86_64_SUPPORT
#define PERF_REGS_MASK ((1ULL << PERF_REG_X86_32_MAX) - 1) #define PERF_REGS_MASK ((1ULL << PERF_REG_X86_32_MAX) - 1)
#else #else
#define REG_NOSUPPORT ((1ULL << PERF_REG_X86_DS) | \ #define REG_NOSUPPORT ((1ULL << PERF_REG_X86_DS) | \
...@@ -52,7 +52,7 @@ static inline const char *perf_reg_name(int id) ...@@ -52,7 +52,7 @@ static inline const char *perf_reg_name(int id)
return "FS"; return "FS";
case PERF_REG_X86_GS: case PERF_REG_X86_GS:
return "GS"; return "GS";
#ifdef ARCH_X86_64 #ifdef HAVE_ARCH_X86_64_SUPPORT
case PERF_REG_X86_R8: case PERF_REG_X86_R8:
return "R8"; return "R8";
case PERF_REG_X86_R9: case PERF_REG_X86_R9:
...@@ -69,7 +69,7 @@ static inline const char *perf_reg_name(int id) ...@@ -69,7 +69,7 @@ static inline const char *perf_reg_name(int id)
return "R14"; return "R14";
case PERF_REG_X86_R15: case PERF_REG_X86_R15:
return "R15"; return "R15";
#endif /* ARCH_X86_64 */ #endif /* HAVE_ARCH_X86_64_SUPPORT */
default: default:
return NULL; return NULL;
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "perf_regs.h" #include "perf_regs.h"
#include "../../util/unwind.h" #include "../../util/unwind.h"
#ifdef ARCH_X86_64 #ifdef HAVE_ARCH_X86_64_SUPPORT
int unwind__arch_reg_id(int regnum) int unwind__arch_reg_id(int regnum)
{ {
int id; int id;
...@@ -108,4 +108,4 @@ int unwind__arch_reg_id(int regnum) ...@@ -108,4 +108,4 @@ int unwind__arch_reg_id(int regnum)
return id; return id;
} }
#endif /* ARCH_X86_64 */ #endif /* HAVE_ARCH_X86_64_SUPPORT */
#ifdef ARCH_X86_64 #ifdef HAVE_ARCH_X86_64_SUPPORT
#define MEMCPY_FN(fn, name, desc) \ #define MEMCPY_FN(fn, name, desc) \
extern void *fn(void *, const void *, size_t); extern void *fn(void *, const void *, size_t);
......
...@@ -58,7 +58,7 @@ struct routine routines[] = { ...@@ -58,7 +58,7 @@ struct routine routines[] = {
{ "default", { "default",
"Default memcpy() provided by glibc", "Default memcpy() provided by glibc",
memcpy }, memcpy },
#ifdef ARCH_X86_64 #ifdef HAVE_ARCH_X86_64_SUPPORT
#define MEMCPY_FN(fn, name, desc) { name, desc, fn }, #define MEMCPY_FN(fn, name, desc) { name, desc, fn },
#include "mem-memcpy-x86-64-asm-def.h" #include "mem-memcpy-x86-64-asm-def.h"
......
#ifdef ARCH_X86_64 #ifdef HAVE_ARCH_X86_64_SUPPORT
#define MEMSET_FN(fn, name, desc) \ #define MEMSET_FN(fn, name, desc) \
extern void *fn(void *, int, size_t); extern void *fn(void *, int, size_t);
......
...@@ -58,7 +58,7 @@ static const struct routine routines[] = { ...@@ -58,7 +58,7 @@ static const struct routine routines[] = {
{ "default", { "default",
"Default memset() provided by glibc", "Default memset() provided by glibc",
memset }, memset },
#ifdef ARCH_X86_64 #ifdef HAVE_ARCH_X86_64_SUPPORT
#define MEMSET_FN(fn, name, desc) { name, desc, fn }, #define MEMSET_FN(fn, name, desc) { name, desc, fn },
#include "mem-memset-x86-64-asm-def.h" #include "mem-memset-x86-64-asm-def.h"
......
...@@ -35,7 +35,7 @@ struct bench_suite { ...@@ -35,7 +35,7 @@ struct bench_suite {
/* sentinel: easy for help */ /* sentinel: easy for help */
#define suite_all { "all", "Test all benchmark suites", NULL } #define suite_all { "all", "Test all benchmark suites", NULL }
#ifdef LIBNUMA_SUPPORT #ifdef HAVE_LIBNUMA_SUPPORT
static struct bench_suite numa_suites[] = { static struct bench_suite numa_suites[] = {
{ "mem", { "mem",
"Benchmark for NUMA workloads", "Benchmark for NUMA workloads",
...@@ -80,7 +80,7 @@ struct bench_subsys { ...@@ -80,7 +80,7 @@ struct bench_subsys {
}; };
static struct bench_subsys subsystems[] = { static struct bench_subsys subsystems[] = {
#ifdef LIBNUMA_SUPPORT #ifdef HAVE_LIBNUMA_SUPPORT
{ "numa", { "numa",
"NUMA scheduling and MM behavior", "NUMA scheduling and MM behavior",
numa_suites }, numa_suites },
......
...@@ -231,7 +231,7 @@ static int perf_event__inject_buildid(struct perf_tool *tool, ...@@ -231,7 +231,7 @@ static int perf_event__inject_buildid(struct perf_tool *tool,
* account this as unresolved. * account this as unresolved.
*/ */
} else { } else {
#ifdef LIBELF_SUPPORT #ifdef HAVE_LIBELF_SUPPORT
pr_warning("no symbols found in %s, maybe " pr_warning("no symbols found in %s, maybe "
"install a debug package?\n", "install a debug package?\n",
al.map->dso->long_name); al.map->dso->long_name);
......
...@@ -173,7 +173,7 @@ static int opt_set_target(const struct option *opt, const char *str, ...@@ -173,7 +173,7 @@ static int opt_set_target(const struct option *opt, const char *str,
if (str && !params.target) { if (str && !params.target) {
if (!strcmp(opt->long_name, "exec")) if (!strcmp(opt->long_name, "exec"))
params.uprobes = true; params.uprobes = true;
#ifdef DWARF_SUPPORT #ifdef HAVE_DWARF_SUPPORT
else if (!strcmp(opt->long_name, "module")) else if (!strcmp(opt->long_name, "module"))
params.uprobes = false; params.uprobes = false;
#endif #endif
...@@ -187,7 +187,7 @@ static int opt_set_target(const struct option *opt, const char *str, ...@@ -187,7 +187,7 @@ static int opt_set_target(const struct option *opt, const char *str,
return ret; return ret;
} }
#ifdef DWARF_SUPPORT #ifdef HAVE_DWARF_SUPPORT
static int opt_show_lines(const struct option *opt __maybe_unused, static int opt_show_lines(const struct option *opt __maybe_unused,
const char *str, int unset __maybe_unused) const char *str, int unset __maybe_unused)
{ {
...@@ -257,7 +257,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -257,7 +257,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
"perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]", "perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]",
"perf probe [<options>] --del '[GROUP:]EVENT' ...", "perf probe [<options>] --del '[GROUP:]EVENT' ...",
"perf probe --list", "perf probe --list",
#ifdef DWARF_SUPPORT #ifdef HAVE_DWARF_SUPPORT
"perf probe [<options>] --line 'LINEDESC'", "perf probe [<options>] --line 'LINEDESC'",
"perf probe [<options>] --vars 'PROBEPOINT'", "perf probe [<options>] --vars 'PROBEPOINT'",
#endif #endif
...@@ -271,7 +271,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -271,7 +271,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_CALLBACK('d', "del", NULL, "[GROUP:]EVENT", "delete a probe event.", OPT_CALLBACK('d', "del", NULL, "[GROUP:]EVENT", "delete a probe event.",
opt_del_probe_event), opt_del_probe_event),
OPT_CALLBACK('a', "add", NULL, OPT_CALLBACK('a', "add", NULL,
#ifdef DWARF_SUPPORT #ifdef HAVE_DWARF_SUPPORT
"[EVENT=]FUNC[@SRC][+OFF|%return|:RL|;PT]|SRC:AL|SRC;PT" "[EVENT=]FUNC[@SRC][+OFF|%return|:RL|;PT]|SRC:AL|SRC;PT"
" [[NAME=]ARG ...]", " [[NAME=]ARG ...]",
#else #else
...@@ -283,7 +283,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -283,7 +283,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
"\t\tFUNC:\tFunction name\n" "\t\tFUNC:\tFunction name\n"
"\t\tOFF:\tOffset from function entry (in byte)\n" "\t\tOFF:\tOffset from function entry (in byte)\n"
"\t\t%return:\tPut the probe at function return\n" "\t\t%return:\tPut the probe at function return\n"
#ifdef DWARF_SUPPORT #ifdef HAVE_DWARF_SUPPORT
"\t\tSRC:\tSource code path\n" "\t\tSRC:\tSource code path\n"
"\t\tRL:\tRelative line number from function entry.\n" "\t\tRL:\tRelative line number from function entry.\n"
"\t\tAL:\tAbsolute line number in file.\n" "\t\tAL:\tAbsolute line number in file.\n"
...@@ -296,7 +296,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -296,7 +296,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
opt_add_probe_event), opt_add_probe_event),
OPT_BOOLEAN('f', "force", &params.force_add, "forcibly add events" OPT_BOOLEAN('f', "force", &params.force_add, "forcibly add events"
" with existing name"), " with existing name"),
#ifdef DWARF_SUPPORT #ifdef HAVE_DWARF_SUPPORT
OPT_CALLBACK('L', "line", NULL, OPT_CALLBACK('L', "line", NULL,
"FUNC[:RLN[+NUM|-RLN2]]|SRC:ALN[+NUM|-ALN2]", "FUNC[:RLN[+NUM|-RLN2]]|SRC:ALN[+NUM|-ALN2]",
"Show source code lines.", opt_show_lines), "Show source code lines.", opt_show_lines),
...@@ -408,7 +408,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -408,7 +408,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
return ret; return ret;
} }
#ifdef DWARF_SUPPORT #ifdef HAVE_DWARF_SUPPORT
if (params.show_lines && !params.uprobes) { if (params.show_lines && !params.uprobes) {
if (params.mod_events) { if (params.mod_events) {
pr_err(" Error: Don't use --line with" pr_err(" Error: Don't use --line with"
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include <sched.h> #include <sched.h>
#include <sys/mman.h> #include <sys/mman.h>
#ifndef HAVE_ON_EXIT #ifndef HAVE_ON_EXIT_SUPPORT
#ifndef ATEXIT_MAX #ifndef ATEXIT_MAX
#define ATEXIT_MAX 32 #define ATEXIT_MAX 32
#endif #endif
...@@ -687,7 +687,7 @@ parse_branch_stack(const struct option *opt, const char *str, int unset) ...@@ -687,7 +687,7 @@ parse_branch_stack(const struct option *opt, const char *str, int unset)
return ret; return ret;
} }
#ifdef LIBUNWIND_SUPPORT #ifdef HAVE_LIBUNWIND_SUPPORT
static int get_stack_size(char *str, unsigned long *_size) static int get_stack_size(char *str, unsigned long *_size)
{ {
char *endptr; char *endptr;
...@@ -713,7 +713,7 @@ static int get_stack_size(char *str, unsigned long *_size) ...@@ -713,7 +713,7 @@ static int get_stack_size(char *str, unsigned long *_size)
max_size, str); max_size, str);
return -1; return -1;
} }
#endif /* LIBUNWIND_SUPPORT */ #endif /* HAVE_LIBUNWIND_SUPPORT */
int record_parse_callchain_opt(const struct option *opt, int record_parse_callchain_opt(const struct option *opt,
const char *arg, int unset) const char *arg, int unset)
...@@ -751,7 +751,7 @@ int record_parse_callchain_opt(const struct option *opt, ...@@ -751,7 +751,7 @@ int record_parse_callchain_opt(const struct option *opt,
"needed for -g fp\n"); "needed for -g fp\n");
break; break;
#ifdef LIBUNWIND_SUPPORT #ifdef HAVE_LIBUNWIND_SUPPORT
/* Dwarf style */ /* Dwarf style */
} else if (!strncmp(name, "dwarf", sizeof("dwarf"))) { } else if (!strncmp(name, "dwarf", sizeof("dwarf"))) {
const unsigned long default_stack_dump_size = 8192; const unsigned long default_stack_dump_size = 8192;
...@@ -771,7 +771,7 @@ int record_parse_callchain_opt(const struct option *opt, ...@@ -771,7 +771,7 @@ int record_parse_callchain_opt(const struct option *opt,
if (!ret) if (!ret)
pr_debug("callchain: stack dump size %d\n", pr_debug("callchain: stack dump size %d\n",
opts->stack_dump_size); opts->stack_dump_size);
#endif /* LIBUNWIND_SUPPORT */ #endif /* HAVE_LIBUNWIND_SUPPORT */
} else { } else {
pr_err("callchain: Unknown -g option " pr_err("callchain: Unknown -g option "
"value: %s\n", arg); "value: %s\n", arg);
...@@ -818,7 +818,7 @@ static struct perf_record record = { ...@@ -818,7 +818,7 @@ static struct perf_record record = {
#define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: " #define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: "
#ifdef LIBUNWIND_SUPPORT #ifdef HAVE_LIBUNWIND_SUPPORT
const char record_callchain_help[] = CALLCHAIN_HELP "[fp] dwarf"; const char record_callchain_help[] = CALLCHAIN_HELP "[fp] dwarf";
#else #else
const char record_callchain_help[] = CALLCHAIN_HELP "[fp]"; const char record_callchain_help[] = CALLCHAIN_HELP "[fp]";
......
...@@ -23,7 +23,7 @@ ifeq ($(ARCH),x86_64) ...@@ -23,7 +23,7 @@ ifeq ($(ARCH),x86_64)
endif endif
ifeq (${IS_X86_64}, 1) ifeq (${IS_X86_64}, 1)
RAW_ARCH := x86_64 RAW_ARCH := x86_64
CFLAGS += -DARCH_X86_64 CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT
ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
endif endif
NO_PERF_REGS := 0 NO_PERF_REGS := 0
...@@ -31,7 +31,7 @@ ifeq ($(ARCH),x86_64) ...@@ -31,7 +31,7 @@ ifeq ($(ARCH),x86_64)
endif endif
ifeq ($(NO_PERF_REGS),0) ifeq ($(NO_PERF_REGS),0)
CFLAGS += -DHAVE_PERF_REGS CFLAGS += -DHAVE_PERF_REGS_SUPPORT
endif endif
ifeq ($(src-perf),) ifeq ($(src-perf),)
...@@ -175,13 +175,13 @@ endif # SOURCE_LIBELF ...@@ -175,13 +175,13 @@ endif # SOURCE_LIBELF
endif # NO_LIBELF endif # NO_LIBELF
ifndef NO_LIBELF ifndef NO_LIBELF
CFLAGS += -DLIBELF_SUPPORT CFLAGS += -DHAVE_LIBELF_SUPPORT
FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS)
ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y) ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DHAVE_LIBELF_MMAP_SUPPORT),y)
CFLAGS += -DLIBELF_MMAP CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT
endif endif
ifeq ($(call try-cc,$(SOURCE_ELF_GETPHDRNUM),$(FLAGS_LIBELF),-DHAVE_ELF_GETPHDRNUM),y) ifeq ($(call try-cc,$(SOURCE_ELF_GETPHDRNUM),$(FLAGS_LIBELF),-DHAVE_ELF_GETPHDRNUM_SUPPORT),y)
CFLAGS += -DHAVE_ELF_GETPHDRNUM CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT
endif endif
# include ARCH specific config # include ARCH specific config
...@@ -192,7 +192,7 @@ ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) ...@@ -192,7 +192,7 @@ ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled); msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
NO_DWARF := 1 NO_DWARF := 1
else else
CFLAGS += -DDWARF_SUPPORT $(LIBDW_CFLAGS) CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
LDFLAGS += $(LIBDW_LDFLAGS) LDFLAGS += $(LIBDW_LDFLAGS)
EXTLIBS += -lelf -ldw EXTLIBS += -lelf -ldw
endif # PERF_HAVE_DWARF_REGS endif # PERF_HAVE_DWARF_REGS
...@@ -201,10 +201,10 @@ endif # NO_DWARF ...@@ -201,10 +201,10 @@ endif # NO_DWARF
endif # NO_LIBELF endif # NO_LIBELF
ifndef NO_LIBELF ifndef NO_LIBELF
CFLAGS += -DLIBELF_SUPPORT CFLAGS += -DHAVE_LIBELF_SUPPORT
FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS)
ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y) ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DHAVE_LIBELF_MMAP_SUPPORT),y)
CFLAGS += -DLIBELF_MMAP CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT
endif # try-cc endif # try-cc
endif # NO_LIBELF endif # NO_LIBELF
...@@ -229,7 +229,7 @@ endif # Libunwind support ...@@ -229,7 +229,7 @@ endif # Libunwind support
endif # NO_LIBUNWIND endif # NO_LIBUNWIND
ifndef NO_LIBUNWIND ifndef NO_LIBUNWIND
CFLAGS += -DLIBUNWIND_SUPPORT CFLAGS += -DHAVE_LIBUNWIND_SUPPORT
EXTLIBS += $(LIBUNWIND_LIBS) EXTLIBS += $(LIBUNWIND_LIBS)
CFLAGS += $(LIBUNWIND_CFLAGS) CFLAGS += $(LIBUNWIND_CFLAGS)
LDFLAGS += $(LIBUNWIND_LDFLAGS) LDFLAGS += $(LIBUNWIND_LDFLAGS)
...@@ -241,7 +241,7 @@ ifndef NO_LIBAUDIT ...@@ -241,7 +241,7 @@ ifndef NO_LIBAUDIT
msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev); msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
NO_LIBAUDIT := 1 NO_LIBAUDIT := 1
else else
CFLAGS += -DLIBAUDIT_SUPPORT CFLAGS += -DHAVE_LIBAUDIT_SUPPORT
EXTLIBS += -laudit EXTLIBS += -laudit
endif endif
endif endif
...@@ -258,7 +258,7 @@ ifndef NO_SLANG ...@@ -258,7 +258,7 @@ ifndef NO_SLANG
else else
# Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
CFLAGS += -I/usr/include/slang CFLAGS += -I/usr/include/slang
CFLAGS += -DSLANG_SUPPORT CFLAGS += -DHAVE_SLANG_SUPPORT
EXTLIBS += -lslang EXTLIBS += -lslang
endif endif
endif endif
...@@ -269,10 +269,10 @@ ifndef NO_GTK2 ...@@ -269,10 +269,10 @@ ifndef NO_GTK2
msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
NO_GTK2 := 1 NO_GTK2 := 1
else else
ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2),-DHAVE_GTK_INFO_BAR),y) ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2),-DHAVE_GTK_INFO_BAR_SUPPORT),y)
CFLAGS += -DHAVE_GTK_INFO_BAR CFLAGS += -DHAVE_GTK_INFO_BAR_SUPPORT
endif endif
CFLAGS += -DGTK2_SUPPORT CFLAGS += -DHAVE_GTK2_SUPPORT
CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null) CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null)
EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null) EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null)
endif endif
...@@ -365,9 +365,9 @@ endif ...@@ -365,9 +365,9 @@ endif
ifdef NO_DEMANGLE ifdef NO_DEMANGLE
CFLAGS += -DNO_DEMANGLE CFLAGS += -DNO_DEMANGLE
else else
ifdef HAVE_CPLUS_DEMANGLE ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
EXTLIBS += -liberty EXTLIBS += -liberty
CFLAGS += -DHAVE_CPLUS_DEMANGLE CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
else else
FLAGS_BFD=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd FLAGS_BFD=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd
has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd) has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd)
...@@ -388,7 +388,7 @@ else ...@@ -388,7 +388,7 @@ else
has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE),demangle) has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE),demangle)
ifeq ($(has_cplus_demangle),y) ifeq ($(has_cplus_demangle),y)
EXTLIBS += -liberty EXTLIBS += -liberty
CFLAGS += -DHAVE_CPLUS_DEMANGLE CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
else else
msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling) msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling)
CFLAGS += -DNO_DEMANGLE CFLAGS += -DNO_DEMANGLE
...@@ -400,20 +400,20 @@ else ...@@ -400,20 +400,20 @@ else
endif endif
ifndef NO_STRLCPY ifndef NO_STRLCPY
ifeq ($(call try-cc,$(SOURCE_STRLCPY),,-DHAVE_STRLCPY),y) ifeq ($(call try-cc,$(SOURCE_STRLCPY),,-DHAVE_STRLCPY_SUPPORT),y)
CFLAGS += -DHAVE_STRLCPY CFLAGS += -DHAVE_STRLCPY_SUPPORT
endif endif
endif endif
ifndef NO_ON_EXIT ifndef NO_ON_EXIT
ifeq ($(call try-cc,$(SOURCE_ON_EXIT),,-DHAVE_ON_EXIT),y) ifeq ($(call try-cc,$(SOURCE_ON_EXIT),,-DHAVE_ON_EXIT_SUPPORT),y)
CFLAGS += -DHAVE_ON_EXIT CFLAGS += -DHAVE_ON_EXIT_SUPPORT
endif endif
endif endif
ifndef NO_BACKTRACE ifndef NO_BACKTRACE
ifeq ($(call try-cc,$(SOURCE_BACKTRACE),,-DBACKTRACE_SUPPORT),y) ifeq ($(call try-cc,$(SOURCE_BACKTRACE),,-DHAVE_BACKTRACE_SUPPORT),y)
CFLAGS += -DBACKTRACE_SUPPORT CFLAGS += -DHAVE_BACKTRACE_SUPPORT
endif endif
endif endif
...@@ -423,7 +423,7 @@ ifndef NO_LIBNUMA ...@@ -423,7 +423,7 @@ ifndef NO_LIBNUMA
msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev); msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev);
NO_LIBNUMA := 1 NO_LIBNUMA := 1
else else
CFLAGS += -DLIBNUMA_SUPPORT CFLAGS += -DHAVE_LIBNUMA_SUPPORT
EXTLIBS += -lnuma EXTLIBS += -lnuma
endif endif
endif endif
......
...@@ -49,14 +49,14 @@ static struct cmd_struct commands[] = { ...@@ -49,14 +49,14 @@ static struct cmd_struct commands[] = {
{ "version", cmd_version, 0 }, { "version", cmd_version, 0 },
{ "script", cmd_script, 0 }, { "script", cmd_script, 0 },
{ "sched", cmd_sched, 0 }, { "sched", cmd_sched, 0 },
#ifdef LIBELF_SUPPORT #ifdef HAVE_LIBELF_SUPPORT
{ "probe", cmd_probe, 0 }, { "probe", cmd_probe, 0 },
#endif #endif
{ "kmem", cmd_kmem, 0 }, { "kmem", cmd_kmem, 0 },
{ "lock", cmd_lock, 0 }, { "lock", cmd_lock, 0 },
{ "kvm", cmd_kvm, 0 }, { "kvm", cmd_kvm, 0 },
{ "test", cmd_test, 0 }, { "test", cmd_test, 0 },
#ifdef LIBAUDIT_SUPPORT #ifdef HAVE_LIBAUDIT_SUPPORT
{ "trace", cmd_trace, 0 }, { "trace", cmd_trace, 0 },
#endif #endif
{ "inject", cmd_inject, 0 }, { "inject", cmd_inject, 0 },
......
...@@ -43,7 +43,7 @@ const char *perf_gtk__get_percent_color(double percent) ...@@ -43,7 +43,7 @@ const char *perf_gtk__get_percent_color(double percent)
return NULL; return NULL;
} }
#ifdef HAVE_GTK_INFO_BAR #ifdef HAVE_GTK_INFO_BAR_SUPPORT
GtkWidget *perf_gtk__setup_info_bar(void) GtkWidget *perf_gtk__setup_info_bar(void)
{ {
GtkWidget *info_bar; GtkWidget *info_bar;
......
...@@ -12,7 +12,7 @@ struct perf_gtk_context { ...@@ -12,7 +12,7 @@ struct perf_gtk_context {
GtkWidget *main_window; GtkWidget *main_window;
GtkWidget *notebook; GtkWidget *notebook;
#ifdef HAVE_GTK_INFO_BAR #ifdef HAVE_GTK_INFO_BAR_SUPPORT
GtkWidget *info_bar; GtkWidget *info_bar;
GtkWidget *message_label; GtkWidget *message_label;
#endif #endif
...@@ -39,7 +39,7 @@ void perf_gtk__resize_window(GtkWidget *window); ...@@ -39,7 +39,7 @@ void perf_gtk__resize_window(GtkWidget *window);
const char *perf_gtk__get_percent_color(double percent); const char *perf_gtk__get_percent_color(double percent);
GtkWidget *perf_gtk__setup_statusbar(void); GtkWidget *perf_gtk__setup_statusbar(void);
#ifdef HAVE_GTK_INFO_BAR #ifdef HAVE_GTK_INFO_BAR_SUPPORT
GtkWidget *perf_gtk__setup_info_bar(void); GtkWidget *perf_gtk__setup_info_bar(void);
#else #else
static inline GtkWidget *perf_gtk__setup_info_bar(void) static inline GtkWidget *perf_gtk__setup_info_bar(void)
......
...@@ -53,7 +53,7 @@ static int perf_gtk__error(const char *format, va_list args) ...@@ -53,7 +53,7 @@ static int perf_gtk__error(const char *format, va_list args)
return 0; return 0;
} }
#ifdef HAVE_GTK_INFO_BAR #ifdef HAVE_GTK_INFO_BAR_SUPPORT
static int perf_gtk__warning_info_bar(const char *format, va_list args) static int perf_gtk__warning_info_bar(const char *format, va_list args)
{ {
char *msg; char *msg;
...@@ -105,7 +105,7 @@ static int perf_gtk__warning_statusbar(const char *format, va_list args) ...@@ -105,7 +105,7 @@ static int perf_gtk__warning_statusbar(const char *format, va_list args)
struct perf_error_ops perf_gtk_eops = { struct perf_error_ops perf_gtk_eops = {
.error = perf_gtk__error, .error = perf_gtk__error,
#ifdef HAVE_GTK_INFO_BAR #ifdef HAVE_GTK_INFO_BAR_SUPPORT
.warning = perf_gtk__warning_info_bar, .warning = perf_gtk__warning_info_bar,
#else #else
.warning = perf_gtk__warning_statusbar, .warning = perf_gtk__warning_statusbar,
......
...@@ -12,7 +12,7 @@ extern int use_browser; ...@@ -12,7 +12,7 @@ extern int use_browser;
void setup_browser(bool fallback_to_pager); void setup_browser(bool fallback_to_pager);
void exit_browser(bool wait_for_ok); void exit_browser(bool wait_for_ok);
#ifdef SLANG_SUPPORT #ifdef HAVE_SLANG_SUPPORT
int ui__init(void); int ui__init(void);
void ui__exit(bool wait_for_ok); void ui__exit(bool wait_for_ok);
#else #else
...@@ -23,7 +23,7 @@ static inline int ui__init(void) ...@@ -23,7 +23,7 @@ static inline int ui__init(void)
static inline void ui__exit(bool wait_for_ok __maybe_unused) {} static inline void ui__exit(bool wait_for_ok __maybe_unused) {}
#endif #endif
#ifdef GTK2_SUPPORT #ifdef HAVE_GTK2_SUPPORT
int perf_gtk__init(void); int perf_gtk__init(void);
void perf_gtk__exit(bool wait_for_ok); void perf_gtk__exit(bool wait_for_ok);
#else #else
......
...@@ -150,7 +150,7 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map, ...@@ -150,7 +150,7 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map,
struct perf_evsel *evsel, bool print_lines, struct perf_evsel *evsel, bool print_lines,
bool full_paths, int min_pcnt, int max_lines); bool full_paths, int min_pcnt, int max_lines);
#ifdef SLANG_SUPPORT #ifdef HAVE_SLANG_SUPPORT
int symbol__tui_annotate(struct symbol *sym, struct map *map, int symbol__tui_annotate(struct symbol *sym, struct map *map,
struct perf_evsel *evsel, struct perf_evsel *evsel,
struct hist_browser_timer *hbt); struct hist_browser_timer *hbt);
...@@ -165,7 +165,7 @@ static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused, ...@@ -165,7 +165,7 @@ static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused,
} }
#endif #endif
#ifdef GTK2_SUPPORT #ifdef HAVE_GTK2_SUPPORT
int symbol__gtk_annotate(struct symbol *sym, struct map *map, int symbol__gtk_annotate(struct symbol *sym, struct map *map,
struct perf_evsel *evsel, struct perf_evsel *evsel,
struct hist_browser_timer *hbt); struct hist_browser_timer *hbt);
......
...@@ -70,7 +70,7 @@ extern char *perf_path(const char *fmt, ...) __attribute__((format (printf, 1, 2 ...@@ -70,7 +70,7 @@ extern char *perf_path(const char *fmt, ...) __attribute__((format (printf, 1, 2
extern char *perf_pathdup(const char *fmt, ...) extern char *perf_pathdup(const char *fmt, ...)
__attribute__((format (printf, 1, 2))); __attribute__((format (printf, 1, 2)));
#ifndef HAVE_STRLCPY #ifndef HAVE_STRLCPY_SUPPORT
extern size_t strlcpy(char *dest, const char *src, size_t size); extern size_t strlcpy(char *dest, const char *src, size_t size);
#endif #endif
......
...@@ -22,7 +22,7 @@ do ...@@ -22,7 +22,7 @@ do
}' "Documentation/perf-$cmd.txt" }' "Documentation/perf-$cmd.txt"
done done
echo "#ifdef LIBELF_SUPPORT" echo "#ifdef HAVE_LIBELF_SUPPORT"
sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' command-list.txt | sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' command-list.txt |
sort | sort |
while read cmd while read cmd
...@@ -35,5 +35,5 @@ do ...@@ -35,5 +35,5 @@ do
p p
}' "Documentation/perf-$cmd.txt" }' "Documentation/perf-$cmd.txt"
done done
echo "#endif /* LIBELF_SUPPORT */" echo "#endif /* HAVE_LIBELF_SUPPORT */"
echo "};" echo "};"
...@@ -187,7 +187,7 @@ struct hist_browser_timer { ...@@ -187,7 +187,7 @@ struct hist_browser_timer {
int refresh; int refresh;
}; };
#ifdef SLANG_SUPPORT #ifdef HAVE_SLANG_SUPPORT
#include "../ui/keysyms.h" #include "../ui/keysyms.h"
int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel, int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel,
struct hist_browser_timer *hbt); struct hist_browser_timer *hbt);
...@@ -228,7 +228,7 @@ static inline int script_browse(const char *script_opt __maybe_unused) ...@@ -228,7 +228,7 @@ static inline int script_browse(const char *script_opt __maybe_unused)
#define K_SWITCH_INPUT_DATA -3000 #define K_SWITCH_INPUT_DATA -3000
#endif #endif
#ifdef GTK2_SUPPORT #ifdef HAVE_GTK2_SUPPORT
int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, const char *help, int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, const char *help,
struct hist_browser_timer *hbt __maybe_unused, struct hist_browser_timer *hbt __maybe_unused,
float min_pcnt); float min_pcnt);
......
#ifndef _PERF_DWARF_REGS_H_ #ifndef _PERF_DWARF_REGS_H_
#define _PERF_DWARF_REGS_H_ #define _PERF_DWARF_REGS_H_
#ifdef DWARF_SUPPORT #ifdef HAVE_DWARF_SUPPORT
const char *get_arch_regstr(unsigned int n); const char *get_arch_regstr(unsigned int n);
#endif #endif
......
...@@ -172,7 +172,7 @@ int map__load(struct map *map, symbol_filter_t filter) ...@@ -172,7 +172,7 @@ int map__load(struct map *map, symbol_filter_t filter)
pr_warning(", continuing without symbols\n"); pr_warning(", continuing without symbols\n");
return -1; return -1;
} else if (nr == 0) { } else if (nr == 0) {
#ifdef LIBELF_SUPPORT #ifdef HAVE_LIBELF_SUPPORT
const size_t len = strlen(name); const size_t len = strlen(name);
const size_t real_len = len - sizeof(DSO__DELETED); const size_t real_len = len - sizeof(DSO__DELETED);
......
...@@ -22,7 +22,7 @@ static const char *get_perf_dir(void) ...@@ -22,7 +22,7 @@ static const char *get_perf_dir(void)
return "."; return ".";
} }
#ifndef HAVE_STRLCPY #ifndef HAVE_STRLCPY_SUPPORT
size_t strlcpy(char *dest, const char *src, size_t size) size_t strlcpy(char *dest, const char *src, size_t size)
{ {
size_t ret = strlen(src); size_t ret = strlen(src);
......
#ifndef __PERF_REGS_H #ifndef __PERF_REGS_H
#define __PERF_REGS_H #define __PERF_REGS_H
#ifdef HAVE_PERF_REGS #ifdef HAVE_PERF_REGS_SUPPORT
#include <perf_regs.h> #include <perf_regs.h>
#else #else
#define PERF_REGS_MASK 0 #define PERF_REGS_MASK 0
...@@ -10,5 +10,5 @@ static inline const char *perf_reg_name(int id __maybe_unused) ...@@ -10,5 +10,5 @@ static inline const char *perf_reg_name(int id __maybe_unused)
{ {
return NULL; return NULL;
} }
#endif /* HAVE_PERF_REGS */ #endif /* HAVE_PERF_REGS_SUPPORT */
#endif /* __PERF_REGS_H */ #endif /* __PERF_REGS_H */
...@@ -201,7 +201,7 @@ static int convert_to_perf_probe_point(struct probe_trace_point *tp, ...@@ -201,7 +201,7 @@ static int convert_to_perf_probe_point(struct probe_trace_point *tp,
return 0; return 0;
} }
#ifdef DWARF_SUPPORT #ifdef HAVE_DWARF_SUPPORT
/* Open new debuginfo of given module */ /* Open new debuginfo of given module */
static struct debuginfo *open_debuginfo(const char *module) static struct debuginfo *open_debuginfo(const char *module)
{ {
...@@ -630,7 +630,7 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs, ...@@ -630,7 +630,7 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs,
return ret; return ret;
} }
#else /* !DWARF_SUPPORT */ #else /* !HAVE_DWARF_SUPPORT */
static int kprobe_convert_to_perf_probe(struct probe_trace_point *tp, static int kprobe_convert_to_perf_probe(struct probe_trace_point *tp,
struct perf_probe_point *pp) struct perf_probe_point *pp)
......
...@@ -14,7 +14,7 @@ static inline int is_c_varname(const char *name) ...@@ -14,7 +14,7 @@ static inline int is_c_varname(const char *name)
return isalpha(name[0]) || name[0] == '_'; return isalpha(name[0]) || name[0] == '_';
} }
#ifdef DWARF_SUPPORT #ifdef HAVE_DWARF_SUPPORT
#include "dwarf-aux.h" #include "dwarf-aux.h"
...@@ -105,6 +105,6 @@ struct line_finder { ...@@ -105,6 +105,6 @@ struct line_finder {
int found; int found;
}; };
#endif /* DWARF_SUPPORT */ #endif /* HAVE_DWARF_SUPPORT */
#endif /*_PROBE_FINDER_H */ #endif /*_PROBE_FINDER_H */
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "symbol.h" #include "symbol.h"
#include "debug.h" #include "debug.h"
#ifndef HAVE_ELF_GETPHDRNUM #ifndef HAVE_ELF_GETPHDRNUM_SUPPORT
static int elf_getphdrnum(Elf *elf, size_t *dst) static int elf_getphdrnum(Elf *elf, size_t *dst)
{ {
GElf_Ehdr gehdr; GElf_Ehdr gehdr;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <libgen.h> #include <libgen.h>
#include "build-id.h" #include "build-id.h"
#ifdef LIBELF_SUPPORT #ifdef HAVE_LIBELF_SUPPORT
#include <libelf.h> #include <libelf.h>
#include <gelf.h> #include <gelf.h>
#endif #endif
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "dso.h" #include "dso.h"
#ifdef HAVE_CPLUS_DEMANGLE #ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
extern char *cplus_demangle(const char *, int); extern char *cplus_demangle(const char *, int);
static inline char *bfd_demangle(void __maybe_unused *v, const char *c, int i) static inline char *bfd_demangle(void __maybe_unused *v, const char *c, int i)
...@@ -46,7 +46,7 @@ static inline char *bfd_demangle(void __maybe_unused *v, ...@@ -46,7 +46,7 @@ static inline char *bfd_demangle(void __maybe_unused *v,
* libelf 0.8.x and earlier do not support ELF_C_READ_MMAP; * libelf 0.8.x and earlier do not support ELF_C_READ_MMAP;
* for newer versions we can use mmap to reduce memory usage: * for newer versions we can use mmap to reduce memory usage:
*/ */
#ifdef LIBELF_MMAP #ifdef HAVE_LIBELF_MMAP_SUPPORT
# define PERF_ELF_C_READ_MMAP ELF_C_READ_MMAP # define PERF_ELF_C_READ_MMAP ELF_C_READ_MMAP
#else #else
# define PERF_ELF_C_READ_MMAP ELF_C_READ # define PERF_ELF_C_READ_MMAP ELF_C_READ
...@@ -178,7 +178,7 @@ struct symsrc { ...@@ -178,7 +178,7 @@ struct symsrc {
int fd; int fd;
enum dso_binary_type type; enum dso_binary_type type;
#ifdef LIBELF_SUPPORT #ifdef HAVE_LIBELF_SUPPORT
Elf *elf; Elf *elf;
GElf_Ehdr ehdr; GElf_Ehdr ehdr;
......
...@@ -13,7 +13,7 @@ struct unwind_entry { ...@@ -13,7 +13,7 @@ struct unwind_entry {
typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg); typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg);
#ifdef LIBUNWIND_SUPPORT #ifdef HAVE_LIBUNWIND_SUPPORT
int unwind__get_entries(unwind_entry_cb_t cb, void *arg, int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
struct machine *machine, struct machine *machine,
struct thread *thread, struct thread *thread,
...@@ -31,5 +31,5 @@ unwind__get_entries(unwind_entry_cb_t cb __maybe_unused, ...@@ -31,5 +31,5 @@ unwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
{ {
return 0; return 0;
} }
#endif /* LIBUNWIND_SUPPORT */ #endif /* HAVE_LIBUNWIND_SUPPORT */
#endif /* __UNWIND_H */ #endif /* __UNWIND_H */
#include "../perf.h" #include "../perf.h"
#include "util.h" #include "util.h"
#include <sys/mman.h> #include <sys/mman.h>
#ifdef BACKTRACE_SUPPORT #ifdef HAVE_BACKTRACE_SUPPORT
#include <execinfo.h> #include <execinfo.h>
#endif #endif
#include <stdio.h> #include <stdio.h>
...@@ -204,7 +204,7 @@ int hex2u64(const char *ptr, u64 *long_val) ...@@ -204,7 +204,7 @@ int hex2u64(const char *ptr, u64 *long_val)
} }
/* Obtain a backtrace and print it to stdout. */ /* Obtain a backtrace and print it to stdout. */
#ifdef BACKTRACE_SUPPORT #ifdef HAVE_BACKTRACE_SUPPORT
void dump_stack(void) void dump_stack(void)
{ {
void *array[16]; void *array[16];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment