summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-13 11:58:58 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-13 11:58:58 +0000
commit7035fd60088016c75814d08cf69c2d9492bba90a (patch)
treef3b4180429e6c2afab034a24beb6e62c05a2dd6d /configure.in
parent7aa4c13360447c3b853d19bf19c068678c4d1656 (diff)
* configure.in (RUBY_DEFAULT_ARCH): adjust for target
cpu. [ruby-core:31243] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in27
1 files changed, 25 insertions, 2 deletions
diff --git a/configure.in b/configure.in
index a7c9610cca..e5c259f520 100644
--- a/configure.in
+++ b/configure.in
@@ -136,9 +136,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])
@@ -172,6 +183,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}"])
@@ -210,6 +229,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,
@@ -264,6 +284,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)