ruby-changes:16632
From: nobu <ko1@a...>
Date: Tue, 13 Jul 2010 20:59:11 +0900 (JST)
Subject: [ruby-changes:16632] Ruby:r28626 (trunk): * configure.in (RUBY_DEFAULT_ARCH): adjust for target
nobu 2010-07-13 20:58:58 +0900 (Tue, 13 Jul 2010) New Revision: 28626 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28626 Log: * configure.in (RUBY_DEFAULT_ARCH): adjust for target cpu. [ruby-core:31243] Modified files: trunk/ChangeLog trunk/configure.in Index: configure.in =================================================================== --- configure.in (revision 28625) +++ configure.in (revision 28626) @@ -136,9 +136,20 @@ 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]) @@ -172,6 +183,14 @@ 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}"]) @@ -210,6 +229,7 @@ else rb_cv_target_archs=${target_archs} fi +# RUBY_UNIVERSAL_ARCH end ]) AC_ARG_ENABLE(load-relative, @@ -264,6 +284,9 @@ 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) Index: ChangeLog =================================================================== --- ChangeLog (revision 28625) +++ ChangeLog (revision 28626) @@ -1,3 +1,8 @@ +Tue Jul 13 20:58:57 2010 Nobuyoshi Nakada <nobu@r...> + + * configure.in (RUBY_DEFAULT_ARCH): adjust for target + cpu. [ruby-core:31243] + Tue Jul 13 20:46:00 2010 Nobuyoshi Nakada <nobu@r...> * ext/dl/handle.c (rb_dlhandle_close): should not pass a dynamic -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/