From 8a2a725a4ad074af493e5aa075155eda8b1d6be7 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 25 Sep 2010 00:14:48 -0700 Subject: force -march=i486 where GCC is targeted for i386 Nobody uses i386 anymore (especially not with Ruby!), but some systems like FreeBSD 7.0 still target GCC at i386 by default, so we force GCC to use a slightly more modern instruction set and allow it to use atomic builtins. --- ext/raindrops/extconf.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ext/raindrops/extconf.rb b/ext/raindrops/extconf.rb index 09d6e36..fc2b3fd 100644 --- a/ext/raindrops/extconf.rb +++ b/ext/raindrops/extconf.rb @@ -1,6 +1,5 @@ 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' @@ -18,6 +17,13 @@ int main(int argc, char * const argv[]) { 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 -- cgit v1.2.3-24-ge0c7