Module: kamailio
Branch: master
Commit: 03356132aef31a35b94bd47b4146cbce3e1c4ce9
URL:
https://github.com/kamailio/kamailio/commit/03356132aef31a35b94bd47b4146cbc…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-11-29T09:33:24+01:00
app_python3: Makefile - extend python3-config lookup
---
Modified: src/modules/app_python3/Makefile
---
Diff:
https://github.com/kamailio/kamailio/commit/03356132aef31a35b94bd47b4146cbc…
Patch:
https://github.com/kamailio/kamailio/commit/03356132aef31a35b94bd47b4146cbc…
---
diff --git a/src/modules/app_python3/Makefile b/src/modules/app_python3/Makefile
index b3c1e8760b..c357ebc09e 100644
--- a/src/modules/app_python3/Makefile
+++ b/src/modules/app_python3/Makefile
@@ -1,4 +1,4 @@
-#
+#
# WARNING: do not run this directly, it should be run by the main Makefile
include ../../Makefile.defs
@@ -6,21 +6,34 @@ auto_gen=
NAME=app_python3.so
# If you have multiple Python versions installed make sure to modify the
-# the following to point to the correct instance. Module has been tested
-# to work with 2.6 and 2.5. Python 2.4 has been only confirmed to compile,
-# but no testing has been done with that.
-PYTHON3?=python3
+# the following to point to the correct instance.
+PYTHON3?=$(shell which python3)
+ifeq ($(PYTHON3),)
+PYTHON3=python
+endif
+
+PYTHON3CONFIG=$(shell which ${PYTHON3}-config)
+ifeq ($(PYTHON3CONFIG),)
+python_version_full := $(wordlist 2,4,$(subst ., ,$(shell ${PYTHON3} --version
2>&1)))
+python_version_major := $(word 1,${python_version_full})
+python_version_minor := $(word 2,${python_version_full})
+PYTHON3 = python${python_version_major}.${python_version_minor}
+PYTHON3CONFIG=$(shell which ${PYTHON3}-config)
+ifeq ($(PYTHON3CONFIG),)
+PYTHON3CONFIG=${PYTHON3}-config
+endif
+endif
LIBS=${shell \
- tmp_py3_libs=$$(${PYTHON3}-config --ldflags --embed 2>/dev/null) || \
- tmp_py3_libs=$$(${PYTHON3}-config --ldflags); \
+ tmp_py3_libs=$$(${PYTHON3CONFIG} --ldflags --embed 2>/dev/null) || \
+ tmp_py3_libs=$$(${PYTHON3CONFIG} --ldflags); \
echo $$tmp_py3_libs}
ifeq ($(OS), freebsd)
LIBS+=-pthread
endif
-DEFS+=${shell ${PYTHON3}-config --includes}
+DEFS+=${shell ${PYTHON3CONFIG} --includes}
include ../../Makefile.modules