GNU Linux-libre 5.4.200-gnu1
[releases.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   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   CFLAGS += -O3
202 else
203   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
251 FEATURE_CHECK_LDFLAGS-libaio = -lrt
252
253 FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl
254
255 CFLAGS += -fno-omit-frame-pointer
256 CFLAGS += -ggdb3
257 CFLAGS += -funwind-tables
258 CFLAGS += -Wall
259 CFLAGS += -Wextra
260 CFLAGS += -std=gnu99
261
262 CXXFLAGS += -std=gnu++11 -fno-exceptions -fno-rtti
263 CXXFLAGS += -Wall
264 CXXFLAGS += -fno-omit-frame-pointer
265 CXXFLAGS += -ggdb3
266 CXXFLAGS += -funwind-tables
267 CXXFLAGS += -Wno-strict-aliasing
268
269 # Enforce a non-executable stack, as we may regress (again) in the future by
270 # adding assembler files missing the .GNU-stack linker note.
271 LDFLAGS += -Wl,-z,noexecstack
272
273 EXTLIBS = -lpthread -lrt -lm -ldl
274
275 ifeq ($(FEATURES_DUMP),)
276 include $(srctree)/tools/build/Makefile.feature
277 else
278 include $(FEATURES_DUMP)
279 endif
280
281 ifeq ($(feature-stackprotector-all), 1)
282   CFLAGS += -fstack-protector-all
283 endif
284
285 ifeq ($(DEBUG),0)
286   ifeq ($(feature-fortify-source), 1)
287     CFLAGS += -D_FORTIFY_SOURCE=2
288   endif
289 endif
290
291 INC_FLAGS += -I$(src-perf)/lib/include
292 INC_FLAGS += -I$(src-perf)/util/include
293 INC_FLAGS += -I$(src-perf)/arch/$(SRCARCH)/include
294 INC_FLAGS += -I$(srctree)/tools/include/
295 INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi
296 INC_FLAGS += -I$(srctree)/tools/include/uapi
297 INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/
298 INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/
299
300 # $(obj-perf)      for generated common-cmds.h
301 # $(obj-perf)/util for generated bison/flex headers
302 ifneq ($(OUTPUT),)
303 INC_FLAGS += -I$(obj-perf)/util
304 INC_FLAGS += -I$(obj-perf)
305 endif
306
307 INC_FLAGS += -I$(src-perf)/util
308 INC_FLAGS += -I$(src-perf)
309 INC_FLAGS += -I$(srctree)/tools/lib/
310
311 CFLAGS   += $(INC_FLAGS)
312 CXXFLAGS += $(INC_FLAGS)
313
314 CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
315
316 ifeq ($(feature-sync-compare-and-swap), 1)
317   CFLAGS += -DHAVE_SYNC_COMPARE_AND_SWAP_SUPPORT
318 endif
319
320 ifeq ($(feature-pthread-attr-setaffinity-np), 1)
321   CFLAGS += -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP
322 endif
323
324 ifeq ($(feature-pthread-barrier), 1)
325   CFLAGS += -DHAVE_PTHREAD_BARRIER
326 endif
327
328 ifndef NO_BIONIC
329   $(call feature_check,bionic)
330   ifeq ($(feature-bionic), 1)
331     BIONIC := 1
332     CFLAGS += -DLACKS_SIGQUEUE_PROTOTYPE
333     CFLAGS += -DLACKS_OPEN_MEMSTREAM_PROTOTYPE
334     EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
335     EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
336   endif
337 endif
338
339 ifeq ($(feature-eventfd), 1)
340   CFLAGS += -DHAVE_EVENTFD
341 endif
342
343 ifeq ($(feature-get_current_dir_name), 1)
344   CFLAGS += -DHAVE_GET_CURRENT_DIR_NAME
345 endif
346
347 ifeq ($(feature-gettid), 1)
348   CFLAGS += -DHAVE_GETTID
349 endif
350
351 ifdef NO_LIBELF
352   NO_DWARF := 1
353   NO_DEMANGLE := 1
354   NO_LIBUNWIND := 1
355   NO_LIBDW_DWARF_UNWIND := 1
356   NO_LIBBPF := 1
357   NO_JVMTI := 1
358 else
359   ifeq ($(feature-libelf), 0)
360     ifeq ($(feature-glibc), 1)
361       LIBC_SUPPORT := 1
362     endif
363     ifeq ($(BIONIC),1)
364       LIBC_SUPPORT := 1
365     endif
366     ifeq ($(LIBC_SUPPORT),1)
367       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);
368
369       NO_LIBELF := 1
370       NO_DWARF := 1
371       NO_DEMANGLE := 1
372       NO_LIBUNWIND := 1
373       NO_LIBDW_DWARF_UNWIND := 1
374       NO_LIBBPF := 1
375       NO_JVMTI := 1
376     else
377       ifneq ($(filter s% -static%,$(LDFLAGS),),)
378         msg := $(error No static glibc found, please install glibc-static);
379       else
380         msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]);
381       endif
382     endif
383   else
384     ifndef NO_LIBDW_DWARF_UNWIND
385       ifneq ($(feature-libdw-dwarf-unwind),1)
386         NO_LIBDW_DWARF_UNWIND := 1
387         msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR);
388       endif
389     endif
390     ifneq ($(feature-dwarf), 1)
391       ifndef NO_DWARF
392         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);
393         NO_DWARF := 1
394       endif
395     else
396       ifneq ($(feature-dwarf_getlocations), 1)
397         msg := $(warning Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.157);
398       else
399         CFLAGS += -DHAVE_DWARF_GETLOCATIONS_SUPPORT
400       endif # dwarf_getlocations
401     endif # Dwarf support
402   endif # libelf support
403 endif # NO_LIBELF
404
405 ifeq ($(feature-glibc), 1)
406   CFLAGS += -DHAVE_GLIBC_SUPPORT
407 endif
408
409 ifeq ($(feature-libaio), 1)
410   ifndef NO_AIO
411     CFLAGS += -DHAVE_AIO_SUPPORT
412   endif
413 endif
414
415 ifdef NO_DWARF
416   NO_LIBDW_DWARF_UNWIND := 1
417 endif
418
419 ifeq ($(feature-sched_getcpu), 1)
420   CFLAGS += -DHAVE_SCHED_GETCPU_SUPPORT
421 endif
422
423 ifeq ($(feature-setns), 1)
424   CFLAGS += -DHAVE_SETNS_SUPPORT
425   $(call detected,CONFIG_SETNS)
426 endif
427
428 ifdef CORESIGHT
429   $(call feature_check,libopencsd)
430   ifeq ($(feature-libopencsd), 1)
431     CFLAGS += -DHAVE_CSTRACE_SUPPORT $(LIBOPENCSD_CFLAGS)
432     ifeq ($(feature-reallocarray), 0)
433       CFLAGS += -DCOMPAT_NEED_REALLOCARRAY
434     endif
435     LDFLAGS += $(LIBOPENCSD_LDFLAGS)
436     EXTLIBS += $(OPENCSDLIBS)
437     $(call detected,CONFIG_LIBOPENCSD)
438     ifdef CSTRACE_RAW
439       CFLAGS += -DCS_DEBUG_RAW
440       ifeq (${CSTRACE_RAW}, packed)
441         CFLAGS += -DCS_RAW_PACKED
442       endif
443     endif
444   endif
445 endif
446
447 ifndef NO_LIBELF
448   CFLAGS += -DHAVE_LIBELF_SUPPORT
449   EXTLIBS += -lelf
450   $(call detected,CONFIG_LIBELF)
451
452   ifeq ($(feature-libelf-mmap), 1)
453     CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT
454   endif
455
456   ifeq ($(feature-libelf-getphdrnum), 1)
457     CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT
458   endif
459
460   ifeq ($(feature-libelf-gelf_getnote), 1)
461     CFLAGS += -DHAVE_GELF_GETNOTE_SUPPORT
462   else
463     msg := $(warning gelf_getnote() not found on libelf, SDT support disabled);
464   endif
465
466   ifeq ($(feature-libelf-getshdrstrndx), 1)
467     CFLAGS += -DHAVE_ELF_GETSHDRSTRNDX_SUPPORT
468   endif
469
470   ifndef NO_DWARF
471     ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
472       msg := $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled);
473       NO_DWARF := 1
474     else
475       CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
476       LDFLAGS += $(LIBDW_LDFLAGS)
477       EXTLIBS += ${DWARFLIBS}
478       $(call detected,CONFIG_DWARF)
479     endif # PERF_HAVE_DWARF_REGS
480   endif # NO_DWARF
481
482   ifndef NO_LIBBPF
483     ifeq ($(feature-bpf), 1)
484       CFLAGS += -DHAVE_LIBBPF_SUPPORT
485       $(call detected,CONFIG_LIBBPF)
486     endif
487
488     ifndef NO_DWARF
489       ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
490         CFLAGS += -DHAVE_BPF_PROLOGUE
491         $(call detected,CONFIG_BPF_PROLOGUE)
492       else
493         msg := $(warning BPF prologue is not supported by architecture $(SRCARCH), missing regs_query_register_offset());
494       endif
495     else
496       msg := $(warning DWARF support is off, BPF prologue is disabled);
497     endif
498
499   endif # NO_LIBBPF
500 endif # NO_LIBELF
501
502 ifndef NO_SDT
503   ifneq ($(feature-sdt), 1)
504     msg := $(warning No sys/sdt.h found, no SDT events are defined, please install systemtap-sdt-devel or systemtap-sdt-dev);
505     NO_SDT := 1;
506   else
507     CFLAGS += -DHAVE_SDT_EVENT
508     $(call detected,CONFIG_SDT_EVENT)
509   endif
510 endif
511
512 ifdef PERF_HAVE_JITDUMP
513   ifndef NO_LIBELF
514     $(call detected,CONFIG_JITDUMP)
515     CFLAGS += -DHAVE_JITDUMP
516   endif
517 endif
518
519 ifeq ($(SRCARCH),powerpc)
520   ifndef NO_DWARF
521     CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
522   endif
523 endif
524
525 ifndef NO_LIBUNWIND
526   have_libunwind :=
527
528   $(call feature_check,libunwind-x86)
529   ifeq ($(feature-libunwind-x86), 1)
530     $(call detected,CONFIG_LIBUNWIND_X86)
531     CFLAGS += -DHAVE_LIBUNWIND_X86_SUPPORT
532     LDFLAGS += -lunwind-x86
533     EXTLIBS_LIBUNWIND += -lunwind-x86
534     have_libunwind = 1
535   endif
536
537   $(call feature_check,libunwind-aarch64)
538   ifeq ($(feature-libunwind-aarch64), 1)
539     $(call detected,CONFIG_LIBUNWIND_AARCH64)
540     CFLAGS += -DHAVE_LIBUNWIND_AARCH64_SUPPORT
541     LDFLAGS += -lunwind-aarch64
542     EXTLIBS_LIBUNWIND += -lunwind-aarch64
543     have_libunwind = 1
544     $(call feature_check,libunwind-debug-frame-aarch64)
545     ifneq ($(feature-libunwind-debug-frame-aarch64), 1)
546       msg := $(warning No debug_frame support found in libunwind-aarch64);
547       CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME_AARCH64
548     endif
549   endif
550
551   ifneq ($(feature-libunwind), 1)
552     msg := $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR);
553     NO_LOCAL_LIBUNWIND := 1
554   else
555     have_libunwind := 1
556     $(call detected,CONFIG_LOCAL_LIBUNWIND)
557   endif
558
559   ifneq ($(have_libunwind), 1)
560     NO_LIBUNWIND := 1
561   endif
562 else
563   NO_LOCAL_LIBUNWIND := 1
564 endif
565
566 ifndef NO_LIBBPF
567   ifneq ($(feature-bpf), 1)
568     msg := $(warning BPF API too old. Please install recent kernel headers. BPF support in 'perf record' is disabled.)
569     NO_LIBBPF := 1
570   endif
571 endif
572
573 dwarf-post-unwind := 1
574 dwarf-post-unwind-text := BUG
575
576 # setup DWARF post unwinder
577 ifdef NO_LIBUNWIND
578   ifdef NO_LIBDW_DWARF_UNWIND
579     msg := $(warning Disabling post unwind, no support found.);
580     dwarf-post-unwind := 0
581   else
582     dwarf-post-unwind-text := libdw
583     $(call detected,CONFIG_LIBDW_DWARF_UNWIND)
584   endif
585 else
586   dwarf-post-unwind-text := libunwind
587   $(call detected,CONFIG_LIBUNWIND)
588   # Enable libunwind support by default.
589   ifndef NO_LIBDW_DWARF_UNWIND
590     NO_LIBDW_DWARF_UNWIND := 1
591   endif
592 endif
593
594 ifeq ($(dwarf-post-unwind),1)
595   CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT
596   $(call detected,CONFIG_DWARF_UNWIND)
597 else
598   NO_DWARF_UNWIND := 1
599 endif
600
601 ifndef NO_LOCAL_LIBUNWIND
602   ifeq ($(SRCARCH),$(filter $(SRCARCH),arm arm64))
603     $(call feature_check,libunwind-debug-frame)
604     ifneq ($(feature-libunwind-debug-frame), 1)
605       msg := $(warning No debug_frame support found in libunwind);
606       CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
607     endif
608   else
609     # non-ARM has no dwarf_find_debug_frame() function:
610     CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
611   endif
612   EXTLIBS += $(LIBUNWIND_LIBS)
613   LDFLAGS += $(LIBUNWIND_LIBS)
614 endif
615 ifeq ($(findstring -static,${LDFLAGS}),-static)
616   # gcc -static links libgcc_eh which contans piece of libunwind
617   LIBUNWIND_LDFLAGS += -Wl,--allow-multiple-definition
618 endif
619
620 ifndef NO_LIBUNWIND
621   CFLAGS  += -DHAVE_LIBUNWIND_SUPPORT
622   CFLAGS  += $(LIBUNWIND_CFLAGS)
623   LDFLAGS += $(LIBUNWIND_LDFLAGS)
624   EXTLIBS += $(EXTLIBS_LIBUNWIND)
625 endif
626
627 ifeq ($(NO_SYSCALL_TABLE),0)
628   $(call detected,CONFIG_TRACE)
629 else
630   ifndef NO_LIBAUDIT
631     ifneq ($(feature-libaudit), 1)
632       msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
633       NO_LIBAUDIT := 1
634     else
635       CFLAGS += -DHAVE_LIBAUDIT_SUPPORT
636       EXTLIBS += -laudit
637       $(call detected,CONFIG_TRACE)
638     endif
639   endif
640 endif
641
642 ifndef NO_LIBCRYPTO
643   ifneq ($(feature-libcrypto), 1)
644     msg := $(warning No libcrypto.h found, disables jitted code injection, please install openssl-devel or libssl-dev);
645     NO_LIBCRYPTO := 1
646   else
647     CFLAGS += -DHAVE_LIBCRYPTO_SUPPORT
648     EXTLIBS += -lcrypto
649     $(call detected,CONFIG_CRYPTO)
650   endif
651 endif
652
653 ifdef NO_NEWT
654   NO_SLANG=1
655 endif
656
657 ifndef NO_SLANG
658   ifneq ($(feature-libslang), 1)
659     ifneq ($(feature-libslang-include-subdir), 1)
660       msg := $(warning slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev);
661       NO_SLANG := 1
662     else
663       CFLAGS += -DHAVE_SLANG_INCLUDE_SUBDIR
664     endif
665   endif
666   ifndef NO_SLANG
667     # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
668     CFLAGS += -DHAVE_SLANG_SUPPORT
669     EXTLIBS += -lslang
670     $(call detected,CONFIG_SLANG)
671   endif
672 endif
673
674 ifndef NO_GTK2
675   FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
676   ifneq ($(feature-gtk2), 1)
677     msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
678     NO_GTK2 := 1
679   else
680     ifeq ($(feature-gtk2-infobar), 1)
681       GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT
682     endif
683     CFLAGS += -DHAVE_GTK2_SUPPORT
684     GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-2.0 2>/dev/null)
685     GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0 2>/dev/null)
686     EXTLIBS += -ldl
687   endif
688 endif
689
690 ifdef NO_LIBPERL
691   CFLAGS += -DNO_LIBPERL
692 else
693   PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
694   PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
695   PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
696   PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null)
697   PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS))
698   PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
699   FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
700
701   ifneq ($(feature-libperl), 1)
702     CFLAGS += -DNO_LIBPERL
703     NO_LIBPERL := 1
704     msg := $(warning Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev);
705   else
706     LDFLAGS += $(PERL_EMBED_LDFLAGS)
707     EXTLIBS += $(PERL_EMBED_LIBADD)
708     CFLAGS += -DHAVE_LIBPERL_SUPPORT
709     ifeq ($(CC_NO_CLANG), 0)
710       CFLAGS += -Wno-compound-token-split-by-macro
711     endif
712     $(call detected,CONFIG_LIBPERL)
713   endif
714 endif
715
716 ifeq ($(feature-timerfd), 1)
717   CFLAGS += -DHAVE_TIMERFD_SUPPORT
718 else
719   msg := $(warning No timerfd support. Disables 'perf kvm stat live');
720 endif
721
722 disable-python = $(eval $(disable-python_code))
723 define disable-python_code
724   CFLAGS += -DNO_LIBPYTHON
725   $(warning $1)
726   NO_LIBPYTHON := 1
727 endef
728
729 ifdef NO_LIBPYTHON
730   $(call disable-python,Python support disabled by user)
731 else
732
733   ifndef PYTHON
734     $(call disable-python,No python interpreter was found: disables Python support - please install python-devel/python-dev)
735   else
736     PYTHON_WORD := $(call shell-wordify,$(PYTHON))
737
738     ifndef PYTHON_CONFIG
739       $(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev)
740     else
741
742       ifneq ($(feature-libpython), 1)
743         $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev)
744       else
745          LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
746          EXTLIBS += $(PYTHON_EMBED_LIBADD)
747          LANG_BINDINGS += $(obj-perf)python/perf.so
748          CFLAGS += -DHAVE_LIBPYTHON_SUPPORT
749          $(call detected,CONFIG_LIBPYTHON)
750       endif
751     endif
752   endif
753 endif
754
755 ifeq ($(feature-libbfd), 1)
756   EXTLIBS += -lbfd -lopcodes
757 else
758   # we are on a system that requires -liberty and (maybe) -lz
759   # to link against -lbfd; test each case individually here
760
761   # call all detections now so we get correct
762   # status in VF output
763   $(call feature_check,libbfd-liberty)
764   $(call feature_check,libbfd-liberty-z)
765
766   ifeq ($(feature-libbfd-liberty), 1)
767     EXTLIBS += -lbfd -lopcodes -liberty
768     FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl
769   else
770     ifeq ($(feature-libbfd-liberty-z), 1)
771       EXTLIBS += -lbfd -lopcodes -liberty -lz
772       FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl
773     endif
774   endif
775   $(call feature_check,disassembler-four-args)
776 endif
777
778 ifdef NO_DEMANGLE
779   CFLAGS += -DNO_DEMANGLE
780 else
781   ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
782     EXTLIBS += -liberty
783   else
784     ifeq ($(filter -liberty,$(EXTLIBS)),)
785       $(call feature_check,cplus-demangle)
786
787       # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
788       # or any of 'bfd iberty z' trinity
789       ifeq ($(feature-cplus-demangle), 1)
790         EXTLIBS += -liberty
791       else
792         msg := $(warning No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling)
793         CFLAGS += -DNO_DEMANGLE
794       endif
795     endif
796   endif
797
798   ifneq ($(filter -liberty,$(EXTLIBS)),)
799     CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
800   endif
801 endif
802
803 ifneq ($(filter -lbfd,$(EXTLIBS)),)
804   CFLAGS += -DHAVE_LIBBFD_SUPPORT
805 endif
806
807 ifndef NO_ZLIB
808   ifeq ($(feature-zlib), 1)
809     CFLAGS += -DHAVE_ZLIB_SUPPORT
810     EXTLIBS += -lz
811     $(call detected,CONFIG_ZLIB)
812   else
813     NO_ZLIB := 1
814   endif
815 endif
816
817 ifndef NO_LZMA
818   ifeq ($(feature-lzma), 1)
819     CFLAGS += -DHAVE_LZMA_SUPPORT
820     EXTLIBS += -llzma
821     $(call detected,CONFIG_LZMA)
822   else
823     msg := $(warning No liblzma found, disables xz kernel module decompression, please install xz-devel/liblzma-dev);
824     NO_LZMA := 1
825   endif
826 endif
827
828 ifndef NO_LIBZSTD
829   ifeq ($(feature-libzstd), 1)
830     CFLAGS += -DHAVE_ZSTD_SUPPORT
831     CFLAGS += $(LIBZSTD_CFLAGS)
832     LDFLAGS += $(LIBZSTD_LDFLAGS)
833     EXTLIBS += -lzstd
834     $(call detected,CONFIG_ZSTD)
835   else
836     msg := $(warning No libzstd found, disables trace compression, please install libzstd-dev[el] and/or set LIBZSTD_DIR);
837     NO_LIBZSTD := 1
838   endif
839 endif
840
841 ifndef NO_LIBCAP
842   ifeq ($(feature-libcap), 1)
843     CFLAGS += -DHAVE_LIBCAP_SUPPORT
844     EXTLIBS += -lcap
845     $(call detected,CONFIG_LIBCAP)
846   else
847     msg := $(warning No libcap found, disables capability support, please install libcap-devel/libcap-dev);
848     NO_LIBCAP := 1
849   endif
850 endif
851
852 ifndef NO_BACKTRACE
853   ifeq ($(feature-backtrace), 1)
854     CFLAGS += -DHAVE_BACKTRACE_SUPPORT
855   endif
856 endif
857
858 ifndef NO_LIBNUMA
859   ifeq ($(feature-libnuma), 0)
860     msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev);
861     NO_LIBNUMA := 1
862   else
863     ifeq ($(feature-numa_num_possible_cpus), 0)
864       msg := $(warning Old numa library found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev >= 2.0.8);
865       NO_LIBNUMA := 1
866     else
867       CFLAGS += -DHAVE_LIBNUMA_SUPPORT
868       EXTLIBS += -lnuma
869       $(call detected,CONFIG_NUMA)
870     endif
871   endif
872 endif
873
874 ifdef HAVE_KVM_STAT_SUPPORT
875     CFLAGS += -DHAVE_KVM_STAT_SUPPORT
876 endif
877
878 ifeq ($(feature-disassembler-four-args), 1)
879     CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
880 endif
881
882 ifeq (${IS_64_BIT}, 1)
883   ifndef NO_PERF_READ_VDSO32
884     $(call feature_check,compile-32)
885     ifeq ($(feature-compile-32), 1)
886       CFLAGS += -DHAVE_PERF_READ_VDSO32
887     else
888       NO_PERF_READ_VDSO32 := 1
889     endif
890   endif
891   ifneq ($(SRCARCH), x86)
892     NO_PERF_READ_VDSOX32 := 1
893   endif
894   ifndef NO_PERF_READ_VDSOX32
895     $(call feature_check,compile-x32)
896     ifeq ($(feature-compile-x32), 1)
897       CFLAGS += -DHAVE_PERF_READ_VDSOX32
898     else
899       NO_PERF_READ_VDSOX32 := 1
900     endif
901   endif
902 else
903   NO_PERF_READ_VDSO32 := 1
904   NO_PERF_READ_VDSOX32 := 1
905 endif
906
907 ifndef NO_LIBBABELTRACE
908   $(call feature_check,libbabeltrace)
909   ifeq ($(feature-libbabeltrace), 1)
910     CFLAGS += -DHAVE_LIBBABELTRACE_SUPPORT $(LIBBABELTRACE_CFLAGS)
911     LDFLAGS += $(LIBBABELTRACE_LDFLAGS)
912     EXTLIBS += -lbabeltrace-ctf
913     $(call detected,CONFIG_LIBBABELTRACE)
914   else
915     msg := $(warning No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev);
916   endif
917 endif
918
919 ifndef NO_AUXTRACE
920   ifeq ($(SRCARCH),x86)
921     ifeq ($(feature-get_cpuid), 0)
922       msg := $(warning Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc);
923       NO_AUXTRACE := 1
924     endif
925   endif
926   ifndef NO_AUXTRACE
927     $(call detected,CONFIG_AUXTRACE)
928     CFLAGS += -DHAVE_AUXTRACE_SUPPORT
929   endif
930 endif
931
932 ifndef NO_JVMTI
933   ifneq (,$(wildcard /usr/sbin/update-java-alternatives))
934     JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | awk '{print $$3}')
935   else
936     ifneq (,$(wildcard /usr/sbin/alternatives))
937       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')
938     endif
939   endif
940   ifndef JDIR
941     $(warning No alternatives command found, you need to set JDIR= to point to the root of your Java directory)
942     NO_JVMTI := 1
943   endif
944 endif
945
946 ifndef NO_JVMTI
947   FEATURE_CHECK_CFLAGS-jvmti := -I$(JDIR)/include -I$(JDIR)/include/linux
948   $(call feature_check,jvmti)
949   ifeq ($(feature-jvmti), 1)
950     $(call detected_var,JDIR)
951     ifndef NO_JVMTI_CMLR
952       FEATURE_CHECK_CFLAGS-jvmti-cmlr := $(FEATURE_CHECK_CFLAGS-jvmti)
953       $(call feature_check,jvmti-cmlr)
954       ifeq ($(feature-jvmti-cmlr), 1)
955         CFLAGS += -DHAVE_JVMTI_CMLR
956       endif
957     endif # NO_JVMTI_CMLR
958   else
959     $(warning No openjdk development package found, please install JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel)
960     NO_JVMTI := 1
961   endif
962 endif
963
964 USE_CXX = 0
965 USE_CLANGLLVM = 0
966 ifdef LIBCLANGLLVM
967   $(call feature_check,cxx)
968   ifneq ($(feature-cxx), 1)
969     msg := $(warning No g++ found, disable clang and llvm support. Please install g++)
970   else
971     $(call feature_check,llvm)
972     $(call feature_check,llvm-version)
973     ifneq ($(feature-llvm), 1)
974       msg := $(warning No suitable libLLVM found, disabling builtin clang and LLVM support. Please install llvm-dev(el) (>= 3.9.0))
975     else
976       $(call feature_check,clang)
977       ifneq ($(feature-clang), 1)
978         msg := $(warning No suitable libclang found, disabling builtin clang and LLVM support. Please install libclang-dev(el) (>= 3.9.0))
979       else
980         CFLAGS += -DHAVE_LIBCLANGLLVM_SUPPORT
981         CXXFLAGS += -DHAVE_LIBCLANGLLVM_SUPPORT -I$(shell $(LLVM_CONFIG) --includedir)
982         $(call detected,CONFIG_CXX)
983         $(call detected,CONFIG_CLANGLLVM)
984         USE_CXX = 1
985         USE_LLVM = 1
986         USE_CLANG = 1
987         ifneq ($(feature-llvm-version),1)
988           msg := $(warning This version of LLVM is not tested. May cause build errors)
989         endif
990       endif
991     endif
992   endif
993 endif
994
995 # Among the variables below, these:
996 #   perfexecdir
997 #   perf_include_dir
998 #   perf_examples_dir
999 #   template_dir
1000 #   mandir
1001 #   infodir
1002 #   htmldir
1003 #   ETC_PERFCONFIG (but not sysconfdir)
1004 # can be specified as a relative path some/where/else;
1005 # this is interpreted as relative to $(prefix) and "perf" at
1006 # runtime figures out where they are based on the path to the executable.
1007 # This can help installing the suite in a relocatable way.
1008
1009 # Make the path relative to DESTDIR, not to prefix
1010 ifndef DESTDIR
1011 prefix ?= $(HOME)
1012 endif
1013 bindir_relative = bin
1014 bindir = $(abspath $(prefix)/$(bindir_relative))
1015 mandir = share/man
1016 infodir = share/info
1017 perfexecdir = libexec/perf-core
1018 perf_include_dir = lib/perf/include
1019 perf_examples_dir = lib/perf/examples
1020 sharedir = $(prefix)/share
1021 template_dir = share/perf-core/templates
1022 STRACE_GROUPS_DIR = share/perf-core/strace/groups
1023 htmldir = share/doc/perf-doc
1024 tipdir = share/doc/perf-tip
1025 srcdir = $(srctree)/tools/perf
1026 ifeq ($(prefix),/usr)
1027 sysconfdir = /etc
1028 ETC_PERFCONFIG = $(sysconfdir)/perfconfig
1029 else
1030 sysconfdir = $(prefix)/etc
1031 ETC_PERFCONFIG = etc/perfconfig
1032 endif
1033 ifndef lib
1034 ifeq ($(SRCARCH)$(IS_64_BIT), x861)
1035 lib = lib64
1036 else
1037 lib = lib
1038 endif
1039 endif # lib
1040 libdir = $(prefix)/$(lib)
1041
1042 # Shell quote (do not use $(call) to accommodate ancient setups);
1043 ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG))
1044 STRACE_GROUPS_DIR_SQ = $(subst ','\'',$(STRACE_GROUPS_DIR))
1045 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
1046 bindir_SQ = $(subst ','\'',$(bindir))
1047 mandir_SQ = $(subst ','\'',$(mandir))
1048 infodir_SQ = $(subst ','\'',$(infodir))
1049 perfexecdir_SQ = $(subst ','\'',$(perfexecdir))
1050 perf_include_dir_SQ = $(subst ','\'',$(perf_include_dir))
1051 perf_examples_dir_SQ = $(subst ','\'',$(perf_examples_dir))
1052 template_dir_SQ = $(subst ','\'',$(template_dir))
1053 htmldir_SQ = $(subst ','\'',$(htmldir))
1054 tipdir_SQ = $(subst ','\'',$(tipdir))
1055 prefix_SQ = $(subst ','\'',$(prefix))
1056 sysconfdir_SQ = $(subst ','\'',$(sysconfdir))
1057 libdir_SQ = $(subst ','\'',$(libdir))
1058 srcdir_SQ = $(subst ','\'',$(srcdir))
1059
1060 ifneq ($(filter /%,$(firstword $(perfexecdir))),)
1061 perfexec_instdir = $(perfexecdir)
1062 perf_include_instdir = $(perf_include_dir)
1063 perf_examples_instdir = $(perf_examples_dir)
1064 STRACE_GROUPS_INSTDIR = $(STRACE_GROUPS_DIR)
1065 tip_instdir = $(tipdir)
1066 else
1067 perfexec_instdir = $(prefix)/$(perfexecdir)
1068 perf_include_instdir = $(prefix)/$(perf_include_dir)
1069 perf_examples_instdir = $(prefix)/$(perf_examples_dir)
1070 STRACE_GROUPS_INSTDIR = $(prefix)/$(STRACE_GROUPS_DIR)
1071 tip_instdir = $(prefix)/$(tipdir)
1072 endif
1073 perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir))
1074 perf_include_instdir_SQ = $(subst ','\'',$(perf_include_instdir))
1075 perf_examples_instdir_SQ = $(subst ','\'',$(perf_examples_instdir))
1076 STRACE_GROUPS_INSTDIR_SQ = $(subst ','\'',$(STRACE_GROUPS_INSTDIR))
1077 tip_instdir_SQ = $(subst ','\'',$(tip_instdir))
1078
1079 # If we install to $(HOME) we keep the traceevent default:
1080 # $(HOME)/.traceevent/plugins
1081 # Otherwise we install plugins into the global $(libdir).
1082 ifdef DESTDIR
1083 plugindir=$(libdir)/traceevent/plugins
1084 plugindir_SQ= $(subst ','\'',$(plugindir))
1085 endif
1086
1087 print_var = $(eval $(print_var_code)) $(info $(MSG))
1088 define print_var_code
1089     MSG = $(shell printf '...%30s: %s' $(1) $($(1)))
1090 endef
1091
1092 ifeq ($(VF),1)
1093   # Display EXTRA features which are detected manualy
1094   # from here with feature_check call and thus cannot
1095   # be partof global state output.
1096   $(foreach feat,$(FEATURE_TESTS_EXTRA),$(call feature_print_status,$(feat),))
1097   $(call print_var,prefix)
1098   $(call print_var,bindir)
1099   $(call print_var,libdir)
1100   $(call print_var,sysconfdir)
1101   $(call print_var,LIBUNWIND_DIR)
1102   $(call print_var,LIBDW_DIR)
1103   $(call print_var,JDIR)
1104
1105   ifeq ($(dwarf-post-unwind),1)
1106     $(call feature_print_text,"DWARF post unwind library", $(dwarf-post-unwind-text))
1107   endif
1108   $(info )
1109 endif
1110
1111 $(call detected_var,bindir_SQ)
1112 $(call detected_var,PYTHON_WORD)
1113 ifneq ($(OUTPUT),)
1114 $(call detected_var,OUTPUT)
1115 endif
1116 $(call detected_var,htmldir_SQ)
1117 $(call detected_var,infodir_SQ)
1118 $(call detected_var,mandir_SQ)
1119 $(call detected_var,ETC_PERFCONFIG_SQ)
1120 $(call detected_var,STRACE_GROUPS_DIR_SQ)
1121 $(call detected_var,prefix_SQ)
1122 $(call detected_var,perfexecdir_SQ)
1123 $(call detected_var,perf_include_dir_SQ)
1124 $(call detected_var,perf_examples_dir_SQ)
1125 $(call detected_var,tipdir_SQ)
1126 $(call detected_var,srcdir_SQ)
1127 $(call detected_var,LIBDIR)
1128 $(call detected_var,GTK_CFLAGS)
1129 $(call detected_var,PERL_EMBED_CCOPTS)
1130 $(call detected_var,PYTHON_EMBED_CCOPTS)