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