ruby-changes:49864
From: shyouhei <ko1@a...>
Date: Sat, 20 Jan 2018 16:05:32 +0900 (JST)
Subject: [ruby-changes:49864] shyouhei:r61981 (trunk): refactor split configure.ac into files
shyouhei 2018-01-20 16:05:25 +0900 (Sat, 20 Jan 2018) New Revision: 61981 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61981 Log: refactor split configure.ac into files This does not (yet) change anything. The generated configure file is the identical to previous one (except several empty lines added and deleted). Added directories: trunk/tool/m4/ Added files: trunk/tool/m4/_colorize_result_prepare.m4 trunk/tool/m4/ac_checking.m4 trunk/tool/m4/ac_msg_result.m4 trunk/tool/m4/colorize_result.m4 trunk/tool/m4/ruby_append_option.m4 trunk/tool/m4/ruby_append_options.m4 trunk/tool/m4/ruby_check_builtin_func.m4 trunk/tool/m4/ruby_check_builtin_setjmp.m4 trunk/tool/m4/ruby_check_printf_prefix.m4 trunk/tool/m4/ruby_check_setjmp.m4 trunk/tool/m4/ruby_check_signedness.m4 trunk/tool/m4/ruby_check_sizeof.m4 trunk/tool/m4/ruby_check_sysconf.m4 trunk/tool/m4/ruby_cppoutfile.m4 trunk/tool/m4/ruby_decl_attribute.m4 trunk/tool/m4/ruby_default_arch.m4 trunk/tool/m4/ruby_define_if.m4 trunk/tool/m4/ruby_defint.m4 trunk/tool/m4/ruby_dtrace_available.m4 trunk/tool/m4/ruby_dtrace_postprocess.m4 trunk/tool/m4/ruby_func_attribute.m4 trunk/tool/m4/ruby_mingw32.m4 trunk/tool/m4/ruby_prepend_option.m4 trunk/tool/m4/ruby_prepend_options.m4 trunk/tool/m4/ruby_prog_gnu_ld.m4 trunk/tool/m4/ruby_replace_type.m4 trunk/tool/m4/ruby_rm_recursive.m4 trunk/tool/m4/ruby_setjmp_type.m4 trunk/tool/m4/ruby_stack_grow_direction.m4 trunk/tool/m4/ruby_try_cflags.m4 trunk/tool/m4/ruby_try_ldflags.m4 trunk/tool/m4/ruby_type_attribute.m4 trunk/tool/m4/ruby_universal_arch.m4 trunk/tool/m4/ruby_werror_flag.m4 Modified files: trunk/acinclude.m4 trunk/configure.ac Index: tool/m4/ruby_stack_grow_direction.m4 =================================================================== --- tool/m4/ruby_stack_grow_direction.m4 (nonexistent) +++ tool/m4/ruby_stack_grow_direction.m4 (revision 61981) @@ -0,0 +1,29 @@ https://github.com/ruby/ruby/blob/trunk/tool/m4/ruby_stack_grow_direction.m4#L1 +AC_DEFUN([RUBY_STACK_GROW_DIRECTION], [ + AS_VAR_PUSHDEF([stack_grow_dir], [rb_cv_stack_grow_dir_$1]) + AC_CACHE_CHECK(stack growing direction on $1, stack_grow_dir, [ +AS_CASE(["$1"], +[m68*|x86*|x64|i?86|ia64|ppc*|sparc*|alpha*], [ $2=-1], +[hppa*], [ $2=+1], +[ + AC_TRY_RUN([ +/* recurse to get rid of inlining */ +static int +stack_growup_p(addr, n) + volatile int *addr, n; +{ + volatile int end; + if (n > 0) + return *addr = stack_growup_p(addr, n - 1); + else + return (&end > addr); +} +int main() +{ + int x; + return stack_growup_p(&x, 10); +} +], $2=-1, $2=+1, $2=0) + ]) +eval stack_grow_dir=\$$2]) +eval $2=\$stack_grow_dir +AS_VAR_POPDEF([stack_grow_dir])])dnl Index: tool/m4/ruby_type_attribute.m4 =================================================================== --- tool/m4/ruby_type_attribute.m4 (nonexistent) +++ tool/m4/ruby_type_attribute.m4 (revision 61981) @@ -0,0 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/tool/m4/ruby_type_attribute.m4#L1 +dnl RUBY_TYPE_ATTRIBUTE(attrib, macroname, cachevar, condition) +AC_DEFUN([RUBY_TYPE_ATTRIBUTE], [dnl + RUBY_DECL_ATTRIBUTE([$1], [$2], [$3], [$4], + [type], [ +@%:@define x struct conftest_attribute_check {int i;} +]) +])dnl Index: tool/m4/ruby_werror_flag.m4 =================================================================== --- tool/m4/ruby_werror_flag.m4 (nonexistent) +++ tool/m4/ruby_werror_flag.m4 (revision 61981) @@ -0,0 +1,17 @@ https://github.com/ruby/ruby/blob/trunk/tool/m4/ruby_werror_flag.m4#L1 +AC_DEFUN([RUBY_WERROR_FLAG], [dnl +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $rb_cv_warnflags" +AS_IF([test "${ac_c_werror_flag+set}"], [ + rb_c_werror_flag="$ac_c_werror_flag" +], [ + unset rb_c_werror_flag +]) +ac_c_werror_flag=yes +$1 +CFLAGS="$save_CFLAGS" +save_CFLAGS= +AS_IF([test "${rb_c_werror_flag+set}"], [ + ac_c_werror_flag="$rb_c_werror_flag" +], [ + unset ac_c_werror_flag +])])dnl Index: tool/m4/ruby_check_builtin_func.m4 =================================================================== --- tool/m4/ruby_check_builtin_func.m4 (nonexistent) +++ tool/m4/ruby_check_builtin_func.m4 (revision 61981) @@ -0,0 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/tool/m4/ruby_check_builtin_func.m4#L1 +AC_DEFUN([RUBY_CHECK_BUILTIN_FUNC], [dnl +AC_CACHE_CHECK([for $1], AS_TR_SH(rb_cv_builtin_$1), + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM([int foo;], [$2;])], + [AS_TR_SH(rb_cv_builtin_$1)=yes], + [AS_TR_SH(rb_cv_builtin_$1)=no])]) +AS_IF([test "${AS_TR_SH(rb_cv_builtin_$1)}" != no], [ + AC_DEFINE(AS_TR_CPP(HAVE_BUILTIN_$1)) +])])dnl Index: tool/m4/ruby_default_arch.m4 =================================================================== --- tool/m4/ruby_default_arch.m4 (nonexistent) +++ tool/m4/ruby_default_arch.m4 (revision 61981) @@ -0,0 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/tool/m4/ruby_default_arch.m4#L1 +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]) +]) +dnl Index: configure.ac =================================================================== --- configure.ac (revision 61980) +++ configure.ac (revision 61981) @@ -11,23 +11,7 @@ AC_ARG_VAR([cflags], [additional CFLAGS] https://github.com/ruby/ruby/blob/trunk/configure.ac#L11 AC_ARG_VAR([cppflags], [additional CPPFLAGS]) AC_ARG_VAR([cxxflags], [additional CXXFLAGS]) -AC_DEFUN([RUBY_RM_RECURSIVE], [ -m4_version_prereq([2.70], [-1], [ -# suppress error messages, rm: cannot remove 'conftest.dSYM', from -# AC_EGREP_CPP with CFLAGS=-g on Darwin. -AS_CASE([$build_os], [darwin*], [ -rm() { - rm_recursive='' - for arg do - AS_CASE("$arg", - [--*], [], - [-*r*], [break], - [conftest.*], [AS_IF([test -d "$arg"], [rm_recursive=-r; break])], - []) - done - command rm $rm_recursive "[$]@" -} -])])]) +m4_include([tool/m4/ruby_rm_recursive.m4])dnl { # environment section @@ -66,56 +50,9 @@ AS_IF([test x"$HAVE_GIT" = xyes], [comma https://github.com/ruby/ruby/blob/trunk/configure.ac#L50 AC_SUBST(GIT) AC_SUBST(HAVE_GIT) -AC_DEFUN([RUBY_MINGW32], -[AS_CASE(["$host_os"], -[cygwin*], [ -AC_CACHE_CHECK(for mingw32 environment, rb_cv_mingw32, -[AC_TRY_CPP([ -#ifndef __MINGW32__ -# error -#endif -], rb_cv_mingw32=yes,rb_cv_mingw32=no) -rm -f conftest*]) -AS_IF([test "$rb_cv_mingw32" = yes], [ - target_os="mingw32" - : ${ac_tool_prefix:="`expr "$CC" : ['\(.*-\)g\?cc[^/]*$']`"} -]) -]) -AS_CASE(["$target_os"], [mingw*msvc], [ -target_os="`echo ${target_os} | sed 's/msvc$//'`" -]) -AS_CASE(["$target_cpu-$target_os"], [x86_64-mingw*], [ -target_cpu=x64 -]) -]) - -AC_DEFUN([RUBY_CPPOUTFILE], -[AC_CACHE_CHECK(whether ${CPP} accepts -o, rb_cv_cppoutfile, -[save_CPPFLAGS="$CPPFLAGS" -CPPFLAGS='-o conftest-1.i' -rb_cv_cppoutfile=no -AC_TRY_CPP([test-for-cppout], - [grep test-for-cppout conftest-1.i > /dev/null && rb_cv_cppoutfile=yes]) -CPPFLAGS="$save_CPPFLAGS" -rm -f conftest*]) -AS_IF([test "$rb_cv_cppoutfile" = yes], [ - CPPOUTFILE='-o conftest.i' -], [test "$rb_cv_cppoutfile" = no], [ - CPPOUTFILE='> conftest.i' -], [test -n "$rb_cv_cppoutfile"], [ - CPPOUTFILE="$rb_cv_cppoutfile" -]) -AC_SUBST(CPPOUTFILE)]) - -AC_DEFUN([RUBY_PROG_GNU_LD], -[AC_CACHE_CHECK(whether the linker is GNU ld, rb_cv_prog_gnu_ld, -[AS_IF([`$CC $CFLAGS $CPPFLAGS $LDFLAGS --print-prog-name=ld 2>&1` -v 2>&1 | grep "GNU ld" > /dev/null], [ - rb_cv_prog_gnu_ld=yes -], [ - rb_cv_prog_gnu_ld=no -])]) -GNU_LD=$rb_cv_prog_gnu_ld -AC_SUBST(GNU_LD)]) +m4_include([tool/m4/ruby_mingw32.m4])dnl +m4_include([tool/m4/ruby_cppoutfile.m4])dnl +m4_include([tool/m4/ruby_prog_gnu_ld.m4])dnl eval `sed -n ['s/^@%:@define RUBY_API_VERSION_\([A-Z][A-Z_0-9]*\) \([0-9][0-9]*\)/API_\1=\2/p'] $srcdir/include/ruby/version.h` RUBY_PROGRAM_VERSION=`sed -n 's/^@%:@define RUBY_VERSION "\(.*\)"/\1/p' $srcdir/version.h` @@ -201,27 +138,10 @@ AS_IF([test -z "$target_alias" -a -n "$o https://github.com/ruby/ruby/blob/trunk/configure.ac#L138 target_os=`echo ${target_os} | sed "$os_version_style_transform"` ]) -AC_DEFUN([RUBY_APPEND_OPTION], - [# RUBY_APPEND_OPTION($1) - AS_CASE([" [$]{$1-} "], - [*" $2 "*], [], [' '], [ $1="$2"], [ $1="[$]$1 $2"])]) -AC_DEFUN([RUBY_APPEND_OPTIONS], - [# RUBY_APPEND_OPTIONS($1) - for rb_opt in $2; do - AS_CASE([" [$]{$1-} "], - [*" [$]{rb_opt} "*], [], [' '], [ $1="[$]{rb_opt}"], [ $1="[$]$1 [$]{rb_opt}"]) - done]) -AC_DEFUN([RUBY_PREPEND_OPTION], - [# RUBY_PREPEND_OPTION($1) - AS_CASE([" [$]{$1-} "], - [*" $2 "*], [], [' '], [ $1="$2"], [ $1="$2 [$]$1"])]) -AC_DEFUN([RUBY_PREPEND_OPTIONS], - [# RUBY_PREPEND_OPTIONS($1) - unset rb_opts; for rb_opt in $2; do - AS_CASE([" [$]{rb_opts} [$]{$1-} "], - [*" [$]{rb_opt} "*], [], [' '], [ $1="[$]{rb_opt}"], [ rb_opts="[$]{rb_opts}[$]{rb_opt} "]) - done - $1="[$]{rb_opts}[$]$1"]) +m4_include([tool/m4/ruby_append_option.m4])dnl +m4_include([tool/m4/ruby_append_options.m4])dnl +m4_include([tool/m4/ruby_prepend_option.m4])dnl +m4_include([tool/m4/ruby_prepend_options.m4])dnl AC_ARG_WITH(arch, AS_HELP_STRING([--with-arch=ARCHS], @@ -232,105 +152,8 @@ AC_ARG_WITH(arch, https://github.com/ruby/ruby/blob/trunk/configure.ac#L152 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], [ -# RUBY_UNIVERSAL_ARCH begin -ARCH_FLAG=`expr " $CXXFLAGS " : ['.* \(-m[0-9][0-9]*\) ']` -test ${CXXFLAGS+set} && CXXFLAGS=`echo "$CXXFLAGS" | sed [-e 's/ *-arch *[^ ]*//g' -e 's/ *-m32//g' -e 's/ *-m64//g']` -ARCH_FLAG=`expr " $CFLAGS " : ['.* \(-m[0-9][0-9]*\) ']` -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 [-e 's/ *-arch *[^ ]*//g' -e 's/ *-m32//g' -e 's/ *-m64//g']` -unset universal_binary universal_archnames -AS_IF([test ${target_archs+set}], [ - AC_MSG_CHECKING([target architectures]) - target_archs=`echo $target_archs | tr , ' '` - # /usr/lib/arch_tool -archify_list $TARGET_ARCHS - for archs in $target_archs - do - AS_CASE([",$universal_binary,"],[*",$archs,"*], [],[ - cpu=`$SHELL "$ac_aux_dir/config.sub" "${archs}-${target_os}" 2>&1` || { - AC_MSG_RESULT([failed]) - AC_MSG_ERROR([$cpu]) - } - cpu=`echo $cpu | sed 's/-.*-.*//'` - universal_binary="${universal_binary+$universal_binary,}$cpu" - universal_archnames="${universal_archnames} ${archs}=${cpu}" - ARCH_FLAG="${ARCH_FLAG+$ARCH_FLAG }-arch $archs" - ]) - done - target_archs="$universal_binary" - unset universal_binary - AS_CASE(["$target_archs"], - [*,*], [universal_binary=yes], - [unset universal_archnames]) - AC_MSG_RESULT([$target_archs]) - - target=`echo $target | sed "s/^$target_cpu-/-/"` - target_alias=`echo $target_alias | sed "s/^$target_cpu-/-/"` - AS_IF([test "${universal_binary-no}" = yes], [ - AC_SUBST(try_header,try_compile) - target_cpu=universal - real_cross_compiling=$cross_compiling - ], [ - AS_IF([test x"$target_cpu" != x"${target_archs}"], [ - echo 'int main(){return 0;}' > conftest.c - AS_IF([$CC $CFLAGS $ARCH_FLAG -o conftest conftest.c > /dev/null 2>&1], [ - rm -fr conftest.* - ], [ - RUBY_DEFAULT_ARCH("$target_archs") - ]) - ]) - target_cpu=${target_archs} - ]) - AS_CASE(["$target"], [-*], [ target="$target_cpu${target}"]) - AS_CASE(["$target_alias"], [-*], [ target_alias="$target_cpu${target_alias}"]) -], [ - AS_IF([test x"$target_alias" = x], [ - AS_CASE(["$target_os"], - [darwin*], [ - AC_MSG_CHECKING([for real target cpu]) - target=`echo $target | sed "s/^$target_cpu-/-/"` - target_cpu=`$CC -E - 2>/dev/null <<EOF | -#ifdef __x86_64__ -"processor-name=x86_64" -#endif -#ifdef __i386__ -"processor-name=i386" -#endif -#ifdef __ppc__ -"processor-name=powerpc" -#endif -#ifdef __ppc64__ -"processor-name=powerpc64" -#endif -EOF - sed -n 's/^"processor-name=\(.*\)"/\1/p'` - target="$target_cpu${target}" - AC_MSG_RESULT([$target_cpu]) - ]) - ]) - target_archs="$target_cpu" -]) -AS_IF([test "${target_archs}" != "${rb_cv_target_archs-${target_archs}}"], [ - AC_MSG_ERROR([target arch(s) has changed from ${rb_cv_target_archs-nothing} to ${target_archs}]) -], [ - rb_cv_target_archs=${target_archs} -]) -AS_IF([test "x${ARCH_FLAG}" != x], [ - CFLAGS="${CFLAGS:+$CFLAGS }${ARCH_FLAG}" - LDFLAGS="${LDFLAGS:+$LDFLAGS }${ARCH_FLAG}" -]) -# RUBY_UNIVERSAL_ARCH end -]) +m4_include([tool/m4/ruby_default_arch.m4])dnl +m4_include([tool/m4/ruby_universal_arch.m4])dnl AC_ARG_ENABLE(load-relative, AS_HELP_STRING([--enable-load-relative], [resolve load paths at run time]), @@ -539,55 +362,8 @@ AS_IF([test "x$MKDIR_P" = "x -d"], [ https://github.com/ruby/ruby/blob/trunk/configure.ac#L362 MAKEDIRS="$MKDIR_P" AC_SUBST(MAKEDIRS) -AC_DEFUN([RUBY_DTRACE_AVAILABLE], -[AC_CACHE_CHECK(whether dtrace USDT is available, rb_cv_dtrace_available, -[ - echo "provider conftest{ probe fire(); };" > conftest_provider.d - rb_cv_dtrace_available=no - AS_FOR(opt, rb_dtrace_opt, ["-xnolibs" ""], [dnl - AS_IF([$DTRACE opt -h -o conftest_provider.h -s conftest_provider.d >/dev/null 2>/dev/null], - [], [continue]) - AC_TRY_COMPILE([@%:@include "conftest_provider.h"], [CONFTEST_FIRE();], - [], [continue]) - # DTrace is available on the system - rb_cv_dtrace_available=yes${rb_dtrace_opt:+"(opt)"} - break - ]) - rm -f conftest.[co] conftest_provider.[dho] -]) -AS_CASE(["$rb_cv_dtrace_available"], ["yes("*")"], - [DTRACE_OPT=`expr "$rb_cv_dtrace_available" : "yes(\(.*\))"`]) -]) - -AC_DEFUN([RUBY_DTRACE_POSTPROCESS], -[AC_CACHE_CHECK(whether $DTRACE needs post processing, rb_cv_prog_dtrace_g, -[ - rb_cv_prog_dtrace_g=no - AS_IF([{ - cat >conftest_provider.d <<_PROBES && - provider conftest { - probe fire(); - }; -_PROBES - $DTRACE ${DTRACE_OPT} -h -o conftest_provider.h -s conftest_provider.d >/dev/null 2>/dev/null && - : - }], [ - AC_TRY_COMPILE([@%:@include "conftest_provider.h"], [CONFTEST_FIRE();], [ - AS_IF([{ - cp -p conftest.${ac_objext} conftest.${ac_objext}.save && - $DTRACE ${DTRACE_OPT} -G -s conftest_provider.d conftest.${ac_objext} 2>/dev/null && - : - }], [ - AS_IF([cmp -s conftest.o conftest.${ac_objext}.save], [ - rb_cv_prog_dtrace_g=yes - ], [ - rb_cv_prog_dtrace_g=rebuild - ]) - ])]) - ]) - rm -f conftest.[co] conftest_provider.[dho] -]) -]) +m4_include([tool/m4/ruby_dtrace_available.m4])dnl +m4_include([tool/m4/ruby_dtrace_postprocess.m4])dnl AC_CHECK_PROG([DTRACE], [${ac_tool_prefix}dtrace], [${ac_tool_prefix}dtrace]) AS_IF([test "$cross_compiling:$ac_cv_prog_DTRACE" = no: -a -n "$ac_tool_prefix"], [ @@ -637,23 +413,7 @@ AC_SUBST(CHDIR) https://github.com/ruby/ruby/blob/trunk/configure.ac#L413 } { # compiler section -AC_DEFUN([RUBY_WERROR_FLAG], [dnl -save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS $rb_cv_warnflags" -AS_IF([test "${ac_c_werror_flag+set}"], [ - rb_c_werror_flag="$ac_c_werror_flag" -], [ - unset rb_c_werror_flag -]) -ac_c_werror_flag=yes -$1 -CFLAGS="$save_CFLAGS" -save_CFLAGS= -AS_IF([test "${rb_c_werror_flag+set}"], [ - ac_c_werror_flag="$rb_c_werror_flag" -], [ - unset ac_c_werror_flag -])]) +m4_include([tool/m4/ruby_werror_flag.m4])dnl RUBY_WERROR_FLAG([ AC_MSG_CHECKING([whether CFLAGS is valid]) @@ -683,32 +443,8 @@ RUBY_WERROR_FLAG([ https://github.com/ruby/ruby/blob/trunk/configure.ac#L443 cd .. && rm -fr tmp.$$.try_link ]) -AC_DEFUN([RUBY_TRY_CFLAGS], [ - AC_MSG_CHECKING([whether ]$1[ is accepted as CFLAGS]) - RUBY_WERROR_FLAG([ - CFLAGS="[$]CFLAGS $1" - AC_TRY_COMPILE([$4], [$5], - [$2 - AC_MSG_RESULT(yes)], - [$3 - AC_MSG_RESULT(no)]) - ]) -]) - -AC_DEFUN([RUBY_TRY_LDFLAGS], [ - save_LDFLAGS="$LDFLAGS" - LDFLAGS="[$]LDFLAGS $1" - AC_MSG_CHECKING([whether $1 is accepted as LDFLAGS]) - RUBY_WERROR_FLAG([ - AC_TRY_LINK([$4], [$5], - [$2 - AC_MSG_RESULT(yes)], - [$3 - AC_MSG_RESULT(no)]) - ]) - LDFLAGS="$save_LDFLAGS" - save_LDFLAGS= -]) +m4_include([tool/m4/ruby_try_cflags.m4])dnl +m4_include([tool/m4/ruby_try_ldflags.m4])dnl : ${DLDFLAGS="$LDFLAGS"} : ${RPATHFLAG=''} @@ -1404,113 +1140,7 @@ AC_CACHE_CHECK([char bit], [rb_cv_char_b https://github.com/ruby/ruby/blob/trunk/configure.ac#L1140 [AC_INCLUDES_DEFAULT([@%:@include <limits.h>])], [rb_cv_char_bit=8]) test "$universal_binary" = yes && cross_compiling=$real_cross_compiling]) -dnl RUBY_CHECK_SIZEOF [typename], [maybe same size types], [macros], [include] -AC_DEFUN([RUBY_CHECK_SIZEOF], -[dnl -AS_VAR_PUSHDEF([rbcv_var], [rbcv_sizeof_var])dnl -AS_VAR_PUSHDEF([cond], [rbcv_sizeof_cond])dnl -AS_VAR_PUSHDEF([t], [rbcv_sizeof_type])dnl -AS_VAR_PUSHDEF([s], [rbcv_sizeof_size])dnl -] -[m4_bmatch([$1], [\.], [], [if test "$universal_binary" = yes; then]) -AC_CACHE_CHECK([size of $1], [AS_TR_SH([ac_cv_sizeof_$1])], [ - unset AS_TR_SH(ac_cv_sizeof_$1) - rbcv_var=" -typedef m4_bpatsubst([$1], [\..*]) ac__type_sizeof_; -static ac__type_sizeof_ *rbcv_ptr; -@%:@define AS_TR_CPP(SIZEOF_$1) sizeof((*rbcv_ptr)[]m4_bmatch([$1], [\.], .m4_bpatsubst([$1], [^[^.]*\.]))) -" - m4_ifval([$2], [test -z "${AS_TR_SH(ac_cv_sizeof_$1)+set}" && { - for t in $2; do - AC_COMPILE_IFELSE( - [AC_LANG_BOOL_COMPILE_TRY(AC_INCLUDES_DEFAULT([$4] - [$rbcv_var]), - [AS_TR_CPP(SIZEOF_$1) == sizeof($t)])], [ - 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 - for t in $3; do - cond="${cond} -@%:@${cond+el}if defined(__${t}${s}__) || defined(__${t}${s}) || defined(_${t}${s}) || defined(${t}${s})" - hdr="AC_INCLUDES_DEFAULT([$4 -@%:@if defined(__${t}${s}__) || defined(__${t}${s}) || defined(_${t}${s}) || defined(${t}${s}) -@%:@ define AS_TR_CPP(HAVE_$1) 1 -@%:@else -@%:@ define AS_TR_CPP(HAVE_$1) 0 -@%:@endif])" - AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$hdr], [!AS_TR_CPP(HAVE_$1)])], [continue]) - AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$hdr] - [$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 - AC_COMPUTE_INT([t], AS_TR_CPP(SIZEOF_$1), [AC_INCLUDES_DEFAULT([$4])] -[${cond+$cond -@%:@else} -$rbcv_var -${cond+@%:@endif} -@%:@ifndef AS_TR_CPP(SIZEOF_$1) -@%:@define AS_TR_CPP(SIZEOF_$1) 0 -@%:@endif], [t=0]) - test "$universal_binary" = yes && cross_compiling=$real_cross_compiling - AS_IF([test ${t-0} != 0], [ - AS_TR_SH(ac_cv_sizeof_$1)="${AS_TR_SH(ac_cv_sizeof_$1)+${AS_TR_SH(ac_cv_sizeof_$1)-} }${t}" - ]) - } - : ${AS_TR_SH(ac_cv_sizeof_$1)=0} -]) -{ - unset cond - for t in ${AS_TR_SH(ac_cv_sizeof_$1)-}; do - AS_CASE(["$t"], - [[[0-9]*|SIZEOF_*]], [ - ${cond+echo "@%:@else"} - echo "[@%:@define ]AS_TR_CPP(SIZEOF_$1) $t" - break - ], - [ - s=`expr $t : ['.*[^0-9]\([0-9][0-9]*\)$']` - 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 - ]) - done - ${cond+echo "@%:@endif"} -} >> confdefs.h -m4_bmatch([$1], [\.], [], [else -AC_CHECK_SIZEOF([$1], 0, [$4]) -fi]) -AS_VAR_POPDEF([rbcv_var])dnl -AS_VAR_POPDEF([cond])dnl -AS_VAR_POPDEF([t])dnl -AS_VAR_POPDEF([s])dnl -]) +m4_include([tool/m4/ruby_check_sizeof.m4])dnl RUBY_CHECK_SIZEOF(int, [], [ILP]) RUBY_CHECK_SIZEOF(short) @@ -1542,30 +1172,7 @@ AS_IF([test "$rb_cv_packed_struct" != no https://github.com/ruby/ruby/blob/trunk/configure.ac#L1172 AC_DEFINE_UNQUOTED([PACKED_STRUCT(x)], x) ]) -AC_DEFUN([RUBY_CHECK_PRINTF_PREFIX], [ -AC_CACHE_CHECK([for printf prefix for $1], [rb_cv_pri_prefix_]AS_TR_SH($1),[ - [rb_cv_pri_prefix_]AS_TR_SH($1)=[NONE] - RUBY_WERROR_FLAG(RUBY_APPEND_OPTIONS(CFLAGS, $rb_cv_wsuppress_flags) - for pri in $2; do - AC_TRY_COMPILE( - [@%:@include <stdio.h> - @%:@include <stddef.h> - @%:@ifdef __GNUC__ - @%:@define PRINTF_ARGS(decl, string_index, first_to_check) \ - decl __attribute__((format(printf, string_index, first_to_check))) - @%:@else - @%:@define PRINTF_ARGS(decl, string_index, first_to_ch (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/