提交 7be6b316 编写于 作者: D David Carrillo-Cisneros 提交者: Arnaldo Carvalho de Melo

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: NDavid Carrillo-Cisneros <davidcc@google.com>
Acked-by: NJiri 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.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 a8d11cd0
...@@ -175,7 +175,7 @@ $(OUTPUT)test-libperl.bin: ...@@ -175,7 +175,7 @@ $(OUTPUT)test-libperl.bin:
$(BUILD) $(FLAGS_PERL_EMBED) $(BUILD) $(FLAGS_PERL_EMBED)
$(OUTPUT)test-libpython.bin: $(OUTPUT)test-libpython.bin:
$(BUILD) $(BUILD) $(FLAGS_PYTHON_EMBED)
$(OUTPUT)test-libpython-version.bin: $(OUTPUT)test-libpython-version.bin:
$(BUILD) $(BUILD)
......
...@@ -170,13 +170,20 @@ PYTHON2_CONFIG := \ ...@@ -170,13 +170,20 @@ PYTHON2_CONFIG := \
override PYTHON_CONFIG := \ override PYTHON_CONFIG := \
$(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG)) $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG))
PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG)) grep-libs = $(filter -l%,$(1))
strip-libs = $(filter-out -l%,$(1))
PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
ifeq ($(CC), clang) ifdef PYTHON_CONFIG
PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS)) PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
ifeq ($(CC), clang)
PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS))
endif
FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
endif endif
FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS) FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
...@@ -554,8 +561,6 @@ ifndef NO_GTK2 ...@@ -554,8 +561,6 @@ ifndef NO_GTK2
endif endif
endif endif
grep-libs = $(filter -l%,$(1))
strip-libs = $(filter-out -l%,$(1))
ifdef NO_LIBPERL ifdef NO_LIBPERL
CFLAGS += -DNO_LIBPERL CFLAGS += -DNO_LIBPERL
...@@ -603,21 +608,9 @@ else ...@@ -603,21 +608,9 @@ else
$(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev) $(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev)
else else
PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
ifeq ($(CC), clang)
PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS))
endif
FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
ifneq ($(feature-libpython), 1) ifneq ($(feature-libpython), 1)
$(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev) $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev)
else else
ifneq ($(feature-libpython-version), 1) ifneq ($(feature-libpython-version), 1)
$(warning Python 3 is not yet supported; please set) $(warning Python 3 is not yet supported; please set)
$(warning PYTHON and/or PYTHON_CONFIG appropriately.) $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册