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