From 2c2c6bc3fac34b7dd7ecafd08c7f12fc47988799 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 15 Dec 2023 15:19:16 +0900 Subject: [PATCH] Fix `ARCH_FLAG` when cross-compiling on macOS --- configure.ac | 2 +- tool/m4/ruby_default_arch.m4 | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 84bda875dc..1a36dcd1a6 100644 --- a/configure.ac +++ b/configure.ac @@ -461,7 +461,7 @@ AC_SUBST(CC_VERSION_MESSAGE, $cc_version_message) : ${DLDFLAGS="$LDFLAGS"} RUBY_UNIVERSAL_ARCH -AS_IF([test "$target_cpu" != "$host_cpu" -a "$GCC" = yes -a "$cross_compiling" = no -a "${universal_binary:-no}" = no], [ +AS_IF([test "$target_cpu" != "$host_cpu" -a "$GCC" = yes -a "${universal_binary:-no}" = no], [ RUBY_DEFAULT_ARCH("$target_cpu") ]) host_os=$target_os diff --git a/tool/m4/ruby_default_arch.m4 b/tool/m4/ruby_default_arch.m4 index 41b5c75012..87d985020a 100644 --- a/tool/m4/ruby_default_arch.m4 +++ b/tool/m4/ruby_default_arch.m4 @@ -9,6 +9,10 @@ AS_CASE([$1:"$host_cpu"], [[i[3-6]86]:x86_64], [ARCH_FLAG=-m32], [ppc64:ppc*], [ARCH_FLAG=-m64], [ppc*:ppc64], [ARCH_FLAG=-m32], + AS_CASE([$build_os], + [darwin*], [ARCH_FLAG="-arch "$1], + [ARCH_FLAG=-march=$1] + ) ) AC_MSG_RESULT([$ARCH_FLAG]) ])dnl