diff options
author | David Carrillo-Cisneros <davidcc@google.com> | 2017-04-12 02:49:13 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-04-12 09:45:21 -0400 |
commit | 7be6b3166ebf2c10c28ef5777d1b31a937ed8f7a (patch) | |
tree | b3a28f4c0efdd48249203af29ea57ad76e7d4bce /tools | |
parent | a8d11cd0714f51877587f5ec891013ca46e163ac (diff) |
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>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/build/feature/Makefile | 2 | ||||
-rw-r--r-- | tools/perf/Makefile.config | 31 |
2 files changed, 13 insertions, 20 deletions
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index 09c9626ea666..523e587fe05f 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile | |||
@@ -175,7 +175,7 @@ $(OUTPUT)test-libperl.bin: | |||
175 | $(BUILD) $(FLAGS_PERL_EMBED) | 175 | $(BUILD) $(FLAGS_PERL_EMBED) |
176 | 176 | ||
177 | $(OUTPUT)test-libpython.bin: | 177 | $(OUTPUT)test-libpython.bin: |
178 | $(BUILD) | 178 | $(BUILD) $(FLAGS_PYTHON_EMBED) |
179 | 179 | ||
180 | $(OUTPUT)test-libpython-version.bin: | 180 | $(OUTPUT)test-libpython-version.bin: |
181 | $(BUILD) | 181 | $(BUILD) |
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 2b656de99495..cfd6015229a2 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config | |||
@@ -170,13 +170,20 @@ PYTHON2_CONFIG := \ | |||
170 | override PYTHON_CONFIG := \ | 170 | override PYTHON_CONFIG := \ |
171 | $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG)) | 171 | $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG)) |
172 | 172 | ||
173 | PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG)) | 173 | grep-libs = $(filter -l%,$(1)) |
174 | strip-libs = $(filter-out -l%,$(1)) | ||
174 | 175 | ||
175 | PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) | 176 | PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG)) |
176 | PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) | ||
177 | 177 | ||
178 | ifeq ($(CC), clang) | 178 | ifdef PYTHON_CONFIG |
179 | PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS)) | 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 | endif | 187 | endif |
181 | 188 | ||
182 | FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS) | 189 | FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS) |
@@ -554,8 +561,6 @@ ifndef NO_GTK2 | |||
554 | endif | 561 | endif |
555 | endif | 562 | endif |
556 | 563 | ||
557 | grep-libs = $(filter -l%,$(1)) | ||
558 | strip-libs = $(filter-out -l%,$(1)) | ||
559 | 564 | ||
560 | ifdef NO_LIBPERL | 565 | ifdef NO_LIBPERL |
561 | CFLAGS += -DNO_LIBPERL | 566 | CFLAGS += -DNO_LIBPERL |
@@ -603,21 +608,9 @@ else | |||
603 | $(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev) | 608 | $(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev) |
604 | else | 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 | ifneq ($(feature-libpython), 1) | 611 | ifneq ($(feature-libpython), 1) |
618 | $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev) | 612 | $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev) |
619 | else | 613 | else |
620 | |||
621 | ifneq ($(feature-libpython-version), 1) | 614 | ifneq ($(feature-libpython-version), 1) |
622 | $(warning Python 3 is not yet supported; please set) | 615 | $(warning Python 3 is not yet supported; please set) |
623 | $(warning PYTHON and/or PYTHON_CONFIG appropriately.) | 616 | $(warning PYTHON and/or PYTHON_CONFIG appropriately.) |