Commit 7be6b3166ebf2c10c28ef5777d1b31a937ed8f7a
Committed by
Arnaldo Carvalho de Melo
1 parent
a8d11cd071
Exists in
smarc_imx_lf-5.15.y
and in
20 other branches
perf tools: Pass PYTHON config to feature detection
( This is a rebased version of https://lkml.org/lkml/2017/2/7/662 ) Python's CC and link Makefile variables were not passed to feature detection, causing feature detection to use system's Python rather than PYTHON_CONFIG's one. This created a mismatch between the detected Python support and the one actually used by perf when PYTHON_CONFIG is specified. Fix it by moving Python's variable initialization to before feature detection and pass FLAGS_PYTHON_EMBED to Python's feature detection's build target. Signed-off-by: David Carrillo-Cisneros <davidcc@google.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: He Kuang <hekuang@huawei.com> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Paul Turner <pjt@google.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Simon Que <sque@chromium.org> Cc: Stephane Eranian <eranian@google.com> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/r/20170412064919.92449-2-davidcc@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Showing 2 changed files with 13 additions and 20 deletions Side-by-side Diff
tools/build/feature/Makefile
tools/perf/Makefile.config
... | ... | @@ -170,13 +170,20 @@ |
170 | 170 | override PYTHON_CONFIG := \ |
171 | 171 | $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG)) |
172 | 172 | |
173 | +grep-libs = $(filter -l%,$(1)) | |
174 | +strip-libs = $(filter-out -l%,$(1)) | |
175 | + | |
173 | 176 | PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG)) |
174 | 177 | |
175 | -PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) | |
176 | -PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) | |
177 | - | |
178 | -ifeq ($(CC), clang) | |
179 | - PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS)) | |
178 | +ifdef PYTHON_CONFIG | |
179 | + PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) | |
180 | + PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) | |
181 | + PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil | |
182 | + PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) | |
183 | + ifeq ($(CC), clang) | |
184 | + PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS)) | |
185 | + endif | |
186 | + FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) | |
180 | 187 | endif |
181 | 188 | |
182 | 189 | FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS) |
... | ... | @@ -554,8 +561,6 @@ |
554 | 561 | endif |
555 | 562 | endif |
556 | 563 | |
557 | -grep-libs = $(filter -l%,$(1)) | |
558 | -strip-libs = $(filter-out -l%,$(1)) | |
559 | 564 | |
560 | 565 | ifdef NO_LIBPERL |
561 | 566 | CFLAGS += -DNO_LIBPERL |
562 | 567 | |
... | ... | @@ -603,21 +608,9 @@ |
603 | 608 | $(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev) |
604 | 609 | else |
605 | 610 | |
606 | - PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG)) | |
607 | - | |
608 | - PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) | |
609 | - PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) | |
610 | - PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil | |
611 | - PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) | |
612 | - ifeq ($(CC), clang) | |
613 | - PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS)) | |
614 | - endif | |
615 | - FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) | |
616 | - | |
617 | 611 | ifneq ($(feature-libpython), 1) |
618 | 612 | $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev) |
619 | 613 | else |
620 | - | |
621 | 614 | ifneq ($(feature-libpython-version), 1) |
622 | 615 | $(warning Python 3 is not yet supported; please set) |
623 | 616 | $(warning PYTHON and/or PYTHON_CONFIG appropriately.) |