From c1abf1d272e8e7df184dd48623aac24117bb28f8 Mon Sep 17 00:00:00 2001 From: mame Date: Thu, 29 Jul 2010 11:43:35 +0000 Subject: merges r28626 from trunk into ruby_1_9_2. -- * configure.in (RUBY_DEFAULT_ARCH): adjust for target cpu. [ruby-core:31243] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- configure.in | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'configure.in') diff --git a/configure.in b/configure.in index da56327259..760347141c 100644 --- a/configure.in +++ b/configure.in @@ -139,9 +139,20 @@ AC_ARG_WITH(arch, target platform]), [target_archs="$withval"], [unset target_archs]) +AC_DEFUN([RUBY_DEFAULT_ARCH], [ +AC_MSG_CHECKING([arch option]) +AS_CASE([$1], + [*64], [ARCH_FLAG=-m64], + [[i[3-6]86]], [ARCH_FLAG=-m32], + [AC_MSG_ERROR(unknown target architecture: $target_archs)] + ) +AC_MSG_RESULT([$ARCH_FLAG]) +]) + AC_DEFUN([RUBY_UNIVERSAL_ARCH], [ -test ${CFLAGS+set} && CFLAGS=`echo "$CFLAGS" | sed 's/ *-arch *[^ ]*//g'` -test ${LDFLAGS+set} && LDFLAGS=`echo "$LDFLAGS" | sed 's/ *-arch *[^ ]*//g'` +# RUBY_UNIVERSAL_ARCH begin +test ${CFLAGS+set} && CFLAGS=`echo "$CFLAGS" | sed -e 's/ *-arch *[^ ]*//g' -e 's/ *-m32//g' -e 's/ *-m64//g'` +test ${LDFLAGS+set} && LDFLAGS=`echo "$LDFLAGS" | sed 's/ *-arch *[^ ]*//g' -e 's/ *-m32//g' -e 's/ *-m64//g'` unset ARCH_FLAG universal_binary universal_archnames if test ${target_archs+set}; then AC_MSG_CHECKING([target architectures]) @@ -175,6 +186,14 @@ if test ${target_archs+set}; then target_cpu=universal real_cross_compiling=$cross_compiling else + if test x"$target_cpu" != x"${target_archs}"; then + echo 'int main(){return 0;}' > conftest.c + if $CC $CFLAGS $ARCH_FLAG conftest.c > /dev/null 2>&1; then + rm -f conftest.* a.out + else + RUBY_DEFAULT_ARCH("$target_archs") + fi + fi target_cpu=${target_archs} fi AS_CASE(["$target"], [-*], [ target="$target_cpu${target}"]) @@ -213,6 +232,7 @@ if test "${target_archs}" != "${rb_cv_target_archs-${target_archs}}"; then else rb_cv_target_archs=${target_archs} fi +# RUBY_UNIVERSAL_ARCH end ]) AC_ARG_ENABLE(load-relative, @@ -267,6 +287,9 @@ AC_SUBST(COUTFLAG) RUBY_MINGW32 RUBY_UNIVERSAL_ARCH +if test "$target_cpu" != "$host_cpu" -a "$GCC" = yes -a "$cross_compiling" = no; then + RUBY_DEFAULT_ARCH("$target_cpu") +fi AC_CHECK_TOOL(RANLIB, ranlib, :) AC_CHECK_TOOL(AR, ar) -- cgit v1.2.3