From ec45161c51693fc790c97a66f2981fb18363fa49 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 15 Mar 2018 15:20:08 +0000 Subject: [PATCH] configure.ac: fix rb_cv_gcc_compiler_cas * configure.ac (rb_cv_gcc_compiler_cas): do not use one variable for multiple AC_CACHE_CHECK. in one check, select by different values. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- configure.ac | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/configure.ac b/configure.ac index d2f22b5744..afb7202a94 100644 --- a/configure.ac +++ b/configure.ac @@ -258,29 +258,6 @@ AS_IF([test "$target_cpu" != "$host_cpu" -a "$GCC" = yes -a "$cross_compiling" = RUBY_DEFAULT_ARCH("$target_cpu") ]) -AS_CASE(["$target_cpu-$target_os"], [[i[3-6]86*]], [ - AC_CACHE_CHECK([for __sync_val_compare_and_swap], [rb_cv_gcc_compiler_cas], [ - AC_TRY_LINK([unsigned long atomic_var;], - [ - __sync_val_compare_and_swap(&atomic_var, 0, 1); - ], - [rb_cv_gcc_compiler_cas=yes], - [rb_cv_gcc_compiler_cas=no])]) - AS_IF([test "$rb_cv_gcc_compiler_cas" = no], [ - unset rb_cv_gcc_compiler_cas - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -march=i486" - AC_CACHE_CHECK([for __sync_val_compare_and_swap with -march=i486], [rb_cv_gcc_compiler_cas], [ - AC_TRY_LINK([unsigned long atomic_var;], - [ - __sync_val_compare_and_swap(&atomic_var, 0, 1); - ], - [rb_cv_gcc_compiler_cas=yes - ARCH_FLAG="-march=i486"], - [rb_cv_gcc_compiler_cas=no])]) - CFLAGS="$save_CFLAGS" - ])]) - AS_CASE(["$target_os"], [darwin*], [ if libtool 2>&1 | grep no_warning_for_no_symbols > /dev/null; then ac_cv_prog_ac_ct_RANLIB=: @@ -664,6 +641,23 @@ AS_IF([test "$GCC" = yes], [ done ]) +AS_CASE(["$target_cpu"], [[i[3-6]86*]], [ + AC_CACHE_CHECK([for __sync_val_compare_and_swap], [rb_cv_gcc_compiler_cas], [ + AC_TRY_LINK([unsigned long atomic_var;], + [__sync_val_compare_and_swap(&atomic_var, 0, 1);], + [rb_cv_gcc_compiler_cas=yes], + [ + save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -march=i486" + AC_TRY_LINK([unsigned long atomic_var;], + [__sync_val_compare_and_swap(&atomic_var, 0, 1);], + [rb_cv_gcc_compiler_cas=i486], + [rb_cv_gcc_compiler_cas=no]) + CFLAGS="$save_CFLAGS" + ]) + ]) + AS_IF([test "$rb_cv_gcc_compiler_cas" = i486], [ARCH_FLAG="-march=i486"]) +]) + AC_ARG_WITH(opt-dir, AS_HELP_STRING([--with-opt-dir=DIR-LIST], [add optional headers and libraries directories separated by $PATH_SEPARATOR]),