diff options
author | Valentin Bartenev <vbart@nginx.com> | 2020-08-08 23:52:31 +0300 |
---|---|---|
committer | Valentin Bartenev <vbart@nginx.com> | 2020-08-08 23:52:31 +0300 |
commit | 0d7a6885a32e01a1d6986f9b77a57f101cd3e8d9 (patch) | |
tree | 6f3294dfacab323bbda60cb0a510f7266505c83f /auto | |
parent | 375cbc2cc4aa379727b7e0f02a257e1d8e35ce4f (diff) | |
download | unit-0d7a6885a32e01a1d6986f9b77a57f101cd3e8d9.tar.gz unit-0d7a6885a32e01a1d6986f9b77a57f101cd3e8d9.tar.bz2 |
Configure: verifying the Ruby library path.
An attempt to build a Ruby module for a custom Ruby installation that has the
same major version as the system Ruby may unexpectedly cause the use of the
system Ruby library.
This closes #449 issue on GitHub.
Diffstat (limited to '')
-rw-r--r-- | auto/modules/ruby | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/auto/modules/ruby b/auto/modules/ruby index 5cead26b..f5384f98 100644 --- a/auto/modules/ruby +++ b/auto/modules/ruby @@ -70,25 +70,31 @@ if /bin/sh -c "$NXT_RUBY -v" >> $NXT_AUTOCONF_ERR 2>&1; then NXT_RUBY_LIBNAME=`$NXT_RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG["RUBY_SO_NAME"])'` NXT_RUBY_LIBSCONF=`$NXT_RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG["LIBS"])'` + NXT_RUBY_LIBPATH=`$NXT_RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG["libdir"])'` NXT_RUBY_LIBS="-l$NXT_RUBY_LIBNAME $NXT_RUBY_LIBSCONF" nxt_feature="Ruby library" nxt_feature_name="" - nxt_feature_run=no + nxt_feature_run=value nxt_feature_incs="${NXT_RUBY_INCPATH}" nxt_feature_libs="${NXT_RUBY_LIBS}" nxt_feature_test=" #include <ruby.h> int main() { + static const char *argv[3] = { + \"NGINX_Unit\", \"-rrbconfig\", + \"-eprint RbConfig::CONFIG['libdir']\" + }; + + RUBY_INIT_STACK; ruby_init(); - return ruby_cleanup(0); + return ruby_run_node(ruby_options(3, (char **) argv)); }" . auto/feature - if [ $nxt_found = no ]; then - NXT_RUBY_LIBPATH=`$NXT_RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG["libdir"])'` + if [ "$nxt_feature_value" != "$NXT_RUBY_LIBPATH" ]; then NXT_RUBY_LIBS="-L$NXT_RUBY_LIBPATH -Wl,-rpath,${NXT_RUBY_LIBPATH} $NXT_RUBY_LIBS" nxt_feature="Ruby library in $NXT_RUBY_LIBPATH" |