~ubuntu-branches/debian/experimental/linux-tools/experimental

« back to all changes in this revision

Viewing changes to tools/perf/config/Makefile

  • Committer: Package Import Robot
  • Author(s): Ben Hutchings
  • Date: 2014-02-02 16:57:49 UTC
  • mfrom: (1.1.10) (0.1.21 sid)
  • Revision ID: package-import@ubuntu.com-20140202165749-tw94o9t1t0a8txk6
Tags: 3.13-1~exp2
Merge changes from sid up to 3.12.6-3

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
  endif
24
24
  ifeq (${IS_X86_64}, 1)
25
25
    RAW_ARCH := x86_64
26
 
    CFLAGS += -DARCH_X86_64
 
26
    CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT
27
27
    ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
 
28
    LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
 
29
  else
 
30
    LIBUNWIND_LIBS = -lunwind -lunwind-x86
28
31
  endif
29
32
  NO_PERF_REGS := 0
30
 
  LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
 
33
endif
 
34
ifeq ($(ARCH),arm)
 
35
  NO_PERF_REGS := 0
 
36
  LIBUNWIND_LIBS = -lunwind -lunwind-arm
31
37
endif
32
38
 
33
39
ifeq ($(NO_PERF_REGS),0)
34
 
  CFLAGS += -DHAVE_PERF_REGS
 
40
  CFLAGS += -DHAVE_PERF_REGS_SUPPORT
35
41
endif
36
42
 
37
43
ifeq ($(src-perf),)
51
57
# include ARCH specific config
52
58
-include $(src-perf)/arch/$(ARCH)/Makefile
53
59
 
54
 
include $(src-perf)/config/feature-tests.mak
55
60
include $(src-perf)/config/utilities.mak
56
61
 
57
62
ifeq ($(call get-executable,$(FLEX)),)
67
72
  CFLAGS += -Werror
68
73
endif
69
74
 
70
 
ifeq ("$(origin DEBUG)", "command line")
71
 
  PERF_DEBUG = $(DEBUG)
 
75
ifndef DEBUG
 
76
  DEBUG := 0
72
77
endif
73
 
ifndef PERF_DEBUG
 
78
 
 
79
ifeq ($(DEBUG),0)
74
80
  CFLAGS += -O6
75
81
endif
76
82
 
89
95
 
90
96
EXTLIBS = -lelf -lpthread -lrt -lm -ldl
91
97
 
92
 
ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y)
 
98
ifneq ($(OUTPUT),)
 
99
  OUTPUT_FEATURES = $(OUTPUT)config/feature-checks/
 
100
  $(shell mkdir -p $(OUTPUT_FEATURES))
 
101
endif
 
102
 
 
103
feature_check = $(eval $(feature_check_code))
 
104
define feature_check_code
 
105
  feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBUNWIND_LIBS="$(LIBUNWIND_LIBS)" -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0)
 
106
endef
 
107
 
 
108
feature_set = $(eval $(feature_set_code))
 
109
define feature_set_code
 
110
  feature-$(1) := 1
 
111
endef
 
112
 
 
113
#
 
114
# Build the feature check binaries in parallel, ignore errors, ignore return value and suppress output:
 
115
#
 
116
 
 
117
#
 
118
# Note that this is not a complete list of all feature tests, just
 
119
# those that are typically built on a fully configured system.
 
120
#
 
121
# [ Feature tests not mentioned here have to be built explicitly in
 
122
#   the rule that uses them - an example for that is the 'bionic'
 
123
#   feature check. ]
 
124
#
 
125
CORE_FEATURE_TESTS =                    \
 
126
        backtrace                       \
 
127
        dwarf                           \
 
128
        fortify-source                  \
 
129
        glibc                           \
 
130
        gtk2                            \
 
131
        gtk2-infobar                    \
 
132
        libaudit                        \
 
133
        libbfd                          \
 
134
        libelf                          \
 
135
        libelf-getphdrnum               \
 
136
        libelf-mmap                     \
 
137
        libnuma                         \
 
138
        libperl                         \
 
139
        libpython                       \
 
140
        libpython-version               \
 
141
        libslang                        \
 
142
        libunwind                       \
 
143
        on-exit                         \
 
144
        stackprotector                  \
 
145
        stackprotector-all              \
 
146
        timerfd
 
147
 
 
148
#
 
149
# So here we detect whether test-all was rebuilt, to be able
 
150
# to skip the print-out of the long features list if the file
 
151
# existed before and after it was built:
 
152
#
 
153
ifeq ($(wildcard $(OUTPUT)config/feature-checks/test-all),)
 
154
  test-all-failed := 1
 
155
else
 
156
  test-all-failed := 0
 
157
endif
 
158
 
 
159
#
 
160
# Special fast-path for the 'all features are available' case:
 
161
#
 
162
$(call feature_check,all,$(MSG))
 
163
 
 
164
#
 
165
# Just in case the build freshly failed, make sure we print the
 
166
# feature matrix:
 
167
#
 
168
ifeq ($(feature-all), 0)
 
169
  test-all-failed := 1
 
170
endif
 
171
 
 
172
ifeq ($(test-all-failed),1)
 
173
  $(info )
 
174
  $(info Auto-detecting system features:)
 
175
endif
 
176
 
 
177
ifeq ($(feature-all), 1)
 
178
  #
 
179
  # test-all.c passed - just set all the core feature flags to 1:
 
180
  #
 
181
  $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_set,$(feat)))
 
182
else
 
183
  $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(CORE_FEATURE_TESTS) >/dev/null 2>&1)
 
184
  $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat)))
 
185
endif
 
186
 
 
187
#
 
188
# Print the result of the feature test:
 
189
#
 
190
feature_print = $(eval $(feature_print_code)) $(info $(MSG))
 
191
 
 
192
define feature_print_code
 
193
  ifeq ($(feature-$(1)), 1)
 
194
    MSG = $(shell printf '...%30s: [ \033[32mon\033[m  ]' $(1))
 
195
  else
 
196
    MSG = $(shell printf '...%30s: [ \033[31mOFF\033[m ]' $(1))
 
197
  endif
 
198
endef
 
199
 
 
200
#
 
201
# Only print out our features if we rebuilt the testcases or if a test failed:
 
202
#
 
203
ifeq ($(test-all-failed), 1)
 
204
  $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_print,$(feat)))
 
205
  $(info )
 
206
endif
 
207
 
 
208
ifeq ($(feature-stackprotector-all), 1)
93
209
  CFLAGS += -fstack-protector-all
94
210
endif
95
211
 
96
 
ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wstack-protector,-Wstack-protector),y)
 
212
ifeq ($(feature-stackprotector), 1)
97
213
  CFLAGS += -Wstack-protector
98
214
endif
99
215
 
100
 
ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wvolatile-register-var,-Wvolatile-register-var),y)
101
 
  CFLAGS += -Wvolatile-register-var
102
 
endif
103
 
 
104
 
ifndef PERF_DEBUG
105
 
  ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -D_FORTIFY_SOURCE=2,-D_FORTIFY_SOURCE=2),y)
 
216
ifeq ($(DEBUG),0)
 
217
  ifeq ($(feature-fortify-source), 1)
106
218
    CFLAGS += -D_FORTIFY_SOURCE=2
107
219
  endif
108
220
endif
128
240
CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
129
241
 
130
242
ifndef NO_BIONIC
131
 
ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
132
 
  BIONIC := 1
133
 
  EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
134
 
  EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
 
243
  $(call feature_check,bionic)
 
244
  ifeq ($(feature-bionic), 1)
 
245
    BIONIC := 1
 
246
    EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
 
247
    EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
 
248
  endif
135
249
endif
136
 
endif # NO_BIONIC
137
250
 
138
251
ifdef NO_LIBELF
139
252
  NO_DWARF := 1
140
253
  NO_DEMANGLE := 1
141
254
  NO_LIBUNWIND := 1
142
255
else
143
 
FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS)
144
 
ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y)
145
 
  FLAGS_GLIBC=$(CFLAGS) $(LDFLAGS)
146
 
  ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y)
147
 
    LIBC_SUPPORT := 1
148
 
  endif
149
 
  ifeq ($(BIONIC),1)
150
 
    LIBC_SUPPORT := 1
151
 
  endif
152
 
  ifeq ($(LIBC_SUPPORT),1)
153
 
    msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev);
154
 
 
155
 
    NO_LIBELF := 1
156
 
    NO_DWARF := 1
157
 
    NO_DEMANGLE := 1
158
 
  else
159
 
    msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
160
 
  endif
161
 
else
162
 
  # for linking with debug library, run like:
163
 
  # make DEBUG=1 LIBDW_DIR=/opt/libdw/
164
 
  ifdef LIBDW_DIR
165
 
    LIBDW_CFLAGS  := -I$(LIBDW_DIR)/include
166
 
    LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
167
 
  endif
168
 
 
169
 
  FLAGS_DWARF=$(CFLAGS) $(LIBDW_CFLAGS) -ldw -lz -lelf $(LIBDW_LDFLAGS) $(LDFLAGS) $(EXTLIBS)
170
 
  ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y)
171
 
    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);
172
 
    NO_DWARF := 1
173
 
  endif # Dwarf support
174
 
endif # SOURCE_LIBELF
175
 
endif # NO_LIBELF
176
 
 
177
 
ifndef NO_LIBELF
178
 
CFLAGS += -DLIBELF_SUPPORT
179
 
FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS)
180
 
ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
181
 
  CFLAGS += -DLIBELF_MMAP
182
 
endif
183
 
ifeq ($(call try-cc,$(SOURCE_ELF_GETPHDRNUM),$(FLAGS_LIBELF),-DHAVE_ELF_GETPHDRNUM),y)
184
 
  CFLAGS += -DHAVE_ELF_GETPHDRNUM
185
 
endif
186
 
 
187
 
# include ARCH specific config
188
 
-include $(src-perf)/arch/$(ARCH)/Makefile
189
 
 
190
 
ifndef NO_DWARF
191
 
ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
192
 
  msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
193
 
  NO_DWARF := 1
194
 
else
195
 
  CFLAGS += -DDWARF_SUPPORT $(LIBDW_CFLAGS)
196
 
  LDFLAGS += $(LIBDW_LDFLAGS)
197
 
  EXTLIBS += -lelf -ldw
198
 
endif # PERF_HAVE_DWARF_REGS
199
 
endif # NO_DWARF
200
 
 
201
 
endif # NO_LIBELF
202
 
 
203
 
ifndef NO_LIBELF
204
 
CFLAGS += -DLIBELF_SUPPORT
205
 
FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS)
206
 
ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
207
 
  CFLAGS += -DLIBELF_MMAP
208
 
endif # try-cc
209
 
endif # NO_LIBELF
210
 
 
211
 
# There's only x86 (both 32 and 64) support for CFI unwind so far
212
 
ifneq ($(ARCH),x86)
213
 
  NO_LIBUNWIND := 1
214
 
endif
215
 
 
216
 
ifndef NO_LIBUNWIND
217
 
# for linking with debug library, run like:
218
 
# make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
219
 
ifdef LIBUNWIND_DIR
220
 
  LIBUNWIND_CFLAGS  := -I$(LIBUNWIND_DIR)/include
221
 
  LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib
222
 
endif
223
 
 
224
 
FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(CFLAGS) $(LIBUNWIND_LDFLAGS) $(LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS)
225
 
ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y)
226
 
  msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99);
227
 
  NO_LIBUNWIND := 1
228
 
endif # Libunwind support
229
 
endif # NO_LIBUNWIND
230
 
 
231
 
ifndef NO_LIBUNWIND
232
 
  CFLAGS += -DLIBUNWIND_SUPPORT
 
256
  ifeq ($(feature-libelf), 0)
 
257
    ifeq ($(feature-glibc), 1)
 
258
      LIBC_SUPPORT := 1
 
259
    endif
 
260
    ifeq ($(BIONIC),1)
 
261
      LIBC_SUPPORT := 1
 
262
    endif
 
263
    ifeq ($(LIBC_SUPPORT),1)
 
264
      msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev);
 
265
 
 
266
      NO_LIBELF := 1
 
267
      NO_DWARF := 1
 
268
      NO_DEMANGLE := 1
 
269
    else
 
270
      msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
 
271
    endif
 
272
  else
 
273
    # for linking with debug library, run like:
 
274
    # make DEBUG=1 LIBDW_DIR=/opt/libdw/
 
275
    ifdef LIBDW_DIR
 
276
      LIBDW_CFLAGS  := -I$(LIBDW_DIR)/include
 
277
      LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
 
278
    endif
 
279
 
 
280
    ifneq ($(feature-dwarf), 1)
 
281
      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);
 
282
      NO_DWARF := 1
 
283
    endif # Dwarf support
 
284
  endif # libelf support
 
285
endif # NO_LIBELF
 
286
 
 
287
ifndef NO_LIBELF
 
288
  CFLAGS += -DHAVE_LIBELF_SUPPORT
 
289
 
 
290
  ifeq ($(feature-libelf-mmap), 1)
 
291
    CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT
 
292
  endif
 
293
 
 
294
  ifeq ($(feature-libelf-getphdrnum), 1)
 
295
    CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT
 
296
  endif
 
297
 
 
298
  # include ARCH specific config
 
299
  -include $(src-perf)/arch/$(ARCH)/Makefile
 
300
 
 
301
  ifndef NO_DWARF
 
302
    ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
 
303
      msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
 
304
      NO_DWARF := 1
 
305
    else
 
306
      CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
 
307
      LDFLAGS += $(LIBDW_LDFLAGS)
 
308
      EXTLIBS += -lelf -ldw
 
309
    endif # PERF_HAVE_DWARF_REGS
 
310
  endif # NO_DWARF
 
311
endif # NO_LIBELF
 
312
 
 
313
ifeq ($(LIBUNWIND_LIBS),)
 
314
  NO_LIBUNWIND := 1
 
315
endif
 
316
 
 
317
ifndef NO_LIBUNWIND
 
318
  #
 
319
  # For linking with debug library, run like:
 
320
  #
 
321
  #   make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
 
322
  #
 
323
  ifdef LIBUNWIND_DIR
 
324
    LIBUNWIND_CFLAGS  := -I$(LIBUNWIND_DIR)/include
 
325
    LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib
 
326
  endif
 
327
 
 
328
  ifneq ($(feature-libunwind), 1)
 
329
    msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 1.1);
 
330
    NO_LIBUNWIND := 1
 
331
  else
 
332
    ifeq ($(ARCH),arm)
 
333
      $(call feature_check,libunwind-debug-frame)
 
334
      ifneq ($(feature-libunwind-debug-frame), 1)
 
335
        msg := $(warning No debug_frame support found in libunwind);
 
336
        CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
 
337
      endif
 
338
    else
 
339
      # non-ARM has no dwarf_find_debug_frame() function:
 
340
      CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
 
341
    endif
 
342
  endif
 
343
endif
 
344
 
 
345
ifndef NO_LIBUNWIND
 
346
  CFLAGS += -DHAVE_LIBUNWIND_SUPPORT
233
347
  EXTLIBS += $(LIBUNWIND_LIBS)
234
348
  CFLAGS += $(LIBUNWIND_CFLAGS)
235
349
  LDFLAGS += $(LIBUNWIND_LDFLAGS)
236
 
endif # NO_LIBUNWIND
 
350
endif
237
351
 
238
352
ifndef NO_LIBAUDIT
239
 
  FLAGS_LIBAUDIT = $(CFLAGS) $(LDFLAGS) -laudit
240
 
  ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT),libaudit),y)
 
353
  ifneq ($(feature-libaudit), 1)
241
354
    msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
242
355
    NO_LIBAUDIT := 1
243
356
  else
244
 
    CFLAGS += -DLIBAUDIT_SUPPORT
 
357
    CFLAGS += -DHAVE_LIBAUDIT_SUPPORT
245
358
    EXTLIBS += -laudit
246
359
  endif
247
360
endif
251
364
endif
252
365
 
253
366
ifndef NO_SLANG
254
 
  FLAGS_SLANG=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -I/usr/include/slang -lslang
255
 
  ifneq ($(call try-cc,$(SOURCE_SLANG),$(FLAGS_SLANG),libslang),y)
 
367
  ifneq ($(feature-libslang), 1)
256
368
    msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev);
257
369
    NO_SLANG := 1
258
370
  else
259
371
    # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
260
372
    CFLAGS += -I/usr/include/slang
261
 
    CFLAGS += -DSLANG_SUPPORT
 
373
    CFLAGS += -DHAVE_SLANG_SUPPORT
262
374
    EXTLIBS += -lslang
263
375
  endif
264
376
endif
265
377
 
266
378
ifndef NO_GTK2
267
379
  FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
268
 
  ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2),gtk2),y)
 
380
  ifneq ($(feature-gtk2), 1)
269
381
    msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
270
382
    NO_GTK2 := 1
271
383
  else
272
 
    ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2),-DHAVE_GTK_INFO_BAR),y)
273
 
      CFLAGS += -DHAVE_GTK_INFO_BAR
 
384
    ifeq ($(feature-gtk2-infobar), 1)
 
385
      GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT
274
386
    endif
275
 
    CFLAGS += -DGTK2_SUPPORT
276
 
    CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null)
277
 
    EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null)
 
387
    CFLAGS += -DHAVE_GTK2_SUPPORT
 
388
    GTK_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null)
 
389
    GTK_LIBS := $(shell pkg-config --libs gtk+-2.0 2>/dev/null)
 
390
    EXTLIBS += -ldl
278
391
  endif
279
392
endif
280
393
 
290
403
  PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
291
404
  FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
292
405
 
293
 
  ifneq ($(call try-cc,$(SOURCE_PERL_EMBED),$(FLAGS_PERL_EMBED),perl),y)
 
406
  ifneq ($(feature-libperl), 1)
294
407
    CFLAGS += -DNO_LIBPERL
295
408
    NO_LIBPERL := 1
296
409
  else
299
412
  endif
300
413
endif
301
414
 
 
415
ifeq ($(feature-timerfd), 1)
 
416
  CFLAGS += -DHAVE_TIMERFD_SUPPORT
 
417
else
 
418
  msg := $(warning No timerfd support. Disables 'perf kvm stat live');
 
419
endif
 
420
 
302
421
disable-python = $(eval $(disable-python_code))
303
422
define disable-python_code
304
423
  CFLAGS += -DNO_LIBPYTHON
335
454
      PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
336
455
      FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
337
456
 
338
 
      ifneq ($(call try-cc,$(SOURCE_PYTHON_EMBED),$(FLAGS_PYTHON_EMBED),python),y)
 
457
      ifneq ($(feature-libpython), 1)
339
458
        $(call disable-python,Python.h (for Python 2.x))
340
459
      else
341
460
 
342
 
        ifneq ($(call try-cc,$(SOURCE_PYTHON_VERSION),$(FLAGS_PYTHON_EMBED),python version),y)
 
461
        ifneq ($(feature-libpython-version), 1)
343
462
          $(warning Python 3 is not yet supported; please set)
344
463
          $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
345
464
          $(warning If you also have Python 2 installed, then)
362
481
  endif
363
482
endif
364
483
 
 
484
ifeq ($(feature-libbfd), 1)
 
485
  EXTLIBS += -lbfd
 
486
endif
 
487
 
365
488
ifdef NO_DEMANGLE
366
489
  CFLAGS += -DNO_DEMANGLE
367
490
else
368
 
  ifdef HAVE_CPLUS_DEMANGLE
 
491
  ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
369
492
    EXTLIBS += -liberty
370
 
    CFLAGS += -DHAVE_CPLUS_DEMANGLE
 
493
    CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
371
494
  else
372
 
    FLAGS_BFD=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd
373
 
    has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd)
374
 
    ifeq ($(has_bfd),y)
375
 
      EXTLIBS += -lbfd
376
 
    else
377
 
      FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty
378
 
      has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY),liberty)
379
 
      ifeq ($(has_bfd_iberty),y)
 
495
    ifneq ($(feature-libbfd), 1)
 
496
      $(call feature_check,liberty)
 
497
      ifeq ($(feature-liberty), 1)
380
498
        EXTLIBS += -lbfd -liberty
381
499
      else
382
 
        FLAGS_BFD_IBERTY_Z=$(FLAGS_BFD_IBERTY) -lz
383
 
        has_bfd_iberty_z := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY_Z),libz)
384
 
        ifeq ($(has_bfd_iberty_z),y)
 
500
        $(call feature_check,liberty-z)
 
501
        ifeq ($(feature-liberty-z), 1)
385
502
          EXTLIBS += -lbfd -liberty -lz
386
503
        else
387
 
          FLAGS_CPLUS_DEMANGLE=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -liberty
388
 
          has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE),demangle)
389
 
          ifeq ($(has_cplus_demangle),y)
 
504
          $(call feature_check,cplus-demangle)
 
505
          ifeq ($(feature-cplus-demangle), 1)
390
506
            EXTLIBS += -liberty
391
 
            CFLAGS += -DHAVE_CPLUS_DEMANGLE
 
507
            CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
392
508
          else
393
509
            msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling)
394
510
            CFLAGS += -DNO_DEMANGLE
399
515
  endif
400
516
endif
401
517
 
402
 
ifndef NO_STRLCPY
403
 
  ifeq ($(call try-cc,$(SOURCE_STRLCPY),,-DHAVE_STRLCPY),y)
404
 
    CFLAGS += -DHAVE_STRLCPY
405
 
  endif
 
518
ifneq ($(filter -lbfd,$(EXTLIBS)),)
 
519
  CFLAGS += -DHAVE_LIBBFD_SUPPORT
406
520
endif
407
521
 
408
522
ifndef NO_ON_EXIT
409
 
  ifeq ($(call try-cc,$(SOURCE_ON_EXIT),,-DHAVE_ON_EXIT),y)
410
 
    CFLAGS += -DHAVE_ON_EXIT
 
523
  ifeq ($(feature-on-exit), 1)
 
524
    CFLAGS += -DHAVE_ON_EXIT_SUPPORT
411
525
  endif
412
526
endif
413
527
 
414
528
ifndef NO_BACKTRACE
415
 
  ifeq ($(call try-cc,$(SOURCE_BACKTRACE),,-DBACKTRACE_SUPPORT),y)
416
 
    CFLAGS += -DBACKTRACE_SUPPORT
 
529
  ifeq ($(feature-backtrace), 1)
 
530
    CFLAGS += -DHAVE_BACKTRACE_SUPPORT
417
531
  endif
418
532
endif
419
533
 
420
534
ifndef NO_LIBNUMA
421
 
  FLAGS_LIBNUMA = $(CFLAGS) $(LDFLAGS) -lnuma
422
 
  ifneq ($(call try-cc,$(SOURCE_LIBNUMA),$(FLAGS_LIBNUMA),libnuma),y)
 
535
  ifeq ($(feature-libnuma), 0)
423
536
    msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev);
424
537
    NO_LIBNUMA := 1
425
538
  else
426
 
    CFLAGS += -DLIBNUMA_SUPPORT
 
539
    CFLAGS += -DHAVE_LIBNUMA_SUPPORT
427
540
    EXTLIBS += -lnuma
428
541
  endif
429
542
endif
459
572
sysconfdir = $(prefix)/etc
460
573
ETC_PERFCONFIG = etc/perfconfig
461
574
endif
 
575
ifeq ($(IS_X86_64),1)
 
576
lib = lib64
 
577
else
462
578
lib = lib
 
579
endif
 
580
libdir = $(prefix)/$(lib)
463
581
 
464
582
# Shell quote (do not use $(call) to accommodate ancient setups);
465
583
ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG))
472
590
htmldir_SQ = $(subst ','\'',$(htmldir))
473
591
prefix_SQ = $(subst ','\'',$(prefix))
474
592
sysconfdir_SQ = $(subst ','\'',$(sysconfdir))
 
593
libdir_SQ = $(subst ','\'',$(libdir))
475
594
 
476
595
ifneq ($(filter /%,$(firstword $(perfexecdir))),)
477
596
perfexec_instdir = $(perfexecdir)