about summary refs log tree commit homepage
path: root/ext/raindrops/extconf.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/raindrops/extconf.rb')
-rw-r--r--ext/raindrops/extconf.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/raindrops/extconf.rb b/ext/raindrops/extconf.rb
index 7570f24..b1310b0 100644
--- a/ext/raindrops/extconf.rb
+++ b/ext/raindrops/extconf.rb
@@ -1,9 +1,12 @@
+# frozen_string_literal: false
 require 'mkmf'
 require 'shellwords'
 
+$CFLAGS += ' -O0 ' # faster checks
 dir_config('atomic_ops')
 have_func('mmap', 'sys/mman.h') or abort 'mmap() not found'
 have_func('munmap', 'sys/mman.h') or abort 'munmap() not found'
+have_func('rb_io_descriptor')
 
 $CPPFLAGS += " -D_GNU_SOURCE "
 have_func('mremap', 'sys/mman.h')
@@ -143,7 +146,7 @@ SRC
       $defs.push(format("-DHAVE_GCC_ATOMIC_BUILTINS"))
       true
     else
-      prev_cflags = $CFLAGS
+      $CFLAGS = prev_cflags
       false
     end
   end
@@ -157,4 +160,5 @@ Users of Debian-based distros may run:
   apt-get install libatomic-ops-dev
 SRC
 create_header # generate extconf.h to avoid excessively long command-line
+$CFLAGS.sub!(/ -O0 /, '')
 create_makefile('raindrops_ext')