@@ -308,6 +308,29 @@ if test "$target_cpu" != "$host_cpu" -a "$GCC" = yes -a "$cross_compiling" = no
308
308
RUBY_DEFAULT_ARCH("$target_cpu")
309
309
fi
310
310
311
+ AS_CASE(["$target_cpu-$target_os"], [[i[3-6]86*]], [
312
+ AC_CACHE_CHECK([for __sync_val_compare_and_swap], [rb_cv_gcc_compiler_cas], [
313
+ AC_TRY_LINK([unsigned long atomic_var;],
314
+ [
315
+ __sync_val_compare_and_swap(&atomic_var, 0, 1);
316
+ ],
317
+ [rb_cv_gcc_compiler_cas=yes],
318
+ [rb_cv_gcc_compiler_cas=no])])
319
+ if test "$rb_cv_gcc_compiler_cas" = no; then
320
+ unset rb_cv_gcc_compiler_cas
321
+ save_CFLAGS="$CFLAGS"
322
+ CFLAGS="$CFLAGS -march=i486"
323
+ AC_CACHE_CHECK([for __sync_val_compare_and_swap with -march=i486], [rb_cv_gcc_compiler_cas], [
324
+ AC_TRY_LINK([unsigned long atomic_var;],
325
+ [
326
+ __sync_val_compare_and_swap(&atomic_var, 0, 1);
327
+ ],
328
+ [rb_cv_gcc_compiler_cas=yes
329
+ ARCH_FLAG="-march=i486"],
330
+ [rb_cv_gcc_compiler_cas=no])])
331
+ CFLAGS="$save_CFLAGS"
332
+ fi])
333
+
311
334
AC_CHECK_TOOL(RANLIB, ranlib, :)
312
335
AC_CHECK_TOOL(AR, ar)
313
336
if test -z "$AR"; then
0 commit comments