ext/raindrops/extconf.rb in raindrops-0.4.0 vs ext/raindrops/extconf.rb in raindrops-0.4.1
- old
+ new
@@ -1,8 +1,7 @@
require 'mkmf'
-# FIXME: test for GCC __sync_XXX builtins here, somehow...
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_struct_alloc_noinit")
have_func('rb_thread_blocking_region')
@@ -16,9 +15,16 @@
return 0;
}
SRC
if try_run(src)
+ # some systems target GCC for i386 and don't get the atomic builtins
+ # when building shared objects
+ arch = `#{CONFIG['CC']} -dumpmachine`.split(/-/)[0]
+ if arch == "i386" && $CFLAGS !~ /\b-march=/
+ $CFLAGS += " -march=i486 "
+ end
+
$defs.push(format("-DHAVE_GCC_ATOMIC_BUILTINS"))
true
else
false
end