ruby-changes:41733
From: nobu <ko1@a...>
Date: Thu, 11 Feb 2016 14:58:05 +0900 (JST)
Subject: [ruby-changes:41733] nobu:r53807 (trunk): configure.in: fix universal binary
nobu 2016-02-11 14:58:16 +0900 (Thu, 11 Feb 2016) New Revision: 53807 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53807 Log: configure.in: fix universal binary * configure.in (RUBY_CHECK_SIZEOF, RUBY_DEFINT): fix for types which are conditionally available depending on architectures when universal binary, e.g., __int128. Modified files: trunk/ChangeLog trunk/configure.in Index: configure.in =================================================================== --- configure.in (revision 53806) +++ configure.in (revision 53807) @@ -1417,7 +1417,12 @@ static ac__type_sizeof_ *rbcv_ptr; https://github.com/ruby/ruby/blob/trunk/configure.in#L1417 AS_TR_SH(ac_cv_sizeof_$1)=AS_TR_CPP([SIZEOF_]$t) break]) done - }]) + }], [ + AC_COMPUTE_INT([AS_TR_SH(ac_cv_sizeof_$1)], [AS_TR_CPP(SIZEOF_$1)], + [AC_INCLUDES_DEFAULT([$4]) +$rbcv_var], + [AS_TR_SH(ac_cv_sizeof_$1)=]) + ]) unset cond m4_ifval([$3], [test -z "${AS_TR_SH(ac_cv_sizeof_$1)+set}" && { for s in 32 64 128; do @@ -1435,9 +1440,20 @@ static ac__type_sizeof_ *rbcv_ptr; https://github.com/ruby/ruby/blob/trunk/configure.in#L1440 [$rbcv_var], [AS_TR_CPP(HAVE_$1) == (AS_TR_CPP(SIZEOF_$1) == ($s / $rb_cv_char_bit))])], [AS_TR_SH(ac_cv_sizeof_$1)="${AS_TR_SH(ac_cv_sizeof_$1)+${AS_TR_SH(ac_cv_sizeof_$1)-} }${t}${s}"; continue]) + AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$hdr] +[ +@%:@if AS_TR_CPP(HAVE_$1) +$rbcv_var +@%:@else +@%:@define AS_TR_CPP(SIZEOF_$1) 0 +@%:@endif +], + [AS_TR_CPP(HAVE_$1) == (AS_TR_CPP(SIZEOF_$1) == (m4_bmatch([$2], [^[0-9][0-9]*$], [$2], [($s / $rb_cv_char_bit)])))])], + [AS_TR_SH(ac_cv_sizeof_$1)="${AS_TR_SH(ac_cv_sizeof_$1)+${AS_TR_SH(ac_cv_sizeof_$1)-} }${t}${s}m4_bmatch([$2], [^[0-9][0-9]*$], [:$2])"]) done done }]) + test "${AS_TR_SH(ac_cv_sizeof_$1)@%:@@<:@1-9@:>@}" = "${AS_TR_SH(ac_cv_sizeof_$1)}" && m4_ifval([$2][$3], [test "${AS_TR_SH(ac_cv_sizeof_$1)@%:@SIZEOF_}" = "${AS_TR_SH(ac_cv_sizeof_$1)}" && ]){ test "$universal_binary" = yes && cross_compiling=yes @@ -1467,7 +1483,7 @@ ${cond+@%:@endif} https://github.com/ruby/ruby/blob/trunk/configure.in#L1483 ], [ s=`expr $t : ['.*[^0-9]\([0-9][0-9]*\)$']` - s=`expr $s / $rb_cv_char_bit` + AS_CASE([$t], [*:*], [t="${t%:*}"], [s=`expr $s / $rb_cv_char_bit`]) echo "@%:@${cond+el}if defined(__${t}__) || defined(__${t}) || defined(_${t}) || defined($t)" echo "@%:@define AS_TR_CPP(SIZEOF_$1) $s" cond=1 @@ -1488,8 +1504,8 @@ RUBY_CHECK_SIZEOF(int, [], [ILP]) https://github.com/ruby/ruby/blob/trunk/configure.in#L1504 RUBY_CHECK_SIZEOF(short) RUBY_CHECK_SIZEOF(long, [int], [ILP LP]) RUBY_CHECK_SIZEOF(long long) -RUBY_CHECK_SIZEOF(__int64) -RUBY_CHECK_SIZEOF(__int128) +RUBY_CHECK_SIZEOF(__int64, [8], [ILP LP]) +RUBY_CHECK_SIZEOF(__int128, [16], [ILP LP]) RUBY_CHECK_SIZEOF(off_t) RUBY_CHECK_SIZEOF(void*, [int long "long long"], [ILP LP LLP]) RUBY_CHECK_SIZEOF(float) @@ -2014,6 +2030,8 @@ fi https://github.com/ruby/ruby/blob/trunk/configure.in#L2030 dnl RUBY_DEFINT TYPENAME, SIZE, [UNSIGNED], [INCLUDES = DEFAULT-INCLUDES] AC_DEFUN([RUBY_DEFINT], [dnl +AS_VAR_PUSHDEF([cond], [rb_defint_cond])dnl +AS_VAR_PUSHDEF([type], [rb_defint_type])dnl AC_CACHE_CHECK([for $1], [rb_cv_type_$1], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4]) typedef $1 t; int s = sizeof(t) == 42;])], @@ -2024,19 +2042,30 @@ typedef $1 t; int s = sizeof(t) == 42;]) https://github.com/ruby/ruby/blob/trunk/configure.in#L2042 ["$ac_cv_sizeof_int"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])int"], ["$ac_cv_sizeof_long"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])long"], ["$ac_cv_sizeof_long_long"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])long long"], - ["$ac_cv_sizeof___int64"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])__int64"], - ["$ac_cv_sizeof___int128"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])__int128"], + ["${ac_cv_sizeof___int64@%:@*:}"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])__int64"], + ["${ac_cv_sizeof___int128@%:@*:}"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])__int128"], [ rb_cv_type_$1=no])])]) if test "${rb_cv_type_$1}" != no; then + type="${rb_cv_type_$1@%:@@%:@unsigned }" + AS_IF([test "$type" != yes && eval 'test -n "${ac_cv_sizeof_'$type'+set}"'], [ + eval cond='"${ac_cv_sizeof_'$type'}"' + AS_CASE([$cond], [*:*], [ + cond=AS_TR_CPP($type) + echo "@%:@if defined SIZEOF_"$cond" && SIZEOF_"$cond" > 0" >> confdefs.h + ], [cond=]) + ], [cond=]) AC_DEFINE([HAVE_]AS_TR_CPP($1), 1) if test "${rb_cv_type_$1}" = yes; then m4_bmatch([$2], [^[1-9][0-9]*$], [AC_CHECK_SIZEOF([$1], 0, [AC_INCLUDES_DEFAULT([$4])])], [RUBY_CHECK_SIZEOF([$1], [$2], [], [AC_INCLUDES_DEFAULT([$4])])]) else AC_DEFINE_UNQUOTED($1, [$rb_cv_type_$1]) - AC_DEFINE_UNQUOTED([SIZEOF_]AS_TR_CPP($1), [SIZEOF_]AS_TR_CPP([${rb_cv_type_$1@%:@@%:@unsigned }])) + AC_DEFINE_UNQUOTED([SIZEOF_]AS_TR_CPP($1), [SIZEOF_]AS_TR_CPP([$type])) fi + test -n "$cond" && echo "@%:@endif /* $cond */" >> confdefs.h fi +AS_VAR_POPDEF([cond])dnl +AS_VAR_POPDEF([type])dnl ]) RUBY_DEFINT(int8_t, 1) Index: ChangeLog =================================================================== --- ChangeLog (revision 53806) +++ ChangeLog (revision 53807) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Feb 11 14:57:58 2016 Nobuyoshi Nakada <nobu@r...> + + * configure.in (RUBY_CHECK_SIZEOF, RUBY_DEFINT): fix for types + which are conditionally available depending on architectures + when universal binary, e.g., __int128. + Thu Feb 11 06:26:18 2016 NARUSE, Yui <naruse@r...> * configure.in (RUBY_DEFINT): use Parameter Expansion. -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/