On Tue, 15 Sep 2009, Peter O'Gorman wrote:
Richard Salz wrote:
Abstracting that nicely proves tricky, so we'll be stuck with some or another hackish solution regardless :-).
You'll probably have to compile/link a small test program and see if it runs, right? Making that happen in autoconf can be considered hackish, I guess...
Not tested on fbsd (where I assume you needed it), -march is not needed for __sync_lock_test_and_set() on either my Mac OS X or Linux systems.
I've committed this patch but with some modifications. __sync_lock_test_and_set() doesn't require at least -march=i486, so I substituted __sync_add_and_fetch(). That also didn't work, as it turns out you can implement the atomic add on i386 w/o -march=i486 as well, so I had to check the return value in order to force gcc to fall back on (unimplemented) library symbols. Probably, we should try testing the need for -march=i486 only on i386 hardware, but I'm not sure it makes too much difference. In any case, this should fix the build problem on x86_64 systems. Robert N M Watson Computer Laboratory University of Cambridge