ruby-changes:66373
From: Nobuyoshi <ko1@a...>
Date: Mon, 31 May 2021 23:04:57 +0900 (JST)
Subject: [ruby-changes:66373] 29bbad9399 (ruby_2_7): Fix 2.7 build (#4359)
https://git.ruby-lang.org/ruby.git/commit/?id=29bbad9399 From 29bbad939939c6dceb804aac667ba372fdee4ef5 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Mon, 31 May 2021 23:04:44 +0900 Subject: Fix 2.7 build (#4359) * merge revision(s) fcc88da5eb162043adcba552646677d2ab5adf55: configure.ac: fix for upcoming autoconf-2.70 The failure initially noticed on `autoconf-2.69d` (soon to become 2.70): ``` $ ./configure ./configure: line 8720: syntax error near unexpected token `fi' ./configure: line 8720: `fi' ``` Before the change generated `./configure ` snippet looked like: ``` if ! $CC -E -xc - <<SRC >/dev/null then : #if defined __APPLE_CC__ && defined __clang_major__ && __clang_major__ < 3 #error premature clang #endif SRC as_fn_error $? "clang version 3.0 or later is required" "$LINENO" 5 fi ``` Note the newline that breaks here-document syntax. After the change the snippet does not use here-document. Signed-off-by: Sergei Trofimovich <slyfox@g...> --- configure.ac | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) * merge revision(s) 0df67a469561fab80b78478b99703ed893c4db07: Signal handler type should be void --- configure.ac | 1 - include/ruby/internal/intern/signal.h | 3 +-- signal.c | 14 +++++++------- vm_core.h | 2 +- win32/Makefile.sub | 1 - 5 files changed, 9 insertions(+), 12 deletions(-) * merge revision(s) 4d2ad8d737c55c3efd4c75131687dd1c8db7441b: Removed obsolete autoconf checks Use regular `AC_CHECK_MEMBERS` instead of: * `AC_STRUCT_ST_BLKSIZE` * `AC_STRUCT_ST_BLOCKS` * `AC_STRUCT_ST_RDEV` --- configure.ac | 6 +++--- missing/fileblocks.c | 1 - win32/Makefile.sub | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) delete mode 100644 missing/fileblocks.c * merge revision(s) 3b7c05ef8dc15371316e5254d33af12928183971: Fixed RUBY_RM_RECURSIVE when autoconf met the required version Before 9189cf5793cd527a86b711d15d5fd0633ec082e1 the result of `m4_version_compare` was compared to -1, however the `$2` of `m4_version_prereq` has different meaning and is expanded when the required version met. --- tool/m4/ruby_rm_recursive.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) * merge revision(s) c32375883a696fcf8e9e99875f1339ee5474a255,48bb0329eb325bc5b77c222f45b8dc97a208d986: Update for autoconf 2.70 --- configure.ac | 232 +++++++++++++++++------------------ tool/m4/ruby_check_builtin_setjmp.m4 | 8 +- tool/m4/ruby_check_printf_prefix.m4 | 9 +- tool/m4/ruby_check_setjmp.m4 | 6 +- tool/m4/ruby_check_sysconf.m4 | 6 +- tool/m4/ruby_cppoutfile.m4 | 4 +- tool/m4/ruby_decl_attribute.m4 | 4 +- tool/m4/ruby_dtrace_available.m4 | 2 +- tool/m4/ruby_dtrace_postprocess.m4 | 2 +- tool/m4/ruby_mingw32.m4 | 4 +- tool/m4/ruby_stack_grow_direction.m4 | 4 +- tool/m4/ruby_try_cflags.m4 | 2 +- tool/m4/ruby_try_cxxflags.m4 | 2 +- tool/m4/ruby_try_ldflags.m4 | 2 +- 14 files changed, 143 insertions(+), 144 deletions(-) Revert AC_PROG_CC_C99 for -std=gnu99 option to gcc 4.8 --- configure.ac | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) Co-authored-by: Sergei Trofimovich <slyfox@g...> --- configure.ac | 272 ++++++++++++++++++----------------- missing/fileblocks.c | 1 - tool/m4/ruby_check_builtin_setjmp.m4 | 8 +- tool/m4/ruby_check_printf_prefix.m4 | 9 +- tool/m4/ruby_check_setjmp.m4 | 6 +- tool/m4/ruby_check_sysconf.m4 | 6 +- tool/m4/ruby_cppoutfile.m4 | 4 +- tool/m4/ruby_decl_attribute.m4 | 4 +- tool/m4/ruby_dtrace_available.m4 | 2 +- tool/m4/ruby_dtrace_postprocess.m4 | 2 +- tool/m4/ruby_mingw32.m4 | 4 +- tool/m4/ruby_rm_recursive.m4 | 4 +- tool/m4/ruby_stack_grow_direction.m4 | 4 +- tool/m4/ruby_try_cflags.m4 | 2 +- tool/m4/ruby_try_ldflags.m4 | 2 +- win32/Makefile.sub | 1 - 16 files changed, 167 insertions(+), 164 deletions(-) delete mode 100644 missing/fileblocks.c diff --git a/configure.ac b/configure.ac index af170ef..826a688 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/configure.ac#L1 dnl Process this file with autoconf to produce a configure script. -AC_INIT() +AC_INIT { AC_CONFIG_AUX_DIR(tool) AC_CONFIG_MACRO_DIRS(tool/m4) @@ -150,6 +150,9 @@ AC_ARG_ENABLE(load-relative, https://github.com/ruby/ruby/blob/trunk/configure.ac#L150 AC_ARG_PROGRAM +# checks for UNIX variants that set C preprocessor variables +AC_USE_SYSTEM_EXTENSIONS + dnl Checks for programs. cflagspat= @@ -177,12 +180,14 @@ AS_CASE(["$host_os:$build_os"], https://github.com/ruby/ruby/blob/trunk/configure.ac#L180 # clang version 1.0 (http://llvm.org/svn/llvm-project/cfe/tags/Apple/clang-23 exported) # Apple clang version 2.0 (tags/Apple/clang-137) (based on LLVM 2.9svn) # Apple clang version 2.1 (tags/Apple/clang-163.7.1) (based on LLVM 3.0svn) - AS_IF([! $CC -E -xc - <<SRC >/dev/null], [ - @%:@if defined __APPLE_CC__ && defined __clang_major__ && __clang_major__ < 3 - @%:@error premature clang - @%:@endif -SRC - AC_MSG_ERROR([clang version 3.0 or later is required]) + AC_PREPROC_IFELSE( + [AC_LANG_PROGRAM([ + @%:@if defined __APPLE_CC__ && defined __clang_major__ && __clang_major__ < 3 + @%:@error premature clang + @%:@endif + ])], + [], + [AC_MSG_ERROR([clang version 3.0 or later is required]) ])], [openbsd*:openbsd*], [ AC_CHECK_TOOLS(CC, [cc]) @@ -191,7 +196,9 @@ AS_IF([test x"${build}" != x"${host}"], [ https://github.com/ruby/ruby/blob/trunk/configure.ac#L196 AC_CHECK_TOOL(CC, gcc) ]) -AC_PROG_CC_C99 +dnl Seems necessarily in order to add -std=gnu99 option for gcc 4.9. +m4_version_prereq([2.70], [], [AC_PROG_CC_C99]) + AS_CASE([$CC], [gcc-*], [ gcc_prefix=gcc- gcc_suffix=`echo "$CC" | sed 's/^gcc//'` @@ -223,12 +230,12 @@ test -z "$CXX" || ac_cv_prog_CXX="$CXX" https://github.com/ruby/ruby/blob/trunk/configure.ac#L230 AS_CASE(["$target_os"], [darwin*], [ AC_MSG_CHECKING(if minimum required OS X version is supported) - AC_TRY_CPP([@%:@include <AvailabilityMacros.h> + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include <AvailabilityMacros.h> @%:@if MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_5 @%:@error pre OS X 10.5 [!<===== pre OS X 10.5 =====>] @%:@endif - ], + ]])], [macosx_min_required=yes], [AC_MSG_RESULT(no) AC_MSG_ERROR([Unsupported OS X version is required])]) @@ -359,8 +366,8 @@ AS_CASE(["$target_os"], https://github.com/ruby/ruby/blob/trunk/configure.ac#L366 [mingw*], [ test "$rb_cv_msvcrt" = "" && unset rb_cv_msvcrt AC_CACHE_CHECK(for mingw32 runtime DLL, rb_cv_msvcrt, [ - AC_TRY_LINK([@%:@include <stdio.h>], - [FILE* volatile f = stdin; return 0;], + AC_LINK_IFELSE([AC_LANG_PROGRAM([[@%:@include <stdio.h>]], + [[FILE* volatile f = stdin; return 0;]])], [rb_cv_msvcrt=`$OBJDUMP -p conftest$ac_exeext | tr A-Z a-z | sed -n '/^[[ ]]*dll name: \(msvc.*\)\.dll$/{s//\1/p;q;}'`], @@ -403,9 +410,6 @@ AC_CHECK_PROGS(DOXYGEN, doxygen) https://github.com/ruby/ruby/blob/trunk/configure.ac#L410 AC_CHECK_PROG(PKG_CONFIG, pkg-config, [pkg-config], [], [], [`"$as_dir/$ac_word$ac_exec_ext" --print-errors --version > /dev/null 2>&1 || echo "$as_dir/$ac_word$ac_exec_ext"`]) -# checks for UNIX variants that set C preprocessor variables -AC_USE_SYSTEM_EXTENSIONS - AC_SUBST(RM, ['rm -f']) AC_SUBST(CP, ['cp']) RMDIRS='$(top_srcdir)/tool/rmdirs' @@ -441,7 +445,7 @@ AC_SUBST(CHDIR) https://github.com/ruby/ruby/blob/trunk/configure.ac#L445 : "compiler section" && { RUBY_WERROR_FLAG([ AC_MSG_CHECKING([whether CFLAGS is valid]) - AC_TRY_COMPILE([], [], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [AC_MSG_RESULT(yes)], [ AC_MSG_RESULT(no) @@ -457,7 +461,7 @@ RUBY_WERROR_FLAG([ https://github.com/ruby/ruby/blob/trunk/configure.ac#L461 echo '<?xml?><plist><dict><key>CFBundleIdentifier</key><string></string></dict></plist>' > Info.plist && : } || AC_MSG_ERROR([failed to make temporary directory]) - AC_TRY_LINK([], [], + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [AC_MSG_RESULT(yes)], [ cd .. && rm -fr tmp.$$.try_link @@ -639,13 +643,13 @@ AS_IF([test "$GCC" = yes], [ https://github.com/ruby/ruby/blob/trunk/configure.ac#L643 ], [ CFLAGS="$CFLAGS -Werror -Wuninitialized" ]) - AC_TRY_COMPILE([@%:@include <math.h> + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h> int foo(double x) { int exp; frexp(x, &exp); return exp; - }], [if (foo(0.0)) return 1;], + }]], [[if (foo(0.0)) return 1;]])], [rb_cv_mingw64_broken_frexp_modf=no], [rb_cv_mingw64_broken_frexp_modf=yes]) CFLAGS="$save_CFLAGS" @@ -735,13 +739,13 @@ AS_IF([test "$GCC" = yes], [ https://github.com/ruby/ruby/blob/trunk/configure.ac#L739 AS_CASE(["$target_cpu"], [[i[3-6]86*]], [ AC_CACHE_CHECK([for __sync_val_compare_and_swap], [rb_cv_gcc_compiler_cas], [ - AC_TRY_LINK([unsigned long atomic_var;], - [__sync_val_compare_and_swap(&atomic_var, 0, 1);], + AC_LINK_IFELSE([AC_LANG_PROGRAM([[unsigned long atomic_var;]], + [[__sync_val_compare_and_swap(&atomic_var, 0, 1);]])], [rb_cv_gcc_compiler_cas=yes], [ save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -march=i486" - AC_TRY_LINK([unsigned long atomic_var;], - [__sync_val_compare_and_swap(&atomic_var, 0, 1);], + AC_LINK_IFELSE([AC_LANG_PROGRAM([[unsigned long atomic_var;]], + [[__sync_val_compare_and_swap(&atomic_var, 0, 1);]])], [rb_cv_gcc_compiler_cas=i486], [rb_cv_gcc_compiler_cas=no]) CFLAGS="$save_CFLAGS" @@ -768,7 +772,7 @@ test - (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/