summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2017-12-15 14:06:15 +0300
committerMax Romanov <max.romanov@nginx.com>2017-12-15 14:06:15 +0300
commit4e403c17da98d727c12b1e0f742d8911f89e43d8 (patch)
treec36210949013cef8eb39cb7c5770b401a4b457ff
parent799cff5f3e226d8a82a767714c59815939a989dd (diff)
downloadunit-4e403c17da98d727c12b1e0f742d8911f89e43d8.tar.gz
unit-4e403c17da98d727c12b1e0f742d8911f89e43d8.tar.bz2
Introducing --lib-path options for Python module linkage.
This option is useful when python-config does not setup path to libpython, which is non standard.
-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