summaryrefslogtreecommitdiffhomepage
path: root/auto/modules/python
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--auto/modules/python24
1 files changed, 17 insertions, 7 deletions
diff --git a/auto/modules/python b/auto/modules/python
index bd6377f4..ff012f08 100644
--- a/auto/modules/python
+++ b/auto/modules/python
@@ -15,14 +15,16 @@ for nxt_option; do
case "$nxt_option" in
- --config=*) NXT_PYTHON_CONFIG="$value" ;;
- --module=*) NXT_PYTHON_MODULE="$value" ;;
+ --config=*) NXT_PYTHON_CONFIG="$value" ;;
+ --module=*) NXT_PYTHON_MODULE="$value" ;;
+ --lib-path=*) NXT_PYTHON_LIB_PATH="$value" ;;
--help)
cat << END
- --config=FILE set python-config filename
- --module=NAME set unit python module name
+ --config=FILE set python-config filename
+ --module=NAME set unit python module name
+ --lib-path=DIRECTORY set directory path to libpython.so library
END
exit 0
@@ -52,6 +54,7 @@ fi
NXT_PYTHON_CONFIG=${NXT_PYTHON_CONFIG=python-config}
NXT_PYTHON=${NXT_PYTHON_CONFIG%-config*}
NXT_PYTHON_MODULE=${NXT_PYTHON_MODULE=${NXT_PYTHON##*/}}
+NXT_PYTHON_LIB_PATH=${NXT_PYTHON_LIB_PATH=}
$echo "configuring Python module"
@@ -64,11 +67,18 @@ if /bin/sh -c "$NXT_PYTHON_CONFIG --prefix" >> $NXT_AUTOCONF_ERR 2>&1; then
NXT_PYTHON_INCLUDE=`${NXT_PYTHON_CONFIG} --includes`
NXT_PYTHON_LIBS=`${NXT_PYTHON_CONFIG} --ldflags`
+ if [ "$NXT_PYTHON_LIB_PATH" != "" ]; then
+ # "python-config --ldflags" may not contain path to libpython.
+ NXT_PYTHON_LDFLAGS="-L$NXT_PYTHON_LIB_PATH -Wl,-rpath $NXT_PYTHON_LIB_PATH"
+ else
+ NXT_PYTHON_LDFLAGS=""
+ fi
+
nxt_feature="Python"
nxt_feature_name=""
nxt_feature_run=no
nxt_feature_incs="${NXT_PYTHON_INCLUDE}"
- nxt_feature_libs="${NXT_PYTHON_LIBS}"
+ nxt_feature_libs="${NXT_PYTHON_LIBS} $NXT_PYTHON_LDFLAGS"
nxt_feature_test="
#include <Python.h>
@@ -95,7 +105,7 @@ nxt_feature="Python version"
nxt_feature_name=""
nxt_feature_run=value
nxt_feature_incs="${NXT_PYTHON_INCLUDE}"
-nxt_feature_libs="${NXT_PYTHON_LIBS}"
+nxt_feature_libs="${NXT_PYTHON_LIBS} $NXT_PYTHON_LDFLAGS"
nxt_feature_test="
#include <Python.h>
#include <stdio.h>
@@ -164,7 +174,7 @@ ${NXT_PYTHON_MODULE}: $NXT_BUILD_DIR/${NXT_PYTHON_MODULE}.unit.so
$NXT_BUILD_DIR/${NXT_PYTHON_MODULE}.unit.so: $nxt_objs
\$(NXT_MODULE_LINK) -o $NXT_BUILD_DIR/${NXT_PYTHON_MODULE}.unit.so \\
- $nxt_objs $NXT_PYTHON_LIBS $NXT_LD_OPT
+ $nxt_objs $NXT_PYTHON_LIBS $NXT_PYTHON_LDFLAGS $NXT_LD_OPT
install: ${NXT_PYTHON_MODULE}-install