Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Disable C ext support by default. Enable with -Xcext.enabled=true.

  • Loading branch information...
commit 5f211d590711f7c88facd49c66781d0a9462d4d6 1 parent 7bb636e
@headius headius authored
Showing with 9 additions and 3 deletions.
  1. +8 −2 lib/ruby/shared/mkmf.rb
  2. +1 −1  src/org/jruby/util/cli/Options.java
View
10 lib/ruby/shared/mkmf.rb
@@ -1,6 +1,12 @@
# ---------------------- Changed for JRuby ------------------------------------
-$stderr << "WARNING: JRuby does not support native extensions or the `mkmf' library very well.\n" +
-"Check https://wiki.jruby.org/C-Extension-Alternatives for alternatives.\n"
+# off by default
+if ENV_JAVA['jruby.cext.enabled'] == 'true'
+ msg = "JRuby does not support native extensions or the `mkmf' library very well.\n" +
+ "Check https://wiki.jruby.org/C-Extension-Alternatives for alternatives.\n"
+else
+ msg = "C extension support is not enabled. Pass -Xcext.enabled=true to JRuby or set JRUBY_OPTS or modify .jrubyrc to enable.\n"
+ raise NotImplementedError, msg
+end
require 'rbconfig'
View
2  src/org/jruby/util/cli/Options.java
@@ -99,7 +99,7 @@
public static final Option<Boolean> NATIVE_ENABLED = bool(NATIVE, "native.enabled", true, "Enable/disable native code, including POSIX features and C exts.");
public static final Option<Boolean> NATIVE_VERBOSE = bool(NATIVE, "native.verbose", false, "Enable verbose logging of native extension loading.");
- public static final Option<Boolean> CEXT_ENABLED = bool(NATIVE, "cext.enabled", true, "Enable or disable C extension support.");
+ public static final Option<Boolean> CEXT_ENABLED = bool(NATIVE, "cext.enabled", false, "Enable or disable C extension support.");
public static final Option<Boolean> FFI_COMPILE_DUMP = bool(NATIVE, "ffi.compile.dump", false, "Dump bytecode-generated FFI stubs to console.");
public static final Option<Integer> FFI_COMPILE_THRESHOLD = integer(NATIVE, "ffi.compile.threshold", 100, "Number of FFI invocations before generating a bytecode stub.");
public static final Option<Boolean> FFI_COMPILE_INVOKEDYNAMIC = bool(NATIVE, "ffi.compile.invokedynamic", false, "Use invokedynamic to bind FFI invocations.");
Please sign in to comment.
Something went wrong with that request. Please try again.