Merge tag 'modules-for-v5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu...
[linux-2.6-microblaze.git] / tools / perf / Makefile.config
1 # SPDX-License-Identifier: GPL-2.0-only
2
3 ifeq ($(src-perf),)
4 src-perf := $(srctree)/tools/perf
5 endif
6
7 ifeq ($(obj-perf),)
8 obj-perf := $(OUTPUT)
9 endif
10
11 ifneq ($(obj-perf),)
12 obj-perf := $(abspath $(obj-perf))/
13 endif
14
15 $(shell printf "" > $(OUTPUT).config-detected)
16 detected     = $(shell echo "$(1)=y"       >> $(OUTPUT).config-detected)
17 detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected)
18
19 CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)
20
21 include $(srctree)/tools/scripts/Makefile.arch
22
23 $(call detected_var,SRCARCH)
24
25 NO_PERF_REGS := 1
26 NO_SYSCALL_TABLE := 1
27
28 # Additional ARCH settings for ppc
29 ifeq ($(SRCARCH),powerpc)
30   NO_PERF_REGS := 0
31   NO_SYSCALL_TABLE := 0
32   CFLAGS += -I$(OUTPUT)arch/powerpc/include/generated
33   LIBUNWIND_LIBS := -lunwind -lunwind-ppc64
34 endif
35
36 # Additional ARCH settings for x86
37 ifeq ($(SRCARCH),x86)
38   $(call detected,CONFIG_X86)
39   ifeq (${IS_64_BIT}, 1)
40     NO_SYSCALL_TABLE := 0
41     CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT -I$(OUTPUT)arch/x86/include/generated
42     ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
43     LIBUNWIND_LIBS = -lunwind-x86_64 -lunwind -llzma
44     $(call detected,CONFIG_X86_64)
45   else
46     LIBUNWIND_LIBS = -lunwind-x86 -llzma -lunwind
47   endif
48   NO_PERF_REGS := 0
49 endif
50
51 ifeq ($(SRCARCH),arm)
52   NO_PERF_REGS := 0
53   LIBUNWIND_LIBS = -lunwind -lunwind-arm
54 endif
55
56 ifeq ($(SRCARCH),arm64)
57   NO_PERF_REGS := 0
58   NO_SYSCALL_TABLE := 0
59   CFLAGS += -I$(OUTPUT)arch/arm64/include/generated
60   LIBUNWIND_LIBS = -lunwind -lunwind-aarch64
61 endif
62
63 ifeq ($(SRCARCH),riscv)
64   NO_PERF_REGS := 0
65 endif
66
67 ifeq ($(SRCARCH),csky)
68   NO_PERF_REGS := 0
69 endif
70
71 ifeq ($(ARCH),s390)
72   NO_PERF_REGS := 0
73   NO_SYSCALL_TABLE := 0
74   CFLAGS += -fPIC -I$(OUTPUT)arch/s390/include/generated
75 endif
76
77 ifeq ($(NO_PERF_REGS),0)
78   $(call detected,CONFIG_PERF_REGS)
79 endif
80
81 ifneq ($(NO_SYSCALL_TABLE),1)
82   CFLAGS += -DHAVE_SYSCALL_TABLE_SUPPORT
83 endif
84
85 # So far there's only x86 and arm libdw unwind support merged in perf.
86 # Disable it on all other architectures in case libdw unwind
87 # support is detected in system. Add supported architectures
88 # to the check.
89 ifneq ($(SRCARCH),$(filter $(SRCARCH),x86 arm arm64 powerpc s390 csky riscv))
90   NO_LIBDW_DWARF_UNWIND := 1
91 endif
92
93 ifeq ($(LIBUNWIND_LIBS),)
94   NO_LIBUNWIND := 1
95 endif
96 #
97 # For linking with debug library, run like:
98 #
99 #   make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
100 #
101
102 libunwind_arch_set_flags = $(eval $(libunwind_arch_set_flags_code))
103 define libunwind_arch_set_flags_code
104   FEATURE_CHECK_CFLAGS-libunwind-$(1)  = -I$(LIBUNWIND_DIR)/include
105   FEATURE_CHECK_LDFLAGS-libunwind-$(1) = -L$(LIBUNWIND_DIR)/lib
106 endef
107
108 ifdef LIBUNWIND_DIR
109   LIBUNWIND_CFLAGS  = -I$(LIBUNWIND_DIR)/include
110   LIBUNWIND_LDFLAGS = -L$(LIBUNWIND_DIR)/lib
111   LIBUNWIND_ARCHS = x86 x86_64 arm aarch64 debug-frame-arm debug-frame-aarch64
112   $(foreach libunwind_arch,$(LIBUNWIND_ARCHS),$(call libunwind_arch_set_flags,$(libunwind_arch)))
113 endif
114
115 # Set per-feature check compilation flags
116 FEATURE_CHECK_CFLAGS-libunwind = $(LIBUNWIND_CFLAGS)
117 FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS)
118 FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS)
119 FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS)
120
121 FEATURE_CHECK_LDFLAGS-libunwind-arm = -lunwind -lunwind-arm
122 FEATURE_CHECK_LDFLAGS-libunwind-aarch64 = -lunwind -lunwind-aarch64
123 FEATURE_CHECK_LDFLAGS-libunwind-x86 = -lunwind -llzma -lunwind-x86
124 FEATURE_CHECK_LDFLAGS-libunwind-x86_64 = -lunwind -llzma -lunwind-x86_64
125
126 FEATURE_CHECK_LDFLAGS-libcrypto = -lcrypto
127
128 ifdef CSINCLUDES
129   LIBOPENCSD_CFLAGS := -I$(CSINCLUDES)
130 endif
131 OPENCSDLIBS := -lopencsd_c_api -lopencsd
132 ifdef CSLIBS
133   LIBOPENCSD_LDFLAGS := -L$(CSLIBS)
134 endif
135 FEATURE_CHECK_CFLAGS-libopencsd := $(LIBOPENCSD_CFLAGS)
136 FEATURE_CHECK_LDFLAGS-libopencsd := $(LIBOPENCSD_LDFLAGS) $(OPENCSDLIBS)
137
138 ifeq ($(NO_PERF_REGS),0)
139   CFLAGS += -DHAVE_PERF_REGS_SUPPORT
140 endif
141
142 # for linking with debug library, run like:
143 # make DEBUG=1 LIBDW_DIR=/opt/libdw/
144 ifdef LIBDW_DIR
145   LIBDW_CFLAGS  := -I$(LIBDW_DIR)/include
146   LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
147 endif
148 DWARFLIBS := -ldw
149 ifeq ($(findstring -static,${LDFLAGS}),-static)
150   DWARFLIBS += -lelf -lebl -ldl -lz -llzma -lbz2
151 endif
152 FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
153 FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) $(DWARFLIBS)
154
155 # for linking with debug library, run like:
156 # make DEBUG=1 LIBBABELTRACE_DIR=/opt/libbabeltrace/
157 ifdef LIBBABELTRACE_DIR
158   LIBBABELTRACE_CFLAGS  := -I$(LIBBABELTRACE_DIR)/include
159   LIBBABELTRACE_LDFLAGS := -L$(LIBBABELTRACE_DIR)/lib
160 endif
161 FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS)
162 FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf
163
164 ifdef LIBZSTD_DIR
165   LIBZSTD_CFLAGS  := -I$(LIBZSTD_DIR)/lib
166   LIBZSTD_LDFLAGS := -L$(LIBZSTD_DIR)/lib
167 endif
168 FEATURE_CHECK_CFLAGS-libzstd := $(LIBZSTD_CFLAGS)
169 FEATURE_CHECK_LDFLAGS-libzstd := $(LIBZSTD_LDFLAGS)
170
171 FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi -I$(srctree)/tools/include/uapi
172 # include ARCH specific config
173 -include $(src-perf)/arch/$(SRCARCH)/Makefile
174
175 ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
176   CFLAGS += -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
177 endif
178
179 include $(srctree)/tools/scripts/utilities.mak
180
181 ifeq ($(call get-executable,$(FLEX)),)
182   dummy := $(error Error: $(FLEX) is missing on this system, please install it)
183 endif
184
185 ifeq ($(call get-executable,$(BISON)),)
186   dummy := $(error Error: $(BISON) is missing on this system, please install it)
187 endif
188
189 # Treat warnings as errors unless directed not to
190 ifneq ($(WERROR),0)
191   CORE_CFLAGS += -Werror
192   CXXFLAGS += -Werror
193 endif
194
195 ifndef DEBUG
196   DEBUG := 0
197 endif
198
199 ifeq ($(DEBUG),0)
200 ifeq ($(CC_NO_CLANG), 0)
201   CORE_CFLAGS += -O3
202 else
203   CORE_CFLAGS += -O6
204 endif
205 endif
206
207 ifdef PARSER_DEBUG
208   PARSER_DEBUG_BISON := -t
209   PARSER_DEBUG_FLEX  := -d
210   CFLAGS             += -DPARSER_DEBUG
211   $(call detected_var,PARSER_DEBUG_BISON)
212   $(call detected_var,PARSER_DEBUG_FLEX)
213 endif
214
215 # Try different combinations to accommodate systems that only have
216 # python[2][-config] in weird combinations but always preferring
217 # python2 and python2-config as per pep-0394. If we catch a
218 # python[-config] in version 3, the version check will kill it.
219 PYTHON2 := $(if $(call get-executable,python2),python2,python)
220 override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON2))
221 PYTHON2_CONFIG := \
222   $(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config)
223 override PYTHON_CONFIG := \
224   $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG))
225
226 grep-libs  = $(filter -l%,$(1))
227 strip-libs  = $(filter-out -l%,$(1))
228
229 PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
230
231 # Python 3.8 changed the output of `python-config --ldflags` to not include the
232 # '-lpythonX.Y' flag unless '--embed' is also passed. The feature check for
233 # libpython fails if that flag is not included in LDFLAGS
234 ifeq ($(shell $(PYTHON_CONFIG_SQ) --ldflags --embed 2>&1 1>/dev/null; echo $$?), 0)
235   PYTHON_CONFIG_LDFLAGS := --ldflags --embed
236 else
237   PYTHON_CONFIG_LDFLAGS := --ldflags
238 endif
239
240 ifdef PYTHON_CONFIG
241   PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) $(PYTHON_CONFIG_LDFLAGS) 2>/dev/null)
242   PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
243   PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
244   PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --includes 2>/dev/null)
245   FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
246 endif
247
248 FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
249 FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
250 FEATURE_CHECK_CFLAGS-libpython-version := $(PYTHON_EMBED_CCOPTS)
251 FEATURE_CHECK_LDFLAGS-libpython-version := $(PYTHON_EMBED_LDOPTS)
252
253 FEATURE_CHECK_LDFLAGS-libaio = -lrt
254
255 FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl
256
257 CORE_CFLAGS += -fno-omit-frame-pointer
258 CORE_CFLAGS += -ggdb3
259 CORE_CFLAGS += -funwind-tables
260 CORE_CFLAGS += -Wall
261 CORE_CFLAGS += -Wextra
262 CORE_CFLAGS += -std=gnu99
263
264 CXXFLAGS += -std=gnu++11 -fno-exceptions -fno-rtti
265 CXXFLAGS += -Wall
266 CXXFLAGS += -fno-omit-frame-pointer
267 CXXFLAGS += -ggdb3
268 CXXFLAGS += -funwind-tables
269 CXXFLAGS += -Wno-strict-aliasing
270
271 # Enforce a non-executable stack, as we may regress (again) in the future by
272 # adding assembler files missing the .GNU-stack linker note.
273 LDFLAGS += -Wl,-z,noexecstack
274
275 EXTLIBS = -lpthread -lrt -lm -ldl
276
277 ifneq ($(TCMALLOC),)
278   CFLAGS += -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free
279   EXTLIBS += -ltcmalloc
280 endif
281
282 ifeq ($(FEATURES_DUMP),)
283 include $(srctree)/tools/build/Makefile.feature
284 else
285 include $(FEATURES_DUMP)
286 endif
287
288 ifeq ($(feature-stackprotector-all), 1)
289   CORE_CFLAGS += -fstack-protector-all
290 endif
291
292 ifeq ($(DEBUG),0)
293   ifeq ($(feature-fortify-source), 1)
294     CORE_CFLAGS += -D_FORTIFY_SOURCE=2
295   endif
296 endif
297
298 INC_FLAGS += -I$(srctree)/tools/lib/perf/include
299 INC_FLAGS += -I$(src-perf)/util/include
300 INC_FLAGS += -I$(src-perf)/arch/$(SRCARCH)/include
301 INC_FLAGS += -I$(srctree)/tools/include/
302 INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi
303 INC_FLAGS += -I$(srctree)/tools/include/uapi
304 INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/
305 INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/
306
307 # $(obj-perf)      for generated common-cmds.h
308 # $(obj-perf)/util for generated bison/flex headers
309 ifneq ($(OUTPUT),)
310 INC_FLAGS += -I$(obj-perf)/util
311 INC_FLAGS += -I$(obj-perf)
312 endif
313
314 INC_FLAGS += -I$(src-perf)/util
315 INC_FLAGS += -I$(src-perf)
316 INC_FLAGS += -I$(srctree)/tools/lib/
317
318 CORE_CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
319
320 CFLAGS   += $(CORE_CFLAGS) $(INC_FLAGS)
321 CXXFLAGS += $(INC_FLAGS)
322
323 LIBPERF_CFLAGS := $(CORE_CFLAGS) $(EXTRA_CFLAGS)
324
325 ifeq ($(feature-sync-compare-and-swap), 1)
326   CFLAGS += -DHAVE_SYNC_COMPARE_AND_SWAP_SUPPORT
327 endif
328
329 ifeq ($(feature-pthread-attr-setaffinity-np), 1)
330   CFLAGS += -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP
331 endif
332
333 ifeq ($(feature-pthread-barrier), 1)
334   CFLAGS += -DHAVE_PTHREAD_BARRIER
335 endif
336
337 ifndef NO_BIONIC
338   $(call feature_check,bionic)
339   ifeq ($(feature-bionic), 1)
340     BIONIC := 1
341     CFLAGS += -DLACKS_SIGQUEUE_PROTOTYPE
342     CFLAGS += -DLACKS_OPEN_MEMSTREAM_PROTOTYPE
343     EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
344     EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
345   endif
346 endif
347
348 ifeq ($(feature-eventfd), 1)
349   CFLAGS += -DHAVE_EVENTFD
350 endif
351
352 ifeq ($(feature-get_current_dir_name), 1)
353   CFLAGS += -DHAVE_GET_CURRENT_DIR_NAME
354 endif
355
356 ifeq ($(feature-gettid), 1)
357   CFLAGS += -DHAVE_GETTID
358 endif
359
360 ifeq ($(feature-file-handle), 1)
361   CFLAGS += -DHAVE_FILE_HANDLE
362 endif
363
364 ifdef NO_LIBELF
365   NO_DWARF := 1
366   NO_DEMANGLE := 1
367   NO_LIBUNWIND := 1
368   NO_LIBDW_DWARF_UNWIND := 1
369   NO_LIBBPF := 1
370   NO_JVMTI := 1
371 else
372   ifeq ($(feature-libelf), 0)
373     ifeq ($(feature-glibc), 1)
374       LIBC_SUPPORT := 1
375     endif
376     ifeq ($(BIONIC),1)
377       LIBC_SUPPORT := 1
378     endif
379     ifeq ($(LIBC_SUPPORT),1)
380       msg := $(warning No libelf found. Disables 'probe' tool, jvmti and BPF support in 'perf record'. Please install libelf-dev, libelf-devel or elfutils-libelf-devel);
381
382       NO_LIBELF := 1
383       NO_DWARF := 1
384       NO_DEMANGLE := 1
385       NO_LIBUNWIND := 1
386       NO_LIBDW_DWARF_UNWIND := 1
387       NO_LIBBPF := 1
388       NO_JVMTI := 1
389     else
390       ifneq ($(filter s% -static%,$(LDFLAGS),),)
391         msg := $(error No static glibc found, please install glibc-static);
392       else
393         msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]);
394       endif
395     endif
396   else
397     ifndef NO_LIBDW_DWARF_UNWIND
398       ifneq ($(feature-libdw-dwarf-unwind),1)
399         NO_LIBDW_DWARF_UNWIND := 1
400         msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR);
401       endif
402     endif
403     ifneq ($(feature-dwarf), 1)
404       ifndef NO_DWARF
405         msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev);
406         NO_DWARF := 1
407       endif
408     else
409       ifneq ($(feature-dwarf_getlocations), 1)
410         msg := $(warning Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.157);
411       else
412         CFLAGS += -DHAVE_DWARF_GETLOCATIONS_SUPPORT
413       endif # dwarf_getlocations
414     endif # Dwarf support
415   endif # libelf support
416 endif # NO_LIBELF
417
418 ifeq ($(feature-glibc), 1)
419   CFLAGS += -DHAVE_GLIBC_SUPPORT
420 endif
421
422 ifeq ($(feature-libaio), 1)
423   ifndef NO_AIO
424     CFLAGS += -DHAVE_AIO_SUPPORT
425   endif
426 endif
427
428 ifdef NO_DWARF
429   NO_LIBDW_DWARF_UNWIND := 1
430 endif
431
432 ifeq ($(feature-sched_getcpu), 1)
433   CFLAGS += -DHAVE_SCHED_GETCPU_SUPPORT
434 endif
435
436 ifeq ($(feature-setns), 1)
437   CFLAGS += -DHAVE_SETNS_SUPPORT
438   $(call detected,CONFIG_SETNS)
439 endif
440
441 ifdef CORESIGHT
442   $(call feature_check,libopencsd)
443   ifeq ($(feature-libopencsd), 1)
444     CFLAGS += -DHAVE_CSTRACE_SUPPORT $(LIBOPENCSD_CFLAGS)
445     ifeq ($(feature-reallocarray), 0)
446       CFLAGS += -DCOMPAT_NEED_REALLOCARRAY
447     endif
448     LDFLAGS += $(LIBOPENCSD_LDFLAGS)
449     EXTLIBS += $(OPENCSDLIBS)
450     $(call detected,CONFIG_LIBOPENCSD)
451     ifdef CSTRACE_RAW
452       CFLAGS += -DCS_DEBUG_RAW
453       ifeq (${CSTRACE_RAW}, packed)
454         CFLAGS += -DCS_RAW_PACKED
455       endif
456     endif
457   endif
458 endif
459
460 ifndef NO_LIBELF
461   CFLAGS += -DHAVE_LIBELF_SUPPORT
462   EXTLIBS += -lelf
463   $(call detected,CONFIG_LIBELF)
464
465   ifeq ($(feature-libelf-mmap), 1)
466     CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT
467   endif
468
469   ifeq ($(feature-libelf-getphdrnum), 1)
470     CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT
471   endif
472
473   ifeq ($(feature-libelf-gelf_getnote), 1)
474     CFLAGS += -DHAVE_GELF_GETNOTE_SUPPORT
475   else
476     msg := $(warning gelf_getnote() not found on libelf, SDT support disabled);
477   endif
478
479   ifeq ($(feature-libelf-getshdrstrndx), 1)
480     CFLAGS += -DHAVE_ELF_GETSHDRSTRNDX_SUPPORT
481   endif
482
483   ifndef NO_DWARF
484     ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
485       msg := $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled);
486       NO_DWARF := 1
487     else
488       CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
489       LDFLAGS += $(LIBDW_LDFLAGS)
490       EXTLIBS += ${DWARFLIBS}
491       $(call detected,CONFIG_DWARF)
492     endif # PERF_HAVE_DWARF_REGS
493   endif # NO_DWARF
494
495   ifndef NO_LIBBPF
496     ifeq ($(feature-bpf), 1)
497       CFLAGS += -DHAVE_LIBBPF_SUPPORT
498       $(call detected,CONFIG_LIBBPF)
499
500       # detecting libbpf without LIBBPF_DYNAMIC, so make VF=1 shows libbpf detection status
501       $(call feature_check,libbpf)
502       ifdef LIBBPF_DYNAMIC
503         ifeq ($(feature-libbpf), 1)
504           EXTLIBS += -lbpf
505         else
506           dummy := $(error Error: No libbpf devel library found, please install libbpf-devel);
507         endif
508       endif
509     endif
510
511     ifndef NO_DWARF
512       ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
513         CFLAGS += -DHAVE_BPF_PROLOGUE
514         $(call detected,CONFIG_BPF_PROLOGUE)
515       else
516         msg := $(warning BPF prologue is not supported by architecture $(SRCARCH), missing regs_query_register_offset());
517       endif
518     else
519       msg := $(warning DWARF support is off, BPF prologue is disabled);
520     endif
521
522   endif # NO_LIBBPF
523 endif # NO_LIBELF
524
525 ifndef NO_SDT
526   ifneq ($(feature-sdt), 1)
527     msg := $(warning No sys/sdt.h found, no SDT events are defined, please install systemtap-sdt-devel or systemtap-sdt-dev);
528     NO_SDT := 1;
529   else
530     CFLAGS += -DHAVE_SDT_EVENT
531     $(call detected,CONFIG_SDT_EVENT)
532   endif
533 endif
534
535 ifdef PERF_HAVE_JITDUMP
536   ifndef NO_LIBELF
537     $(call detected,CONFIG_JITDUMP)
538     CFLAGS += -DHAVE_JITDUMP
539   endif
540 endif
541
542 ifeq ($(SRCARCH),powerpc)
543   ifndef NO_DWARF
544     CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
545   endif
546 endif
547
548 ifndef NO_LIBUNWIND
549   have_libunwind :=
550
551   $(call feature_check,libunwind-x86)
552   ifeq ($(feature-libunwind-x86), 1)
553     $(call detected,CONFIG_LIBUNWIND_X86)
554     CFLAGS += -DHAVE_LIBUNWIND_X86_SUPPORT
555     LDFLAGS += -lunwind-x86
556     EXTLIBS_LIBUNWIND += -lunwind-x86
557     have_libunwind = 1
558   endif
559
560   $(call feature_check,libunwind-aarch64)
561   ifeq ($(feature-libunwind-aarch64), 1)
562     $(call detected,CONFIG_LIBUNWIND_AARCH64)
563     CFLAGS += -DHAVE_LIBUNWIND_AARCH64_SUPPORT
564     LDFLAGS += -lunwind-aarch64
565     EXTLIBS_LIBUNWIND += -lunwind-aarch64
566     have_libunwind = 1
567     $(call feature_check,libunwind-debug-frame-aarch64)
568     ifneq ($(feature-libunwind-debug-frame-aarch64), 1)
569       msg := $(warning No debug_frame support found in libunwind-aarch64);
570       CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME_AARCH64
571     endif
572   endif
573
574   ifneq ($(feature-libunwind), 1)
575     msg := $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR);
576     NO_LOCAL_LIBUNWIND := 1
577   else
578     have_libunwind := 1
579     $(call detected,CONFIG_LOCAL_LIBUNWIND)
580   endif
581
582   ifneq ($(have_libunwind), 1)
583     NO_LIBUNWIND := 1
584   endif
585 else
586   NO_LOCAL_LIBUNWIND := 1
587 endif
588
589 ifndef NO_LIBBPF
590   ifneq ($(feature-bpf), 1)
591     msg := $(warning BPF API too old. Please install recent kernel headers. BPF support in 'perf record' is disabled.)
592     NO_LIBBPF := 1
593   endif
594 endif
595
596 dwarf-post-unwind := 1
597 dwarf-post-unwind-text := BUG
598
599 # setup DWARF post unwinder
600 ifdef NO_LIBUNWIND
601   ifdef NO_LIBDW_DWARF_UNWIND
602     msg := $(warning Disabling post unwind, no support found.);
603     dwarf-post-unwind := 0
604   else
605     dwarf-post-unwind-text := libdw
606     $(call detected,CONFIG_LIBDW_DWARF_UNWIND)
607   endif
608 else
609   dwarf-post-unwind-text := libunwind
610   $(call detected,CONFIG_LIBUNWIND)
611   # Enable libunwind support by default.
612   ifndef NO_LIBDW_DWARF_UNWIND
613     NO_LIBDW_DWARF_UNWIND := 1
614   endif
615 endif
616
617 ifeq ($(dwarf-post-unwind),1)
618   CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT
619   $(call detected,CONFIG_DWARF_UNWIND)
620 else
621   NO_DWARF_UNWIND := 1
622 endif
623
624 ifndef NO_LOCAL_LIBUNWIND
625   ifeq ($(SRCARCH),$(filter $(SRCARCH),arm arm64))
626     $(call feature_check,libunwind-debug-frame)
627     ifneq ($(feature-libunwind-debug-frame), 1)
628       msg := $(warning No debug_frame support found in libunwind);
629       CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
630     endif
631   else
632     # non-ARM has no dwarf_find_debug_frame() function:
633     CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
634   endif
635   EXTLIBS += $(LIBUNWIND_LIBS)
636   LDFLAGS += $(LIBUNWIND_LIBS)
637 endif
638 ifeq ($(findstring -static,${LDFLAGS}),-static)
639   # gcc -static links libgcc_eh which contans piece of libunwind
640   LIBUNWIND_LDFLAGS += -Wl,--allow-multiple-definition
641 endif
642
643 ifndef NO_LIBUNWIND
644   CFLAGS  += -DHAVE_LIBUNWIND_SUPPORT
645   CFLAGS  += $(LIBUNWIND_CFLAGS)
646   LDFLAGS += $(LIBUNWIND_LDFLAGS)
647   EXTLIBS += $(EXTLIBS_LIBUNWIND)
648 endif
649
650 ifeq ($(NO_SYSCALL_TABLE),0)
651   $(call detected,CONFIG_TRACE)
652 else
653   ifndef NO_LIBAUDIT
654     ifneq ($(feature-libaudit), 1)
655       msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
656       NO_LIBAUDIT := 1
657     else
658       CFLAGS += -DHAVE_LIBAUDIT_SUPPORT
659       EXTLIBS += -laudit
660       $(call detected,CONFIG_TRACE)
661     endif
662   endif
663 endif
664
665 ifndef NO_LIBCRYPTO
666   ifneq ($(feature-libcrypto), 1)
667     msg := $(warning No libcrypto.h found, disables jitted code injection, please install openssl-devel or libssl-dev);
668     NO_LIBCRYPTO := 1
669   else
670     CFLAGS += -DHAVE_LIBCRYPTO_SUPPORT
671     EXTLIBS += -lcrypto
672     $(call detected,CONFIG_CRYPTO)
673   endif
674 endif
675
676 ifdef NO_NEWT
677   NO_SLANG=1
678 endif
679
680 ifndef NO_SLANG
681   ifneq ($(feature-libslang), 1)
682     ifneq ($(feature-libslang-include-subdir), 1)
683       msg := $(warning slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev);
684       NO_SLANG := 1
685     else
686       CFLAGS += -DHAVE_SLANG_INCLUDE_SUBDIR
687     endif
688   endif
689   ifndef NO_SLANG
690     # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
691     CFLAGS += -DHAVE_SLANG_SUPPORT
692     EXTLIBS += -lslang
693     $(call detected,CONFIG_SLANG)
694   endif
695 endif
696
697 ifndef NO_GTK2
698   FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
699   ifneq ($(feature-gtk2), 1)
700     msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
701     NO_GTK2 := 1
702   else
703     ifeq ($(feature-gtk2-infobar), 1)
704       GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT
705     endif
706     CFLAGS += -DHAVE_GTK2_SUPPORT
707     GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-2.0 2>/dev/null)
708     GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0 2>/dev/null)
709     EXTLIBS += -ldl
710   endif
711 endif
712
713 ifdef NO_LIBPERL
714   CFLAGS += -DNO_LIBPERL
715 else
716   PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
717   PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
718   PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
719   PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null)
720   PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS))
721   PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
722   FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
723
724   ifneq ($(feature-libperl), 1)
725     CFLAGS += -DNO_LIBPERL
726     NO_LIBPERL := 1
727     msg := $(warning Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev);
728   else
729     LDFLAGS += $(PERL_EMBED_LDFLAGS)
730     EXTLIBS += $(PERL_EMBED_LIBADD)
731     CFLAGS += -DHAVE_LIBPERL_SUPPORT
732     $(call detected,CONFIG_LIBPERL)
733   endif
734 endif
735
736 ifeq ($(feature-timerfd), 1)
737   CFLAGS += -DHAVE_TIMERFD_SUPPORT
738 else
739   msg := $(warning No timerfd support. Disables 'perf kvm stat live');
740 endif
741
742 disable-python = $(eval $(disable-python_code))
743 define disable-python_code
744   CFLAGS += -DNO_LIBPYTHON
745   $(warning $1)
746   NO_LIBPYTHON := 1
747 endef
748
749 ifdef NO_LIBPYTHON
750   $(call disable-python,Python support disabled by user)
751 else
752
753   ifndef PYTHON
754     $(call disable-python,No python interpreter was found: disables Python support - please install python-devel/python-dev)
755   else
756     PYTHON_WORD := $(call shell-wordify,$(PYTHON))
757
758     ifndef PYTHON_CONFIG
759       $(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev)
760     else
761
762       ifneq ($(feature-libpython), 1)
763         $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev)
764       else
765          LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
766          EXTLIBS += $(PYTHON_EMBED_LIBADD)
767          LANG_BINDINGS += $(obj-perf)python/perf.so
768          CFLAGS += -DHAVE_LIBPYTHON_SUPPORT
769          $(call detected,CONFIG_LIBPYTHON)
770       endif
771     endif
772   endif
773 endif
774
775 ifeq ($(feature-libbfd), 1)
776   EXTLIBS += -lbfd -lopcodes
777 else
778   # we are on a system that requires -liberty and (maybe) -lz
779   # to link against -lbfd; test each case individually here
780
781   # call all detections now so we get correct
782   # status in VF output
783   $(call feature_check,libbfd-liberty)
784   $(call feature_check,libbfd-liberty-z)
785
786   ifeq ($(feature-libbfd-liberty), 1)
787     EXTLIBS += -lbfd -lopcodes -liberty
788     FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl
789   else
790     ifeq ($(feature-libbfd-liberty-z), 1)
791       EXTLIBS += -lbfd -lopcodes -liberty -lz
792       FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl
793     endif
794   endif
795   $(call feature_check,disassembler-four-args)
796 endif
797
798 ifdef NO_DEMANGLE
799   CFLAGS += -DNO_DEMANGLE
800 else
801   ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
802     EXTLIBS += -liberty
803   else
804     ifeq ($(filter -liberty,$(EXTLIBS)),)
805       $(call feature_check,cplus-demangle)
806
807       # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
808       # or any of 'bfd iberty z' trinity
809       ifeq ($(feature-cplus-demangle), 1)
810         EXTLIBS += -liberty
811       else
812         msg := $(warning No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling)
813         CFLAGS += -DNO_DEMANGLE
814       endif
815     endif
816   endif
817
818   ifneq ($(filter -liberty,$(EXTLIBS)),)
819     CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
820   endif
821 endif
822
823 ifneq ($(filter -lbfd,$(EXTLIBS)),)
824   CFLAGS += -DHAVE_LIBBFD_SUPPORT
825 endif
826
827 ifndef NO_ZLIB
828   ifeq ($(feature-zlib), 1)
829     CFLAGS += -DHAVE_ZLIB_SUPPORT
830     EXTLIBS += -lz
831     $(call detected,CONFIG_ZLIB)
832   else
833     NO_ZLIB := 1
834   endif
835 endif
836
837 ifndef NO_LZMA
838   ifeq ($(feature-lzma), 1)
839     CFLAGS += -DHAVE_LZMA_SUPPORT
840     EXTLIBS += -llzma
841     $(call detected,CONFIG_LZMA)
842   else
843     msg := $(warning No liblzma found, disables xz kernel module decompression, please install xz-devel/liblzma-dev);
844     NO_LZMA := 1
845   endif
846 endif
847
848 ifndef NO_LIBZSTD
849   ifeq ($(feature-libzstd), 1)
850     CFLAGS += -DHAVE_ZSTD_SUPPORT
851     CFLAGS += $(LIBZSTD_CFLAGS)
852     LDFLAGS += $(LIBZSTD_LDFLAGS)
853     EXTLIBS += -lzstd
854     $(call detected,CONFIG_ZSTD)
855   else
856     msg := $(warning No libzstd found, disables trace compression, please install libzstd-dev[el] and/or set LIBZSTD_DIR);
857     NO_LIBZSTD := 1
858   endif
859 endif
860
861 ifndef NO_LIBCAP
862   ifeq ($(feature-libcap), 1)
863     CFLAGS += -DHAVE_LIBCAP_SUPPORT
864     EXTLIBS += -lcap
865     $(call detected,CONFIG_LIBCAP)
866   else
867     msg := $(warning No libcap found, disables capability support, please install libcap-devel/libcap-dev);
868     NO_LIBCAP := 1
869   endif
870 endif
871
872 ifndef NO_BACKTRACE
873   ifeq ($(feature-backtrace), 1)
874     CFLAGS += -DHAVE_BACKTRACE_SUPPORT
875   endif
876 endif
877
878 ifndef NO_LIBNUMA
879   ifeq ($(feature-libnuma), 0)
880     msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev);
881     NO_LIBNUMA := 1
882   else
883     ifeq ($(feature-numa_num_possible_cpus), 0)
884       msg := $(warning Old numa library found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev >= 2.0.8);
885       NO_LIBNUMA := 1
886     else
887       CFLAGS += -DHAVE_LIBNUMA_SUPPORT
888       EXTLIBS += -lnuma
889       $(call detected,CONFIG_NUMA)
890     endif
891   endif
892 endif
893
894 ifdef HAVE_KVM_STAT_SUPPORT
895     CFLAGS += -DHAVE_KVM_STAT_SUPPORT
896 endif
897
898 ifeq ($(feature-disassembler-four-args), 1)
899     CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
900 endif
901
902 ifeq (${IS_64_BIT}, 1)
903   ifndef NO_PERF_READ_VDSO32
904     $(call feature_check,compile-32)
905     ifeq ($(feature-compile-32), 1)
906       CFLAGS += -DHAVE_PERF_READ_VDSO32
907     else
908       NO_PERF_READ_VDSO32 := 1
909     endif
910   endif
911   ifneq ($(SRCARCH), x86)
912     NO_PERF_READ_VDSOX32 := 1
913   endif
914   ifndef NO_PERF_READ_VDSOX32
915     $(call feature_check,compile-x32)
916     ifeq ($(feature-compile-x32), 1)
917       CFLAGS += -DHAVE_PERF_READ_VDSOX32
918     else
919       NO_PERF_READ_VDSOX32 := 1
920     endif
921   endif
922 else
923   NO_PERF_READ_VDSO32 := 1
924   NO_PERF_READ_VDSOX32 := 1
925 endif
926
927 ifndef NO_LIBBABELTRACE
928   $(call feature_check,libbabeltrace)
929   ifeq ($(feature-libbabeltrace), 1)
930     CFLAGS += -DHAVE_LIBBABELTRACE_SUPPORT $(LIBBABELTRACE_CFLAGS)
931     LDFLAGS += $(LIBBABELTRACE_LDFLAGS)
932     EXTLIBS += -lbabeltrace-ctf
933     $(call detected,CONFIG_LIBBABELTRACE)
934   else
935     msg := $(warning No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev);
936   endif
937 endif
938
939 ifndef NO_AUXTRACE
940   ifeq ($(SRCARCH),x86)
941     ifeq ($(feature-get_cpuid), 0)
942       msg := $(warning Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc);
943       NO_AUXTRACE := 1
944     endif
945   endif
946   ifndef NO_AUXTRACE
947     $(call detected,CONFIG_AUXTRACE)
948     CFLAGS += -DHAVE_AUXTRACE_SUPPORT
949   endif
950 endif
951
952 ifndef NO_JVMTI
953   ifneq (,$(wildcard /usr/sbin/update-java-alternatives))
954     JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | awk '{print $$3}')
955   else
956     ifneq (,$(wildcard /usr/sbin/alternatives))
957       JDIR=$(shell /usr/sbin/alternatives --display java | tail -1 | cut -d' ' -f 5 | sed -e 's%/jre/bin/java.%%g' -e 's%/bin/java.%%g')
958     endif
959   endif
960   ifndef JDIR
961     $(warning No alternatives command found, you need to set JDIR= to point to the root of your Java directory)
962     NO_JVMTI := 1
963   endif
964 endif
965
966 ifndef NO_JVMTI
967   FEATURE_CHECK_CFLAGS-jvmti := -I$(JDIR)/include -I$(JDIR)/include/linux
968   $(call feature_check,jvmti)
969   ifeq ($(feature-jvmti), 1)
970     $(call detected_var,JDIR)
971     ifndef NO_JVMTI_CMLR
972       FEATURE_CHECK_CFLAGS-jvmti-cmlr := $(FEATURE_CHECK_CFLAGS-jvmti)
973       $(call feature_check,jvmti-cmlr)
974       ifeq ($(feature-jvmti-cmlr), 1)
975         CFLAGS += -DHAVE_JVMTI_CMLR
976       endif
977     endif # NO_JVMTI_CMLR
978   else
979     $(warning No openjdk development package found, please install JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel)
980     NO_JVMTI := 1
981   endif
982 endif
983
984 USE_CXX = 0
985 USE_CLANGLLVM = 0
986 ifdef LIBCLANGLLVM
987   $(call feature_check,cxx)
988   ifneq ($(feature-cxx), 1)
989     msg := $(warning No g++ found, disable clang and llvm support. Please install g++)
990   else
991     $(call feature_check,llvm)
992     $(call feature_check,llvm-version)
993     ifneq ($(feature-llvm), 1)
994       msg := $(warning No suitable libLLVM found, disabling builtin clang and LLVM support. Please install llvm-dev(el) (>= 3.9.0))
995     else
996       $(call feature_check,clang)
997       ifneq ($(feature-clang), 1)
998         msg := $(warning No suitable libclang found, disabling builtin clang and LLVM support. Please install libclang-dev(el) (>= 3.9.0))
999       else
1000         CFLAGS += -DHAVE_LIBCLANGLLVM_SUPPORT
1001         CXXFLAGS += -DHAVE_LIBCLANGLLVM_SUPPORT -I$(shell $(LLVM_CONFIG) --includedir)
1002         $(call detected,CONFIG_CXX)
1003         $(call detected,CONFIG_CLANGLLVM)
1004         USE_CXX = 1
1005         USE_LLVM = 1
1006         USE_CLANG = 1
1007         ifneq ($(feature-llvm-version),1)
1008           msg := $(warning This version of LLVM is not tested. May cause build errors)
1009         endif
1010       endif
1011     endif
1012   endif
1013 endif
1014
1015 # Among the variables below, these:
1016 #   perfexecdir
1017 #   perf_include_dir
1018 #   perf_examples_dir
1019 #   template_dir
1020 #   mandir
1021 #   infodir
1022 #   htmldir
1023 #   ETC_PERFCONFIG (but not sysconfdir)
1024 # can be specified as a relative path some/where/else;
1025 # this is interpreted as relative to $(prefix) and "perf" at
1026 # runtime figures out where they are based on the path to the executable.
1027 # This can help installing the suite in a relocatable way.
1028
1029 # Make the path relative to DESTDIR, not to prefix
1030 ifndef DESTDIR
1031 prefix ?= $(HOME)
1032 endif
1033 bindir_relative = bin
1034 bindir = $(abspath $(prefix)/$(bindir_relative))
1035 mandir = share/man
1036 infodir = share/info
1037 perfexecdir = libexec/perf-core
1038 perf_include_dir = lib/perf/include
1039 perf_examples_dir = lib/perf/examples
1040 sharedir = $(prefix)/share
1041 template_dir = share/perf-core/templates
1042 STRACE_GROUPS_DIR = share/perf-core/strace/groups
1043 htmldir = share/doc/perf-doc
1044 tipdir = share/doc/perf-tip
1045 srcdir = $(srctree)/tools/perf
1046 ifeq ($(prefix),/usr)
1047 sysconfdir = /etc
1048 ETC_PERFCONFIG = $(sysconfdir)/perfconfig
1049 else
1050 sysconfdir = $(prefix)/etc
1051 ETC_PERFCONFIG = etc/perfconfig
1052 endif
1053 ifndef lib
1054 ifeq ($(SRCARCH)$(IS_64_BIT), x861)
1055 lib = lib64
1056 else
1057 lib = lib
1058 endif
1059 endif # lib
1060 libdir = $(prefix)/$(lib)
1061
1062 # Shell quote (do not use $(call) to accommodate ancient setups);
1063 ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG))
1064 STRACE_GROUPS_DIR_SQ = $(subst ','\'',$(STRACE_GROUPS_DIR))
1065 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
1066 bindir_SQ = $(subst ','\'',$(bindir))
1067 mandir_SQ = $(subst ','\'',$(mandir))
1068 infodir_SQ = $(subst ','\'',$(infodir))
1069 perfexecdir_SQ = $(subst ','\'',$(perfexecdir))
1070 perf_include_dir_SQ = $(subst ','\'',$(perf_include_dir))
1071 perf_examples_dir_SQ = $(subst ','\'',$(perf_examples_dir))
1072 template_dir_SQ = $(subst ','\'',$(template_dir))
1073 htmldir_SQ = $(subst ','\'',$(htmldir))
1074 tipdir_SQ = $(subst ','\'',$(tipdir))
1075 prefix_SQ = $(subst ','\'',$(prefix))
1076 sysconfdir_SQ = $(subst ','\'',$(sysconfdir))
1077 libdir_SQ = $(subst ','\'',$(libdir))
1078 srcdir_SQ = $(subst ','\'',$(srcdir))
1079
1080 ifneq ($(filter /%,$(firstword $(perfexecdir))),)
1081 perfexec_instdir = $(perfexecdir)
1082 perf_include_instdir = $(perf_include_dir)
1083 perf_examples_instdir = $(perf_examples_dir)
1084 STRACE_GROUPS_INSTDIR = $(STRACE_GROUPS_DIR)
1085 tip_instdir = $(tipdir)
1086 else
1087 perfexec_instdir = $(prefix)/$(perfexecdir)
1088 perf_include_instdir = $(prefix)/$(perf_include_dir)
1089 perf_examples_instdir = $(prefix)/$(perf_examples_dir)
1090 STRACE_GROUPS_INSTDIR = $(prefix)/$(STRACE_GROUPS_DIR)
1091 tip_instdir = $(prefix)/$(tipdir)
1092 endif
1093 perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir))
1094 perf_include_instdir_SQ = $(subst ','\'',$(perf_include_instdir))
1095 perf_examples_instdir_SQ = $(subst ','\'',$(perf_examples_instdir))
1096 STRACE_GROUPS_INSTDIR_SQ = $(subst ','\'',$(STRACE_GROUPS_INSTDIR))
1097 tip_instdir_SQ = $(subst ','\'',$(tip_instdir))
1098
1099 # If we install to $(HOME) we keep the traceevent default:
1100 # $(HOME)/.traceevent/plugins
1101 # Otherwise we install plugins into the global $(libdir).
1102 ifdef DESTDIR
1103 plugindir=$(libdir)/traceevent/plugins
1104 plugindir_SQ= $(subst ','\'',$(plugindir))
1105 endif
1106
1107 print_var = $(eval $(print_var_code)) $(info $(MSG))
1108 define print_var_code
1109     MSG = $(shell printf '...%30s: %s' $(1) $($(1)))
1110 endef
1111
1112 ifeq ($(VF),1)
1113   # Display EXTRA features which are detected manualy
1114   # from here with feature_check call and thus cannot
1115   # be partof global state output.
1116   $(foreach feat,$(FEATURE_TESTS_EXTRA),$(call feature_print_status,$(feat),))
1117   $(call print_var,prefix)
1118   $(call print_var,bindir)
1119   $(call print_var,libdir)
1120   $(call print_var,sysconfdir)
1121   $(call print_var,LIBUNWIND_DIR)
1122   $(call print_var,LIBDW_DIR)
1123   $(call print_var,JDIR)
1124
1125   ifeq ($(dwarf-post-unwind),1)
1126     $(call feature_print_text,"DWARF post unwind library", $(dwarf-post-unwind-text))
1127   endif
1128   $(info )
1129 endif
1130
1131 $(call detected_var,bindir_SQ)
1132 $(call detected_var,PYTHON_WORD)
1133 ifneq ($(OUTPUT),)
1134 $(call detected_var,OUTPUT)
1135 endif
1136 $(call detected_var,htmldir_SQ)
1137 $(call detected_var,infodir_SQ)
1138 $(call detected_var,mandir_SQ)
1139 $(call detected_var,ETC_PERFCONFIG_SQ)
1140 $(call detected_var,STRACE_GROUPS_DIR_SQ)
1141 $(call detected_var,prefix_SQ)
1142 $(call detected_var,perfexecdir_SQ)
1143 $(call detected_var,perf_include_dir_SQ)
1144 $(call detected_var,perf_examples_dir_SQ)
1145 $(call detected_var,tipdir_SQ)
1146 $(call detected_var,srcdir_SQ)
1147 $(call detected_var,LIBDIR)
1148 $(call detected_var,GTK_CFLAGS)
1149 $(call detected_var,PERL_EMBED_CCOPTS)
1150 $(call detected_var,PYTHON_EMBED_CCOPTS)