diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index e05d8f99424d..75d4c237b03d 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile @@ -121,10 +121,16 @@ ifdef PARSER_DEBUG endif ifndef NO_LIBPYTHON - override PYTHON := \ - $(call get-executable-or-default,PYTHON,python) + # Try different combinations to accommodate systems that only have + # python[2][-config] in weird combinations but always preferring + # python2 and python2-config as per pep-0394. If we catch a + # python[-config] in version 3, the version check will kill it. + PYTHON2 := $(if $(call get-executable,python2),python2,python) + override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON2)) + PYTHON2_CONFIG := \ + $(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config) override PYTHON_CONFIG := \ - $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON)-config) + $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG)) PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))