mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9323a8db6b
commit
2456239f18
2 changed files with 42 additions and 7 deletions
|
@ -1,3 +1,9 @@
|
|||
Thu Feb 11 14:57:58 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* 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@ruby-lang.org>
|
||||
|
||||
* configure.in (RUBY_DEFINT): use Parameter Expansion.
|
||||
|
|
43
configure.in
43
configure.in
|
@ -1417,7 +1417,12 @@ static ac__type_sizeof_ *rbcv_ptr;
|
|||
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;
|
|||
[$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}
|
|||
],
|
||||
[
|
||||
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])
|
|||
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
|
|||
|
||||
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;])],
|
|||
["$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)
|
||||
|
|
Loading…
Add table
Reference in a new issue