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