diff options
Diffstat (limited to 'configure.ac')
| -rw-r--r-- | configure.ac | 1303 |
1 files changed, 850 insertions, 453 deletions
diff --git a/configure.ac b/configure.ac index a9fc9932ae..2de91209d6 100644 --- a/configure.ac +++ b/configure.ac @@ -9,49 +9,69 @@ tooldir="$srcdir/tool" AC_DISABLE_OPTION_CHECKING -m4_include([tool/m4/_colorize_result_prepare.m4])dnl -m4_include([tool/m4/ac_msg_result.m4])dnl -m4_include([tool/m4/colorize_result.m4])dnl -m4_include([tool/m4/ruby_append_option.m4])dnl -m4_include([tool/m4/ruby_append_options.m4])dnl -m4_include([tool/m4/ruby_check_builtin_func.m4])dnl -m4_include([tool/m4/ruby_check_builtin_setjmp.m4])dnl -m4_include([tool/m4/ruby_check_printf_prefix.m4])dnl -m4_include([tool/m4/ruby_check_setjmp.m4])dnl -m4_include([tool/m4/ruby_check_signedness.m4])dnl -m4_include([tool/m4/ruby_check_sizeof.m4])dnl -m4_include([tool/m4/ruby_check_sysconf.m4])dnl -m4_include([tool/m4/ruby_cppoutfile.m4])dnl -m4_include([tool/m4/ruby_decl_attribute.m4])dnl -m4_include([tool/m4/ruby_default_arch.m4])dnl -m4_include([tool/m4/ruby_define_if.m4])dnl -m4_include([tool/m4/ruby_defint.m4])dnl -m4_include([tool/m4/ruby_dtrace_available.m4])dnl -m4_include([tool/m4/ruby_dtrace_postprocess.m4])dnl -m4_include([tool/m4/ruby_func_attribute.m4])dnl -m4_include([tool/m4/ruby_mingw32.m4])dnl -m4_include([tool/m4/ruby_prepend_option.m4])dnl -m4_include([tool/m4/ruby_prog_gnu_ld.m4])dnl -m4_include([tool/m4/ruby_prog_makedirs.m4])dnl -m4_include([tool/m4/ruby_replace_funcs.m4])dnl -m4_include([tool/m4/ruby_replace_type.m4])dnl -m4_include([tool/m4/ruby_require_funcs.m4])dnl -m4_include([tool/m4/ruby_rm_recursive.m4])dnl -m4_include([tool/m4/ruby_setjmp_type.m4])dnl -m4_include([tool/m4/ruby_stack_grow_direction.m4])dnl -m4_include([tool/m4/ruby_thread.m4])dnl -m4_include([tool/m4/ruby_try_cflags.m4])dnl -m4_include([tool/m4/ruby_try_cxxflags.m4])dnl -m4_include([tool/m4/ruby_try_ldflags.m4])dnl -m4_include([tool/m4/ruby_universal_arch.m4])dnl -m4_include([tool/m4/ruby_wasm_tools.m4])dnl -m4_include([tool/m4/ruby_werror_flag.m4])dnl +m4_define([RUBY_M4_INCLUDED], [])dnl +AC_DEFUN([RUBY_M4_INCLUDE], [m4_include([tool/m4/$1])dnl + m4_append([RUBY_M4_INCLUDED], [ \ + $(tooldir)/m4/$1])dnl +]) +RUBY_M4_INCLUDE([_colorize_result_prepare.m4])dnl +RUBY_M4_INCLUDE([ac_msg_result.m4])dnl +RUBY_M4_INCLUDE([colorize_result.m4])dnl +RUBY_M4_INCLUDE([ruby_append_option.m4])dnl +RUBY_M4_INCLUDE([ruby_append_options.m4])dnl +RUBY_M4_INCLUDE([ruby_check_builtin_func.m4])dnl +RUBY_M4_INCLUDE([ruby_check_builtin_overflow.m4])dnl +RUBY_M4_INCLUDE([ruby_check_builtin_setjmp.m4])dnl +RUBY_M4_INCLUDE([ruby_check_header.m4])dnl +RUBY_M4_INCLUDE([ruby_check_printf_prefix.m4])dnl +RUBY_M4_INCLUDE([ruby_check_setjmp.m4])dnl +RUBY_M4_INCLUDE([ruby_check_signedness.m4])dnl +RUBY_M4_INCLUDE([ruby_check_sizeof.m4])dnl +RUBY_M4_INCLUDE([ruby_check_sysconf.m4])dnl +RUBY_M4_INCLUDE([ruby_cppoutfile.m4])dnl +RUBY_M4_INCLUDE([ruby_decl_attribute.m4])dnl +RUBY_M4_INCLUDE([ruby_default_arch.m4])dnl +RUBY_M4_INCLUDE([ruby_define_if.m4])dnl +RUBY_M4_INCLUDE([ruby_defint.m4])dnl +RUBY_M4_INCLUDE([ruby_dtrace_available.m4])dnl +RUBY_M4_INCLUDE([ruby_dtrace_postprocess.m4])dnl +RUBY_M4_INCLUDE([ruby_func_attribute.m4])dnl +RUBY_M4_INCLUDE([ruby_mingw32.m4])dnl +RUBY_M4_INCLUDE([ruby_prepend_option.m4])dnl +RUBY_M4_INCLUDE([ruby_prog_gnu_ld.m4])dnl +RUBY_M4_INCLUDE([ruby_prog_makedirs.m4])dnl +RUBY_M4_INCLUDE([ruby_replace_funcs.m4])dnl +RUBY_M4_INCLUDE([ruby_replace_type.m4])dnl +RUBY_M4_INCLUDE([ruby_require_funcs.m4])dnl +RUBY_M4_INCLUDE([ruby_rm_recursive.m4])dnl +RUBY_M4_INCLUDE([ruby_setjmp_type.m4])dnl +RUBY_M4_INCLUDE([ruby_modular_gc.m4])dnl +RUBY_M4_INCLUDE([ruby_stack_grow_direction.m4])dnl +RUBY_M4_INCLUDE([ruby_thread.m4])dnl +RUBY_M4_INCLUDE([ruby_try_cflags.m4])dnl +RUBY_M4_INCLUDE([ruby_try_cxxflags.m4])dnl +RUBY_M4_INCLUDE([ruby_try_ldflags.m4])dnl +RUBY_M4_INCLUDE([ruby_universal_arch.m4])dnl +RUBY_M4_INCLUDE([ruby_wasm_tools.m4])dnl +RUBY_M4_INCLUDE([ruby_werror_flag.m4])dnl + +AS_IF([test "x${GITHUB_ACTIONS}" = xtrue], +[AC_REQUIRE([_COLORIZE_RESULT_PREPARE])dnl +dnl 93(bright yellow) is copied from .github/workflows/mingw.yml + begin_group() { AS_ECHO(["::group::@<:@93m$[]1@<:@m"]);} + end_group() { AS_ECHO(["::endgroup::"]);} +], +[dnl + begin_group() { :;} + end_group() { :;} +]) AC_ARG_VAR([cflags], [additional CFLAGS (ignored when CFLAGS is given)])dnl AC_ARG_VAR([cppflags], [additional CPPFLAGS (ignored when CPPFLAGS is given)])dnl AC_ARG_VAR([cxxflags], [additional CXXFLAGS (ignored when CXXFLAGS is given)])dnl +AC_ARG_VAR([rustc_flags], [additional RUSTC_FLAGS])dnl -: "environment section" && { +[begin]_group "environment section" && { HAVE_BASERUBY=yes BASERUBY_VERSION= AC_ARG_WITH(baseruby, @@ -63,33 +83,71 @@ AC_ARG_WITH(baseruby, ], [ AC_PATH_PROG([BASERUBY], [ruby], [false]) + HAVE_BASERUBY= ]) -AS_IF([test "$HAVE_BASERUBY" != no -a "`RUBYOPT=- $BASERUBY --disable=gems -e 'print 42 if RUBY_VERSION > "2.2"' 2>/dev/null`" = 42], [ +AS_IF([test "$HAVE_BASERUBY" = no], [ + # --without-baseruby +], [error=`RUBYOPT=- $BASERUBY --disable=gems "${tooldir}/missing-baseruby.bat" --verbose 2>&1`], [ + HAVE_BASERUBY=yes +], [test "$HAVE_BASERUBY" = ""], [ # no --with-baseruby option + AC_MSG_WARN($error) # just warn and continue + HAVE_BASERUBY=no +], [ # the ruby given by --with-baseruby is too old + AC_MSG_ERROR($error) # bail out +]) +AS_IF([test "${HAVE_BASERUBY:=no}" != no], [ AS_CASE(["$build_os"], [mingw*], [ # Can MSys shell run a command with a drive letter? RUBYOPT=- `cygpath -ma "$BASERUBY"` --disable=gems -e exit 2>/dev/null || HAVE_BASERUBY=no ]) - BASERUBY="$BASERUBY --disable=gems" + RUBY_APPEND_OPTION(BASERUBY, "--disable=gems") BASERUBY_VERSION=`$BASERUBY -v` $BASERUBY -C "$srcdir" tool/downloader.rb -d tool -e gnu config.guess config.sub >&AS_MESSAGE_FD -], [ - HAVE_BASERUBY=no ]) AS_IF([test "$HAVE_BASERUBY" = no], [ - BASERUBY="echo executable host ruby is required. use --with-baseruby option.; false" + AS_IF([test "$cross_compiling" = yes], [AC_MSG_ERROR([executable host ruby is required for cross-compiling])]) + BASERUBY=${tooldir}/missing-baseruby.bat ]) AC_SUBST(BASERUBY) AC_SUBST(HAVE_BASERUBY) +AS_IF([test "$cross_compiling" = yes], + [X_BUILD_EXEEXT=`$BASERUBY -rrbconfig -e ['puts RbConfig::CONFIG["EXEEXT"]']`], + [X_BUILD_EXEEXT='$(EXEEXT)'] +) +AC_SUBST(X_BUILD_EXEEXT) + +AC_ARG_WITH(dump-ast, + AS_HELP_STRING([--with-dump-ast=DUMP_AST], [use DUMP_AST as dump_ast; for cross-compiling with a host-built dump_ast]), + [DUMP_AST=$withval DUMP_AST_TARGET='$(empty)'], + [AS_IF([test "$cross_compiling" = yes], [ + DUMP_AST='build-tool/dump_ast$(BUILD_EXEEXT)' + ], [ + DUMP_AST='./dump_ast$(BUILD_EXEEXT)' + ]) + DUMP_AST_TARGET='$(DUMP_AST)']) +dnl Without baseruby, .rbinc files cannot be regenerated, so clear the +dnl dependency on dump_ast to avoid rebuilding pre-generated .rbinc files. +AS_IF([test "$HAVE_BASERUBY" = no], [DUMP_AST_TARGET='$(empty)']) +AC_SUBST(X_DUMP_AST, "${DUMP_AST}") +AC_SUBST(X_DUMP_AST_TARGET, "${DUMP_AST_TARGET}") : ${GIT=git} HAVE_GIT=yes AC_ARG_WITH(git, AS_HELP_STRING([--without-git], [never use git]), [AS_CASE([$withval], - [no], [GIT=never-use HAVE_GIT=no], + [no], [HAVE_GIT=no], [yes], [], [GIT=$withval])]) -AS_IF([test x"$HAVE_GIT" = xyes], [command -v "$GIT" > /dev/null || HAVE_GIT=no]) +{ + test x"$HAVE_GIT" = xyes && + command -v "$GIT" > /dev/null && + # `git -C`: 1.8.5 + # `git log --no-show-signature`: 2.10.0 + AS_CASE([`$GIT -C . --version 2> /dev/null | sed 's/.* //'`], + [0.*|1.*|2.@<:@0-9@:>@.*], [false], + [true]) +} || HAVE_GIT=no GIT=never-use AC_SUBST(GIT) AC_SUBST(HAVE_GIT) @@ -128,12 +186,16 @@ dnl checks for alternative programs AC_CANONICAL_BUILD AC_CANONICAL_HOST AC_CANONICAL_TARGET +AC_SUBST(config_target, $target) AS_CASE(["$target_cpu-$target_os"], [aarch64-darwin*], [ target_cpu=arm64 - AS_CASE(["$target_vendor"], [unknown], [target_vendor=apple target=${target/-unknown-/-apple-}]) - target="${target/aarch64/arm64}" - target_alias="${target_alias/aarch64/arm64}" + AS_CASE(["$target_vendor"], [unknown], [ + target_vendor=apple + target=${target%%-unknown-*}-apple-${target@%:@*-unknown-} + ]) + target="arm64-${target@%:@aarch64-}" + AS_IF([test -n "$target_alias"], [target_alias="arm64-${target_alias@%:@aarch64-}"]) ]) AC_ARG_PROGRAM @@ -183,7 +245,7 @@ AC_ARG_VAR([STRIP], [Strip command]) set rb_dummy ${CC} rb_CC=$2 AC_DEFUN([RUBY_CHECK_PROG_FOR_CC], [ - rb_prog=`echo "${rb_CC}" | sed "$2"` + rb_prog=`echo "${rb_CC}" | sed ["s:$2\([^/]*\)$:$3\1:"]` AC_CHECK_PROG([$1], [$rb_prog], [$rb_prog]) ]) AS_CASE(["/${rb_CC} "], @@ -194,30 +256,43 @@ AS_CASE(["/${rb_CC} "], [*icc*], [ # Intel C++ has interprocedural optimizations. It tends to come with its # own linker etc. - RUBY_CHECK_PROG_FOR_CC([AR], [s/icc/xiar/]) - RUBY_CHECK_PROG_FOR_CC([CXX], [s/icc/icpc/]) - RUBY_CHECK_PROG_FOR_CC([LD], [s/icc/xild/]) + RUBY_CHECK_PROG_FOR_CC([AR], [icc], [xiar]) + RUBY_CHECK_PROG_FOR_CC([CXX], [icc], [icpc]) + RUBY_CHECK_PROG_FOR_CC([LD], [icc], [xild]) ], [*gcc*], [ # Ditto for GCC. - RUBY_CHECK_PROG_FOR_CC([LD], [s/gcc/ld/]) - RUBY_CHECK_PROG_FOR_CC([AR], [s/gcc/gcc-ar/]) - RUBY_CHECK_PROG_FOR_CC([CXX], [s/gcc/g++/]) - RUBY_CHECK_PROG_FOR_CC([NM], [s/gcc/gcc-nm/]) - RUBY_CHECK_PROG_FOR_CC([RANLIB], [s/gcc/gcc-ranlib/]) + RUBY_CHECK_PROG_FOR_CC([LD], [gcc], [ld]) + RUBY_CHECK_PROG_FOR_CC([AR], [gcc], [gcc-ar]) + RUBY_CHECK_PROG_FOR_CC([CXX], [gcc], [g++]) + RUBY_CHECK_PROG_FOR_CC([NM], [gcc], [gcc-nm]) + RUBY_CHECK_PROG_FOR_CC([RANLIB], [gcc], [gcc-ranlib]) ], [*clang*], [ # Ditto for LLVM. Note however that llvm-as is a LLVM-IR to LLVM bitcode # assembler that does not target your machine native binary. - : ${LD:="${CC}"} # ... try -fuse-ld=lld ? - RUBY_CHECK_PROG_FOR_CC([AR], [s/clang/llvm-ar/]) -# RUBY_CHECK_PROG_FOR_CC([AS], [s/clang/llvm-as/]) - RUBY_CHECK_PROG_FOR_CC([CXX], [s/clang/clang++/]) - RUBY_CHECK_PROG_FOR_CC([NM], [s/clang/llvm-nm/]) - RUBY_CHECK_PROG_FOR_CC([OBJCOPY], [s/clang/llvm-objcopy/]) - RUBY_CHECK_PROG_FOR_CC([OBJDUMP], [s/clang/llvm-objdump/]) - RUBY_CHECK_PROG_FOR_CC([RANLIB], [s/clang/llvm-ranlib/]) - RUBY_CHECK_PROG_FOR_CC([STRIP], [s/clang/llvm-strip/]) + + # Xcode has its own version tools that may be incompatible with + # genuine LLVM tools, use the tools in the same directory. + + AS_IF([$rb_CC -E -dM -xc - < /dev/null | grep -F __apple_build_version__ > /dev/null], + [llvm_prefix=], [llvm_prefix=llvm-]) + # AC_PREPROC_IFELSE cannot be used before AC_USE_SYSTEM_EXTENSIONS + + RUBY_CHECK_PROG_FOR_CC([LD], [clang], [ld]) # ... maybe try lld ? + RUBY_CHECK_PROG_FOR_CC([AR], [clang], [${llvm_prefix}ar]) +# RUBY_CHECK_PROG_FOR_CC([AS], [clang], [${llvm_prefix}as]) + RUBY_CHECK_PROG_FOR_CC([CXX], [clang], [clang++]) + RUBY_CHECK_PROG_FOR_CC([NM], [clang], [${llvm_prefix}nm]) + RUBY_CHECK_PROG_FOR_CC([OBJCOPY], [clang], [${llvm_prefix}objcopy]) + RUBY_CHECK_PROG_FOR_CC([OBJDUMP], [clang], [${llvm_prefix}objdump]) + RUBY_CHECK_PROG_FOR_CC([RANLIB], [clang], [${llvm_prefix}ranlib]) + RUBY_CHECK_PROG_FOR_CC([STRIP], [clang], [${llvm_prefix}strip]) + + # These -Wno-* flags silence clang-specific diagnostics that don't exist + # in GCC. GCC silently accepts unknown -Wno-* flags but later emits noisy + # "unrecognized command-line option" notes whenever another warning fires. + clang_warnflags="-Wno-constant-logical-operand -Wno-parentheses-equality -Wno-self-assign" ]) AS_UNSET(rb_CC) AS_UNSET(rb_dummy) @@ -230,7 +305,9 @@ AS_CASE(["${build_os}"], AC_PATH_TOOL([NM], [nm], [/usr/ccs/bin/nm], [/usr/ccs/bin:$PATH]) ]) AS_CASE(["${target_os}"], -[cygwin*|msys*|mingw*], [ +[cygwin*|msys*|mingw*|darwin*], [ + ac_ct_OBJCOPY=":" + ac_cv_prog_OBJCOPY=":" ac_cv_prog_ac_ct_OBJCOPY=":" ]) @@ -249,10 +326,16 @@ AC_CHECK_TOOLS([AR], [gar ar]) AC_CHECK_TOOLS([AS], [gas as]) AC_CHECK_TOOLS([LD], [gld ld]) # ... try gold ? AC_CHECK_TOOLS([NM], [gnm nm]) -AC_CHECK_TOOLS([OBJCOPY], [gobjcopy objcopy]) +AC_CHECK_TOOLS([OBJCOPY], [gobjcopy objcopy], [:]) AC_CHECK_TOOLS([OBJDUMP], [gobjdump objdump]) AC_CHECK_TOOLS([STRIP], [gstrip strip], [:]) +FIRSTMAKEFILE="" + +# nm errors with Rust's LLVM bitcode when Rust uses a newer LLVM version than nm. +# In case we're working with llvm-nm, tell it to not worry about the bitcode. +AS_IF([${NM} --help 2>&1 | grep -q 'llvm-bc'], [NM="$NM --no-llvm-bc"]) + AS_IF([test ! $rb_test_CFLAGS], [AS_UNSET(CFLAGS)]); AS_UNSET(rb_test_CFLAGS) AS_IF([test ! $rb_test_CXXFLAGS], [AS_UNSET(CXXFLAGS)]); AS_UNSET(rb_save_CXXFLAGS) @@ -325,7 +408,7 @@ test -z "$warnflags" || AS_IF([test -z "${CFLAGS+set}"], [ cflags=`echo " $cflags " | sed "$cflagspat;s/^ *//;s/ *$//"` orig_cflags="$cflags" - cflags="$cflags "'${optflags} ${debugflags} ${warnflags}' + cflags='${hardenflags} '"$cflags "'${optflags} ${debugflags} ${warnflags}' ]) dnl AS_IF([test -z "${CXXFLAGS+set}"], [ dnl cxxflags=`echo " $cxxflags " | sed "$cflagspat;s/^ *//;s/ *$//"` @@ -361,12 +444,6 @@ AS_CASE(["$target_os"], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no) AC_MSG_ERROR([Unsupported OS X version is required])]) - AC_CACHE_CHECK([if thread-local storage is supported], [rb_cv_tls_supported], - [AC_LINK_IFELSE([AC_LANG_PROGRAM([[int __thread conftest;]])], - [rb_cv_tls_supported=yes], - [rb_cv_tls_supported=no])]) - AS_IF([test x"$rb_cv_tls_supported" != xyes], - [AC_DEFINE(RB_THREAD_LOCAL_SPECIFIER_IS_UNSUPPORTED)]) ]) RUBY_MINGW32 @@ -400,33 +477,26 @@ AC_SUBST(OUTFLAG) AC_SUBST(COUTFLAG) AC_SUBST(CSRCFLAG) -: ${MJIT_CC=$CC} -AS_IF([test "x$cross_compiling" = xno], [ - AC_PATH_PROG([MJIT_CC], ${MJIT_CC}) - - # if $CC is in /usr/lib/ccache/$CC, search original $CC (disable ccache) - AS_IF([echo $RUBY_DEBUG | grep ci > /dev/null && - echo $MJIT_CC | grep ^/usr/lib/ccache > /dev/null], [ - PATH=`echo $PATH | sed "s/\/usr\/lib\/ccache://"` MJIT_CC=`which $CC`]) - - AS_CASE([$target_os], - [*mingw*], [command -v cygpath > /dev/null && MJIT_CC=`cygpath -ma $MJIT_CC`]) - shift 2 - MJIT_CC="$MJIT_CC${1+ }$*" -]) - AS_CASE(["$build_os"], - [darwin1*.*], [ + [darwin*], [ + # gcc 13 warns duplicate -l options, which are added by the + # default spec. # Xcode linker warns for deprecated architecture and wrongly # installed TBD files. - CC_WRAPPER="" + AC_MSG_CHECKING(for $CC linker warning) + suppress_ld_waring=no echo 'int main(void) {return 0;}' > conftest.c AS_IF([$CC -framework Foundation -o conftest conftest.c 2>&1 | - grep '^ld: warning: text-based stub file' >/dev/null], [ - CC_WRAPPER=`cd -P "${tooldir}" && pwd`/darwin-cc - CC="$CC_WRAPPER $CC" + grep \ + -e '^ld: warning: ignoring duplicate libraries:' \ + -e '^ld: warning: text-based stub file' \ + -e '^ld: warning: -multiply_defined is obsolete' \ + >/dev/null], [ + suppress_ld_waring=yes ]) rm -fr conftest* + test $suppress_ld_waring = yes && warnflags="${warnflags:+${warnflags} }-Wl,-w" + AC_MSG_RESULT($suppress_ld_waring) ]) AS_CASE(["$target_os"], [wasi*], [ @@ -436,6 +506,8 @@ AS_CASE(["$target_os"], # so wrap clang to insert our fake wasm-opt, which does nothing, in PATH. CC_WRAPPER=`cd -P "${tooldir}" && pwd`/wasm-clangw CC="$CC_WRAPPER $CC" + + FIRSTMAKEFILE=GNUmakefile:wasm/GNUmakefile.in ]) cc_version= @@ -453,8 +525,8 @@ AC_SUBST(CC_VERSION_MESSAGE, $cc_version_message) : ${DLDFLAGS="$LDFLAGS"} RUBY_UNIVERSAL_ARCH -AS_IF([test "$target_cpu" != "$host_cpu" -a "$GCC" = yes -a "$cross_compiling" = no -a "${universal_binary:-no}" = no], [ - RUBY_DEFAULT_ARCH("$target_cpu") +AS_IF([test "$target_cpu" != "$host_cpu" -a "$GCC" = yes -a "${universal_binary:-no}" = no], [ + RUBY_DEFAULT_ARCH($target_cpu) ]) host_os=$target_os host_vendor=$target_vendor @@ -467,7 +539,6 @@ AC_CACHE_CHECK([for $AR flags], [rb_cv_arflags], [ [rb_cv_arflags=rcD], [rb_cv_arflags=rcu]) ]) AC_SUBST(ARFLAGS, ["$rb_cv_arflags "]) -AC_SUBST(ASFLAGS) AS_CASE(["$target_os"], [cygwin*|msys*|mingw*], [ @@ -478,6 +549,8 @@ AS_CASE(["$target_os"], target_cpu=`echo $target_cpu | sed s/i.86/i386/` AS_CASE(["$target"], [-*], [ target="$target_cpu${target}"]) AS_CASE(["$target_alias"], [-*], [ target_alias="$target_cpu${target_alias}"]) + # cygwin/GNUmakefile.in is not exclusively for cygwin. + FIRSTMAKEFILE=GNUmakefile:cygwin/GNUmakefile.in AS_CASE(["$target_os"], [mingw*], [ test "$rb_cv_msvcrt" = "" && unset rb_cv_msvcrt @@ -496,6 +569,7 @@ AS_CASE(["$target_os"], AC_DEFINE_UNQUOTED(RUBY_MSVCRT_VERSION, $RT_VER) sysconfdir= ]) + rb_cv_binary_elf=no : ${enable_shared=yes} ], [hiuxmpp*], [AC_DEFINE(__HIUX_MPP__)]) # by TOYODA Eizi <toyoda@npd.kishou.go.jp> @@ -518,11 +592,16 @@ AS_IF([test "$cross_compiling:$ac_cv_prog_DTRACE" = no: -a -n "$ac_tool_prefix"] AC_CHECK_PROGS(DOT, dot) AC_CHECK_PROGS(DOXYGEN, doxygen) -for prog in ${ac_tool_prefix:+${ac_tool_prefix}pkg-config} pkg-config; do - AC_CHECK_PROG(PKG_CONFIG, $prog, [$prog], [], [], - [`"$as_dir/$ac_word$ac_exec_ext" --print-errors --version > /dev/null 2>&1 || echo "$as_dir/$ac_word$ac_exec_ext"`]) - test -z "${PKG_CONFIG}" || break -done +tool_warned=$ac_tool_warned ac_tool_warned=no +AC_CHECK_TOOL(PKG_CONFIG, pkg-config) +ac_tool_warned=$tool_warned +AS_IF([test -z "$PKG_CONFIG"], [], +["$PKG_CONFIG" --print-errors --version > /dev/null 2>&1], [], +[ + unset ac_cv_prog_PKG_CONFIG + PKG_CONFIG= + AC_MSG_WARN([$PKG_CONFIG does not work; ignore]) +]) AC_MSG_CHECKING([whether it is Android]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @@ -573,9 +652,25 @@ AS_IF([test -f conf$$.dir/src/cdcmd], [ rm -fr conf$$.dir AC_MSG_RESULT([$CHDIR]) AC_SUBST(CHDIR) + +AS_CASE(["$FIRSTMAKEFILE"], [*GNUmakefile:*], [gnumake=yes], [ + AC_MSG_CHECKING([if ${MAKE-make} is GNU make]) + mkdir conftest.dir + echo "all:; @echo yes" > conftest.dir/GNUmakefile + echo "all:; @echo no" > conftest.dir/Makefile + gnumake=`(cd conftest.dir; ${MAKE-make})` + rm -fr conftest.dir + AS_CASE(["$gnumake"], + [*yes*], [ + FIRSTMAKEFILE=GNUmakefile:template/GNUmakefile.in + gnumake=yes], + [ + gnumake=no]) + AC_MSG_RESULT($gnumake) +]) } -: "compiler section" && { +[begin]_group "compiler section" && { RUBY_WERROR_FLAG([ AC_MSG_CHECKING([whether CFLAGS is valid]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], @@ -605,22 +700,39 @@ RUBY_WERROR_FLAG([ cd .. && rm -fr tmp.$$.try_link ]) -: ${RPATHFLAG=''} -rpathflag='' -AS_IF([test x"${RPATHFLAG}" = x], [ - AS_CASE(["$target_os"], +: "rpath" && { + AC_CACHE_CHECK(whether ELF binaries are produced, rb_cv_binary_elf, + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[ + AS_CASE(["`head -1 conftest$EXEEXT | tr -dc '\177ELF' | tr '\177' .`"], + [.ELF*], [rb_cv_binary_elf=yes], [rb_cv_binary_elf=no])], + [rb_cv_binary_elf=no])]) + + rpathflag='' + AS_IF([test x"${RPATHFLAG=}" = x], [ + AS_CASE(["$target_os"], [aix*], [rpathflag='-blibpath:'], - [for rpathflag in -R "-rpath "; do + [for rpathflag in "-rpath " -R; do AS_CASE("$rpathflag", [*" "], [AS_CASE(["${linker_flag}"], [*,], [rpathflag=`echo "$rpathflag" | tr ' ' ,`])]) rpathflag="${linker_flag}${rpathflag}" RUBY_TRY_LDFLAGS([${rpathflag}.], [], [rpathflag=]) - AS_IF([test "x${rpathflag}" != x], []) + AS_IF([test "x${rpathflag}" != x], [break]) done]) -], [ - rpathflag=`echo "$RPATHFLAG" | sed 's/%.*//'` -]) + ], [ + rpathflag=`echo "$RPATHFLAG" | sed 's/%.*//'` + ]) + + AC_ARG_ENABLE(rpath, + AS_HELP_STRING([--enable-rpath], [embed run path into extension libraries. + enabled by default on ELF platforms]), + [enable_rpath=$enableval], [enable_rpath="$rb_cv_binary_elf"]) + + AS_IF([test "$enable_rpath:${RPATHFLAG}" = yes:], [ + RPATHFLAG="${rpathflag:+${rpathflag}%1\$-s}" + ]) + AS_CASE([${RPATHFLAG}],[*'%1$'*],[: ${LIBPATHFLAG='-L%1$-s'}],[: ${LIBPATHFLAG='-L%s'}]) +} RUBY_TRY_LDFLAGS(-fdeclspec, [fdeclspec=yes], [fdeclspec=no]) AS_IF([test "$fdeclspec" = yes], [ @@ -628,7 +740,7 @@ AS_IF([test "$fdeclspec" = yes], [ RUBY_APPEND_OPTIONS(cflags, -fdeclspec) RUBY_APPEND_OPTIONS(orig_cflags, -fdeclspec) ]) -RUBY_TRY_CXXFLAGS(-fdeclspec, [fdeclspec=yes], [fdeclspec=no]) +RUBY_TRY_CXXFLAGS(-fdeclspec, [fdeclspec=yes], [fdeclspec=no], [@%:@include <cstdio>]) AS_IF([test "$fdeclspec" = yes], [ RUBY_APPEND_OPTIONS(CXXFLAGS, -fdeclspec) ]) @@ -653,6 +765,16 @@ AS_CASE(["$GCC:${warnflags+set}:${extra_warnflags:+set}:"], AS_IF([test $gcc_major -le 6], [ extra_warnflags="$extra_warnflags -Wno-maybe-uninitialized" ]) + AS_CASE([ $CFLAGS ], [*" -save-temps="*|*" -save-temps "*], [], [ + extra_warnflags="$extra_warnflags -Werror=misleading-indentation" + ]) + AS_CASE([$target_os], [mingw*], [ + # 64bit Windows is IL32P64; shorten-64-to-32 causes tons of warnigs + extra_warnflags="$extra_warnflags -Wno-shorten-64-to-32" + ], [ + extra_warnflags="$extra_warnflags -Werror=shorten-64-to-32" + ]) + # ICC doesn't support -Werror= AS_IF([test $icc_version -gt 0], [ particular_werror_flags=no @@ -664,21 +786,16 @@ AS_CASE(["$GCC:${warnflags+set}:${extra_warnflags:+set}:"], -Werror=duplicated-cond \ -Werror=implicit-function-declaration \ -Werror=implicit-int \ - -Werror=misleading-indentation \ -Werror=pointer-arith \ - -Werror=shorten-64-to-32 \ -Werror=write-strings \ -Werror=old-style-definition \ -Wimplicit-fallthrough=0 \ -Wmissing-noreturn \ -Wno-cast-function-type \ - -Wno-constant-logical-operand \ -Wno-long-long \ -Wno-missing-field-initializers \ -Wno-overlength-strings \ -Wno-packed-bitfield-compat \ - -Wno-parentheses-equality \ - -Wno-self-assign \ -Wno-tautological-compare \ -Wno-unused-parameter \ -Wno-unused-value \ @@ -686,6 +803,7 @@ AS_CASE(["$GCC:${warnflags+set}:${extra_warnflags:+set}:"], -Wsuggest-attribute=noreturn \ -Wunused-variable \ -diag-disable=175,188,1684,2259,2312 \ + $clang_warnflags \ $extra_warnflags \ ; do AS_IF([test "$particular_werror_flags" != yes], [ @@ -763,15 +881,14 @@ AS_IF([test "$GCC" = yes], [ [disable -D_FORTIFY_SOURCE=2 option, which causes link error on mingw]), [fortify_source=$enableval]) AS_IF([test "x$fortify_source" != xno], [ - RUBY_TRY_CFLAGS([$optflags -D_FORTIFY_SOURCE=2], [RUBY_APPEND_OPTION(XCFLAGS, -D_FORTIFY_SOURCE=2)], [], + RUBY_TRY_CFLAGS([$optflags -D_FORTIFY_SOURCE=2], + [RUBY_PREPEND_OPTION(hardenflags, -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2)], [], [@%:@include <stdio.h>]) ]) - : ${MJIT_HEADER_FLAGS='-P -dD'} - # -fstack-protector AS_CASE(["$target_os"], - [mingw*|emscripten*|wasi*], [ + [emscripten*|wasi*], [ stack_protector=no ]) AS_IF([test -z "${stack_protector+set}"], [ @@ -783,19 +900,48 @@ AS_IF([test "$GCC" = yes], [ AS_IF([test "x$stack_protector" = xyes], [stack_protector=option; break]) ]) ]) + AC_MSG_CHECKING([for -fstack-protector]) + AC_MSG_RESULT(["$stack_protector"]) AS_CASE(["$stack_protector"], [-*], [ - RUBY_APPEND_OPTION(XCFLAGS, $stack_protector) - RUBY_APPEND_OPTION(XLDFLAGS, $stack_protector) - RUBY_APPEND_OPTION(LDFLAGS, $stack_protector) + RUBY_PREPEND_OPTION(hardenflags, $stack_protector) + RUBY_APPEND_OPTION(XLDFLAGS, $stack_protector) + RUBY_APPEND_OPTION(LDFLAGS, $stack_protector) ]) # aarch64 branch protection - AS_CASE(["$target_cpu"], [aarch64], [ - AS_FOR(option, opt, [-mbranch-protection=pac-ret -msign-return-address=all], [ - RUBY_TRY_CFLAGS(option, [branch_protection=yes], [branch_protection=no]) - AS_IF([test "x$branch_protection" = xyes], [ - RUBY_APPEND_OPTION(XCFLAGS, option) - break + AS_CASE(["$target_cpu"], [aarch64|arm64], [ + # LLVM libunwind is not actually capable of unwinding code compiled with pointer + # authentication unless it's built without LIBUNWIND_ENABLE_CROSS_UNWINDING (see + # https://github.com/llvm/llvm-project/blob/8e35c86977ce5529a9387657321ac9fefcdae5b5/libunwind/src/DwarfInstructions.hpp#L294) + # It seems that macOS ships LLVM compiled this way. + # Detect this and disable automatic insertion of pac-ret flags in that case, since we assume + # that reliable backtraces are more important than hardening flags. + AC_MSG_CHECKING([for a broken LLVM libunwind that cannot unwind code with RA signing]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + @%:@include <libunwind.h> + int foo = UNW_ECROSSRASIGNING; + ]])], + # If compilation succeeds, that means we a) had libunwind, and b) it was NOT native only + [rb_cv_libunwind_broken_ra_signing=yes], + # if compilation fails, that means we either a) do not have libunwind, or b) have it in + # native only mode (which is good!) + [rb_cv_libunwind_broken_ra_signing=no] + ) + AC_MSG_RESULT(["$rb_cv_libunwind_broken_ra_signing"]) + AS_IF([test "x$rb_cv_libunwind_broken_ra_signing" = "xno"], [ + AS_FOR(option, opt, [-mbranch-protection=pac-ret -msign-return-address=all], [ + # Try these flags in the _prepended_ position - i.e. we want to try building a program + # with CFLAGS="-mbranch-protection=pac-ret $CFLAGS". If the builder has provided different + # branch protection flags in CFLAGS, we don't want to overwrite those. We just want to + # find some branch protection flags which work if none were provided. + RUBY_TRY_CFLAGS_PREPEND(option, [branch_protection=yes], [branch_protection=no]) + AS_IF([test "x$branch_protection" = xyes], [ + # _prepend_ the options to CFLAGS, so that user-provided flags will overwrite them. + # These CFLAGS are used during the configure script to compile further test programs; + # however, $harden_flags is prepended separately to CFLAGS at the end of the script. + RUBY_PREPEND_OPTION(hardenflags, $opt) + break + ]) ]) ]) ]) @@ -848,39 +994,12 @@ AS_IF([test "$GCC" = yes], [ # need lgamma_r() ]) - # ANSI (no XCFLAGS because this is C only) - AS_CASE(["$target_os"], - [solaris*], [ - # Because "-std=gnu99" affects existence of functions on Solaris, - # "-std=gnu99" will be appended to CPPFLAGS. - for ansi_options in -std=gnu99; do - RUBY_TRY_CFLAGS(${ansi_options}, [ - RUBY_APPEND_OPTIONS(CPPFLAGS, ${ansi_options}) - ], [ansi_options=]) - test "x${ansi_options}" = x || break - done - ], - [ - # ANSI (no XCFLAGS because this is C only) - rb_tmp_std_check=`echo $CC $CFLAGS $optflags $warnflags $debugflags | fgrep std= | tr -d '\015'` - AS_IF([test "x$rb_tmp_std_check" = "x"], - [ - for ansi_options in -std=gnu99; do - RUBY_TRY_CFLAGS(${ansi_options}, [ - RUBY_APPEND_OPTIONS(warnflags, ${ansi_options}) - RUBY_APPEND_OPTIONS(strict_warnflags, ${ansi_options}) - ], [ansi_options=]) - test "x${ansi_options}" = x || break - done - ]) - ]) - # suppress annoying -Wstrict-overflow warnings RUBY_TRY_CFLAGS(-fno-strict-overflow, [RUBY_APPEND_OPTION(XCFLAGS, -fno-strict-overflow)]) - test "${debugflags+set}" || {RUBY_TRY_CFLAGS(-ggdb3, [debugflags=-ggdb3])} - test "${debugflags+set}" || {RUBY_TRY_CFLAGS(-ggdb, [debugflags=-ggdb])} - test "${debugflags+set}" || {RUBY_TRY_CFLAGS(-g3, [debugflags=-g3])} + test "${debugflags+set}" || {RUBY_TRY_LDFLAGS(-ggdb3, [debugflags=-ggdb3])} + test "${debugflags+set}" || {RUBY_TRY_LDFLAGS(-ggdb, [debugflags=-ggdb])} + test "${debugflags+set}" || {RUBY_TRY_LDFLAGS(-g3, [debugflags=-g3])} ]) test $ac_cv_prog_cc_g = yes && : ${debugflags=-g} @@ -897,7 +1016,6 @@ AS_IF([test "$GCC" = yes], [ ], [ RUBY_TRY_LDFLAGS([-Wl,-unexported_symbol,_Init_*], [visibility_option=ld], [visibility_option=no]) ]) - test "$visibility_option" = no || OBJCOPY=: ]) AS_IF([test "$GCC" = yes], [ @@ -937,21 +1055,47 @@ AS_CASE(["$target_cpu"], [[i[3-6]86*]], [ AS_IF([test "$rb_cv_gcc_compiler_cas" = i486], [ARCH_FLAG="-march=i486"]) ]) +OPT_DIR= +AC_ARG_WITH([gmp-dir], + AS_HELP_STRING([--with-gmp-dir=DIR], + [specify the prefix directory where gmp is installed]), + [OPT_DIR="${OPT_DIR:+$OPT_DIR$PATH_SEPARATOR}$withval"], []) +AC_ARG_WITH([gmp], + [AS_HELP_STRING([--without-gmp], + [disable GNU GMP to accelerate Bignum operations])], + [], [with_gmp=yes]) + AC_ARG_WITH(opt-dir, AS_HELP_STRING([--with-opt-dir=DIR-LIST], [add optional headers and libraries directories separated by $PATH_SEPARATOR]), - [ - val=`echo "$PATH_SEPARATOR$withval" | sed "s|$PATH_SEPARATOR\([[^$PATH_SEPARATOR]*]\)| -I\1/include|g;s/^ //"` - CPPFLAGS="$CPPFLAGS $val" - val=`echo "$PATH_SEPARATOR$withval" | sed "s|$PATH_SEPARATOR\([[^$PATH_SEPARATOR]*]\)| -L\1/lib${rpathflag:+ $rpathflag\\\\1/lib}|g;s/^ //"` - LDFLAGS="$LDFLAGS $val" - LDFLAGS_OPTDIR="$val" - OPT_DIR="$withval" - ], [OPT_DIR=]) + [OPT_DIR="${OPT_DIR:+$OPT_DIR$PATH_SEPARATOR}$withval"], []) + +AS_IF([test "x$OPT_DIR" != x], [ + save_IFS="$IFS" IFS="$PATH_SEPARATOR" val= PWD= + for dir in $OPT_DIR; do + test -z "$dir" && continue + dir=`eval $CHDIR '"$dir"' 2>/dev/null && pwd` || continue + val="${val:+$val$PATH_SEPARATOR}$dir" + done + IFS="$save_IFS" OPT_DIR="$val" + unset PWD + unset save_IFS + val=`IFS="$PATH_SEPARATOR" + for dir in $OPT_DIR; do + echo x ${LIBPATHFLAG} ${RPATHFLAG} | + sed "s/^x *//;s${IFS}"'%1\\$-s'"${IFS}${dir}/lib${IFS}g;s${IFS}%s${IFS}${dir}/lib${IFS}g" + done | tr '\012' ' ' | sed 's/ *$//'` + LDFLAGS="${LDFLAGS:+$LDFLAGS }$val" + DLDFLAGS="${DLDFLAGS:+$DLDFLAGS }$val" + LDFLAGS_OPTDIR="$val" + INCFLAGS="${INCFLAGS:+$INCFLAGS }"`echo "$OPT_DIR" | tr "${PATH_SEPARATOR}" '\012' | + sed '/^$/d;s|^|-I|;s|$|/include|' | tr '\012' ' ' | sed 's/ *$//'` +]) +AC_SUBST(incflags, "$INCFLAGS") test -z "${ac_env_CFLAGS_set}" -a -n "${cflags+set}" && eval CFLAGS="\"$cflags $ARCH_FLAG\"" test -z "${ac_env_CXXFLAGS_set}" -a -n "${cxxflags+set}" && eval CXXFLAGS="\"$cxxflags $ARCH_FLAG\"" -} + AC_CACHE_CHECK([whether compiler has statement and declarations in expressions], rb_cv_have_stmt_and_decl_in_expr, @@ -961,8 +1105,9 @@ AC_CACHE_CHECK([whether compiler has statement and declarations in expressions], AS_IF([test "$rb_cv_have_stmt_and_decl_in_expr" = yes], [ AC_DEFINE(HAVE_STMT_AND_DECL_IN_EXPR) ]) +} -: "header and library section" && { +[begin]_group "header and library section" && { AC_ARG_WITH(winnt-ver, AS_HELP_STRING([--with-winnt-ver=0xXXXX], [target Windows NT version (default to 0x0600)]), [with_winnt_ver="$withval"], [with_winnt_ver="0x0600"]) @@ -1017,7 +1162,6 @@ AS_CASE(["$target_os"], AS_IF([test $gcc_major -eq 4 -a $gcc_minor -lt 3], [ ac_cv_func___builtin_setjmp=no ]) - with_setjmp_type=sigsetjmp # to hijack SIGCHLD handler AC_CACHE_CHECK(for broken crypt with 8bit chars, rb_cv_broken_crypt, [AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <stdio.h> @@ -1065,21 +1209,23 @@ main() ]) POSTLINK="" AC_CHECK_PROGS(codesign, codesign) - AC_CHECK_PROGS(dsymutil, dsymutil) + dsymutils= + AS_CASE("$CC_NO_WRAPPER", [gcc*-1[[3-9]]], [ + dsymutils=${CC_NO_WRAPPER@%:@gcc} + dsymutils=dsymutil${dsymutils%-1*} + dsymutils="$dsymutils-19 $dsymutils-18 $dsymutils-17" + ]) + AC_CHECK_PROGS(dsymutil, $dsymutils dsymutil) AS_IF([test -n "$codesign"], [ - POSTLINK="{ test -z '\$(RUBY_CODESIGN)' || $codesign -s '\$(RUBY_CODESIGN)' -f \$@; }${POSTLINK:+; $POSTLINK}" + POSTLINK="{ test -z '\$(RUBY_CODESIGN)' || $codesign -s '\$(RUBY_CODESIGN)' \$@; }${POSTLINK:+; $POSTLINK}" ]) AS_IF([test -n "$dsymutil"], [ - POSTLINK="$dsymutil \$@${POSTLINK:+; $POSTLINK}" - ]) - AS_IF([test -n "${POSTLINK}"], [ - LINK_SO="$LINK_SO -\$(POSTLINK)" + POSTLINK="$dsymutil \$@ 2>/dev/null${POSTLINK:+; $POSTLINK}" ]) AC_CHECK_HEADERS(crt_externs.h, [], [], [ #include <crt_externs.h> ]) - cleanlibs='$(TARGET_SO).dSYM' + cleanlibs='$(TARGET_SO:=.dSYM)' ], [solaris*], [ LIBS="-lm $LIBS" ac_cv_func_vfork=no @@ -1150,6 +1296,11 @@ main() ac_cv_header_sys_time_h=no ac_cv_header_sys_times_h=no ac_cv_header_sys_socket_h=no + ac_cv_func_chown=yes + ac_cv_func_getegid=yes + ac_cv_func_geteuid=yes + ac_cv_func_getgid=yes + ac_cv_func_getuid=yes ac_cv_func_execv=yes ac_cv_func_lstat=yes ac_cv_func_times=yes @@ -1162,30 +1313,30 @@ main() ac_cv_func_readlink=yes ac_cv_func_shutdown=yes ac_cv_func_symlink=yes + ac_cv_func_clock_getres=yes + ac_cv_func_clock_gettime=yes ac_cv_lib_crypt_crypt=no ac_cv_func_getpgrp_void=no ac_cv_func_memcmp_working=yes ac_cv_lib_dl_dlopen=no - rb_cv_binary_elf=no rb_cv_negative_time_t=yes ac_cv_func_fcntl=yes ac_cv_func_flock=yes ac_cv_func_gmtime_r=yes rb_cv_large_fd_select=yes ac_cv_type_struct_timeval=yes - ac_cv_func_clock_gettime=yes - ac_cv_func_clock_getres=yes ac_cv_func_malloc_usable_size=no ac_cv_type_off_t=yes ac_cv_sizeof_off_t=8 AS_IF([test "$target_cpu" = x64], [ ac_cv_func___builtin_setjmp=yes ac_cv_func_round=no + ac_cv_func_tgamma=no ]) - ac_cv_func_tgamma=no AC_CHECK_TYPE([NET_LUID], [], [], [@%:@include <winsock2.h> - @%:@include <iphlpapi.h>]) + @%:@include <windows.h> + @%:@include <iphlpapi.h>]) AS_IF([test x"$ac_cv_type_NET_LUID" = xyes], [ AC_DEFINE(HAVE_TYPE_NET_LUID, 1) ]) @@ -1215,12 +1366,8 @@ main() # __builtin_longjmp in ppc64* Linux does not restore # the TOC register (r2), which is problematic # when a global exit happens from JITted .so code. - AS_CASE(["$target_cpu"], [powerpc64*], [ - ac_cv_func___builtin_setjmp=no - ]) - # With gcc-8's -fcf-protection, MJIT's __builtin_longjmp fails. - AS_CASE(["$CC $CFLAGS "], [*" -fcf-protection "*], [cf_protection=yes], [cf_protection=no]) - AS_IF([test "$cf_protection" = yes], [ + # __builtin_setjmp can have issues on arm64 linux (see [Bug #14480]). + AS_CASE(["$target_cpu"], [powerpc64*|arm64|aarch64], [ ac_cv_func___builtin_setjmp=no ]) ], @@ -1233,7 +1380,7 @@ main() [wasi*],[ LIBS="-lm -lwasi-emulated-mman -lwasi-emulated-signal -lwasi-emulated-getpid -lwasi-emulated-process-clocks $LIBS" RUBY_APPEND_OPTIONS(CFLAGS, -D_WASI_EMULATED_SIGNAL -D_WASI_EMULATED_MMAN -D_WASI_EMULATED_GETPID -D_WASI_EMULATED_PROCESS_CLOCKS) RUBY_APPEND_OPTIONS(CPPFLAGS, -D_WASI_EMULATED_SIGNAL -D_WASI_EMULATED_MMAN -D_WASI_EMULATED_GETPID -D_WASI_EMULATED_PROCESS_CLOCKS) - POSTLINK="\$(WASMOPT) --asyncify \$(wasmoptflags) --pass-arg=asyncify-ignore-imports -o \$@ \$@${POSTLINK:+; $POSTLINK}" + POSTLINK="\$(WASMOPT) --asyncify \$(wasmoptflags) -o \$@ \$@${POSTLINK:+; $POSTLINK}" # wasi-libc's sys/socket.h is not compatible with -std=gnu99, # so re-declare shutdown in include/ruby/missing.h ac_cv_func_shutdown=no @@ -1241,6 +1388,13 @@ main() [ LIBS="-lm $LIBS"]) : ${ORIG_LIBS=$LIBS} +AS_IF([test -n "${POSTLINK}"], [ + # NOTE: A (part of) link commands used link shared extension libraries. If + # the first line of the value is empty, mkmf prepends default link steps. + LINK_SO="$LINK_SO +\$(POSTLINK)" +]) + AS_IF([test -n "${rb_there_is_in_fact_no_gplusplus_but_autoconf_is_cheating_us}"], [ AC_MSG_NOTICE([Test skipped due to lack of a C++ compiler.]) ], @@ -1269,6 +1423,11 @@ dnl AC_HEADER_STDC has been checked in AC_USE_SYSTEM_EXTENSIONS AC_HEADER_STDBOOL AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS([afunix.h], [], [], +[#ifdef _WIN32 +# include <winsock2.h> +#endif +]) AC_CHECK_HEADERS(atomic.h) AC_CHECK_HEADERS(copyfile.h) AC_CHECK_HEADERS(direct.h) @@ -1288,6 +1447,7 @@ AC_CHECK_HEADERS(process.h) AC_CHECK_HEADERS(pwd.h) AC_CHECK_HEADERS(sanitizer/asan_interface.h) AC_CHECK_HEADERS(sanitizer/msan_interface.h) +AC_CHECK_HEADERS(sanitizer/tsan_interface.h) AC_CHECK_HEADERS(setjmpex.h) AC_CHECK_HEADERS(stdalign.h) AC_CHECK_HEADERS(stdio.h) @@ -1315,18 +1475,18 @@ AC_CHECK_HEADERS(syscall.h) AC_CHECK_HEADERS(time.h) AC_CHECK_HEADERS(ucontext.h) AC_CHECK_HEADERS(utime.h) -AS_CASE("$target_cpu", [x64|x86_64|i[3-6]86*], [ +AC_CHECK_HEADERS(sys/epoll.h) +AC_CHECK_HEADERS(sys/event.h) +AC_CHECK_HEADERS(stdckdint.h) +AC_CHECK_HEADERS(stdatomic.h) + +AS_CASE("$target_cpu", [x64|x86_64|[i[3-6]86*]], [ AC_CHECK_HEADERS(x86intrin.h) ]) RUBY_UNIVERSAL_CHECK_HEADER([x86_64, i386], x86intrin.h) -AC_ARG_WITH([gmp], - [AS_HELP_STRING([--without-gmp], - [disable GNU GMP to accelerate Bignum operations])], - [], - [with_gmp=yes]) AS_IF([test "x$with_gmp" != xno], - [AC_CHECK_HEADERS(gmp.h) + [RUBY_CHECK_HEADER(gmp.h) AS_IF([test "x$ac_cv_header_gmp_h" != xno], AC_SEARCH_LIBS([__gmpz_init], [gmp], [AC_DEFINE(HAVE_LIBGMP, 1)]))]) @@ -1336,6 +1496,8 @@ AC_ARG_WITH([jemalloc], [with_jemalloc=$withval], [with_jemalloc=no]) AS_IF([test "x$with_jemalloc" != xno],[ # find jemalloc header first + save_CPPFLAGS="${CPPFLAGS}" + CPPFLAGS="${INCFLAGS} ${CPPFLAGS}" malloc_header= AC_CHECK_HEADER(jemalloc/jemalloc.h, [malloc_header=jemalloc/jemalloc.h], [ AC_CHECK_HEADER(jemalloc.h, [malloc_header=jemalloc.h]) @@ -1367,6 +1529,8 @@ AS_IF([test "x$with_jemalloc" != xno],[ done done ]) + CPPFLAGS="${save_CPPFLAGS}" + unset save_CPPFLAGS with_jemalloc=${rb_cv_jemalloc_library} AS_CASE(["$with_jemalloc"], [no], @@ -1392,7 +1556,7 @@ AC_SYS_LARGEFILE # which is not added by AC_SYS_LARGEFILE. AS_IF([test x"$enable_largefile" != xno], [ AS_CASE(["$target_os"], [solaris*], [ - AC_MSG_CHECKING([wheather _LARGEFILE_SOURCE should be defined]) + AC_MSG_CHECKING([whether _LARGEFILE_SOURCE should be defined]) AS_CASE(["${ac_cv_sys_file_offset_bits}:${ac_cv_sys_large_files}"], ["64:"|"64:no"|"64:unknown"], [ # insert _LARGEFILE_SOURCE before _FILE_OFFSET_BITS line @@ -1453,6 +1617,25 @@ RUBY_CHECK_SIZEOF(float) RUBY_CHECK_SIZEOF(double) RUBY_CHECK_SIZEOF(time_t, [long "long long"], [], [@%:@include <time.h>]) RUBY_CHECK_SIZEOF(clock_t, [], [], [@%:@include <time.h>]) +AC_SUBST(X_BUILTIN_BINARY, yes) +AS_IF([test "$cross_compiling" = yes], +[dnl miniruby cannot run if cross compiling + X_BUILTIN_BINARY=no +], +[ + AS_CASE([ac_cv_sizeof_voidp], + [[1-9]*], [dnl fixed value + ], + [ + AC_CACHE_CHECK([word size], [rb_cv_word_size], + [for w in 4 8; do + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@if SIZEOF_VOIDP != ${w} + @%:@error SIZEOF_VOIDP + @%:@endif]])], [rb_cv_word_size=${w}; break]) + done]) + AS_IF([test -z $rb_cv_word_size], [X_BUILTIN_BINARY=no]) + ]) +]) AC_CACHE_CHECK(packed struct attribute, rb_cv_packed_struct, [rb_cv_packed_struct=no @@ -1465,10 +1648,9 @@ AC_CACHE_CHECK(packed struct attribute, rb_cv_packed_struct, [rb_cv_packed_struct=$mac; break]) done]) AS_IF([test "$rb_cv_packed_struct" != no], [ - AC_DEFINE_UNQUOTED([PACKED_STRUCT(x)], [$rb_cv_packed_struct]) + AC_DEFINE_UNQUOTED([RBIMPL_ATTR_PACKED_STRUCT_BEGIN()], [`echo " $rb_cv_packed_struct " | sed 's/ x .*//;s/^ *//'`]) + AC_DEFINE_UNQUOTED([RBIMPL_ATTR_PACKED_STRUCT_END()], [`echo " $rb_cv_packed_struct " | sed 's/.* x //;s/ *$//'`]) RUBY_TRY_CFLAGS(-Wno-address-of-packed-member, [AC_DEFINE(USE_UNALIGNED_MEMBER_ACCESS)]) -], [ - AC_DEFINE_UNQUOTED([PACKED_STRUCT(x)], x) ]) AS_IF([test "x$ac_cv_type_long_long" = xyes], [ @@ -1573,21 +1755,6 @@ AS_IF([test "$rb_cv_func_weak" != x], [ AC_DEFINE(HAVE_FUNC_WEAK) ]) -AC_CACHE_CHECK([for __attribute__((__depreacted__(msg))) in C++], - rb_cv_CentOS6_CXX_workaround, - RUBY_WERROR_FLAG([ - AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [], - [__attribute__((__deprecated__("message"))) int conftest(...);])], - [rb_cv_CentOS6_CXX_workaround=yes], - [rb_cv_CentOS6_CXX_workaround=no]) - AC_LANG_POP()])) -AS_IF([test "$rb_cv_CentOS6_CXX_workaround" != no],[ - AC_DEFINE([RUBY_CXX_DEPRECATED(msg)], - [__attribute__((__deprecated__(msg)))])]) - AC_CACHE_CHECK([for std::nullptr_t], rb_cv_CXX_nullptr, [ AC_LANG_PUSH([C++]) AC_COMPILE_IFELSE( @@ -1637,6 +1804,26 @@ AS_IF([test "$GCC" = yes], [ [rb_cv_gcc_atomic_builtins=no])]) AS_IF([test "$rb_cv_gcc_atomic_builtins" = yes], [ AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS) + for lib in "" atomic; do + AS_IF([test "$lib" != ""], [ + AC_CHECK_LIB([atomic], [__atomic_fetch_add_8]) + unset rb_cv_gcc_atomic_builtins_64 + ]) + AC_CACHE_CHECK([for 64bit __atomic builtins${lib:+ with -l$lib}], + [rb_cv_gcc_atomic_builtins_64], [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[@%:@include <stdint.h> + uint64_t atomic_var;]], + [[ + __atomic_load_n(&atomic_var, __ATOMIC_RELAXED); + __atomic_store_n(&atomic_var, 0, __ATOMIC_RELAXED); + ]])], + [rb_cv_gcc_atomic_builtins_64=yes], + [rb_cv_gcc_atomic_builtins_64=no])]) + AS_IF([test "$rb_cv_gcc_atomic_builtins_64" = yes], [ + AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS_64) + break + ]) + done ]) AC_CACHE_CHECK([for __sync builtins], [rb_cv_gcc_sync_builtins], [ @@ -1683,7 +1870,7 @@ AS_IF([test "$GCC" = yes], [ AC_CACHE_CHECK(for exported function attribute, rb_cv_func_exported, [ rb_cv_func_exported=no RUBY_WERROR_FLAG([ -for mac in '__attribute__ ((__visibility__("default")))' '__declspec(dllexport)'; do +for mac in '__declspec(dllexport)' '__attribute__ ((__visibility__("default")))'; do AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@define RUBY_FUNC_EXPORTED $mac extern RUBY_FUNC_EXPORTED void conftest_attribute_check(void);]], [[]])], [rb_cv_func_exported="$mac"; break]) @@ -1700,16 +1887,12 @@ RUBY_DECL_ATTRIBUTE([__nonnull__(n)], [RUBY_FUNC_NONNULL(n,x)], [rb_cv_func_nonn RUBY_APPEND_OPTION(XCFLAGS, -DRUBY_EXPORT) -AC_ARG_ENABLE(mathn, - AS_HELP_STRING([--enable-mathn], [enable canonicalization for mathn]), - [AC_MSG_ERROR([mathn support has been dropped])]) - AC_CACHE_CHECK(for function name string predefined identifier, rb_cv_function_name_string, [AS_CASE(["$target_os"],[openbsd*],[ rb_cv_function_name_string=__func__ ],[ - rb_cv_function_name_string=no + rb_cv_function_name_string=no RUBY_WERROR_FLAG([ for func in __func__ __FUNCTION__; do AC_LINK_IFELSE([AC_LANG_PROGRAM([[@%:@include <stdio.h>]], @@ -1717,7 +1900,8 @@ AC_CACHE_CHECK(for function name string predefined identifier, [rb_cv_function_name_string=$func break]) done - ])])] + ]) + ])] ) AS_IF([test "$rb_cv_function_name_string" != no], [ AC_DEFINE_UNQUOTED(RUBY_FUNCTION_NAME_STRING, [$rb_cv_function_name_string]) @@ -1896,8 +2080,8 @@ AS_CASE(["${target_cpu}-${target_os}:${target_archs}"], [universal-darwin*:*ppc*], [ AC_LIBSOURCES(alloca.c) AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.${ac_objext}]) - RUBY_DEFINE_IF([defined __powerpc__], C_ALLOCA, 1) - RUBY_DEFINE_IF([defined __powerpc__], alloca, alloca) + RUBY_DEFINE_IF([defined __POWERPC__], C_ALLOCA, 1) # Darwin defines __POWERPC__ for ppc and ppc64 both + RUBY_DEFINE_IF([defined __POWERPC__], alloca, alloca) ], [ AC_FUNC_ALLOCA @@ -1977,6 +2161,7 @@ AC_CHECK_FUNCS(_longjmp) # used for AC_ARG_WITH(setjmp-type) test x$ac_cv_func__longjmp = xno && ac_cv_func__setjmp=no AC_CHECK_FUNCS(arc4random_buf) AC_CHECK_FUNCS(atan2l atan2f) +AC_CHECK_DECLS(atomic_signal_fence, [], [], [@%:@include <stdatomic.h>]) AC_CHECK_FUNCS(chmod) AC_CHECK_FUNCS(chown) AC_CHECK_FUNCS(chroot) @@ -2000,6 +2185,7 @@ AC_CHECK_FUNCS(execv) AC_CHECK_FUNCS(execve) AC_CHECK_FUNCS(explicit_memset) AC_CHECK_FUNCS(fcopyfile) +AC_CHECK_FUNCS(fchdir) AC_CHECK_FUNCS(fchmod) AC_CHECK_FUNCS(fchown) AC_CHECK_FUNCS(fcntl) @@ -2040,7 +2226,6 @@ AC_CHECK_FUNCS(gettimeofday) # for making ac_cv_func_gettimeofday AC_CHECK_FUNCS(getuid) AC_CHECK_FUNCS(getuidx) AC_CHECK_FUNCS(gmtime_r) -AC_CHECK_FUNCS(grantpt) AC_CHECK_FUNCS(initgroups) AC_CHECK_FUNCS(ioctl) AC_CHECK_FUNCS(isfinite) @@ -2057,6 +2242,7 @@ AC_CHECK_FUNCS(lstat) AC_CHECK_FUNCS(lutimes) AC_CHECK_FUNCS(malloc_usable_size) AC_CHECK_FUNCS(malloc_size) +AC_CHECK_FUNCS(malloc_trim) AC_CHECK_FUNCS(mblen) AC_CHECK_FUNCS(memalign) AC_CHECK_FUNCS(memset_s) @@ -2110,6 +2296,7 @@ AC_CHECK_FUNCS(sigaction) AC_CHECK_FUNCS(sigaltstack) AC_CHECK_FUNCS(sigprocmask) AC_CHECK_FUNCS(sinh) +AC_CHECK_FUNCS(snprintf) AC_CHECK_FUNCS(spawnv) AC_CHECK_FUNCS(symlink) AC_CHECK_FUNCS(syscall) @@ -2134,9 +2321,6 @@ AC_CHECK_FUNCS(__sinpi) AS_IF([test "x$ac_cv_member_struct_statx_stx_btime" = xyes], [AC_CHECK_FUNCS(statx)]) -AS_CASE(["$ac_cv_func_memset_s:$ac_cv_func_qsort_s"], [*yes*], - [RUBY_DEFINE_IF([!defined __STDC_WANT_LIB_EXT1__], [__STDC_WANT_LIB_EXT1__], 1)]) - AS_IF([test "$ac_cv_func_getcwd" = yes], [ AC_CACHE_CHECK(if getcwd allocates buffer if NULL is given, [rb_cv_getcwd_malloc], [AC_RUN_IFELSE([AC_LANG_SOURCE([[ @@ -2186,10 +2370,6 @@ RUBY_CHECK_BUILTIN_FUNC(__builtin_clzl, [__builtin_clzl(0)]) RUBY_CHECK_BUILTIN_FUNC(__builtin_clzll, [__builtin_clzll(0)]) RUBY_CHECK_BUILTIN_FUNC(__builtin_ctz, [__builtin_ctz(0)]) RUBY_CHECK_BUILTIN_FUNC(__builtin_ctzll, [__builtin_ctzll(0)]) -RUBY_CHECK_BUILTIN_FUNC(__builtin_add_overflow, [int x;__builtin_add_overflow(0,0,&x)]) -RUBY_CHECK_BUILTIN_FUNC(__builtin_sub_overflow, [int x;__builtin_sub_overflow(0,0,&x)]) -RUBY_CHECK_BUILTIN_FUNC(__builtin_mul_overflow, [int x;__builtin_mul_overflow(0,0,&x)]) -RUBY_CHECK_BUILTIN_FUNC(__builtin_mul_overflow_p, [__builtin_mul_overflow_p(0,0,(int)0)]) RUBY_CHECK_BUILTIN_FUNC(__builtin_constant_p, [__builtin_constant_p(0)]) RUBY_CHECK_BUILTIN_FUNC(__builtin_choose_expr, [ [int x[__extension__(__builtin_choose_expr(1, 1, -1))]]; @@ -2205,6 +2385,10 @@ RUBY_CHECK_BUILTIN_FUNC(__builtin_types_compatible_p, [__builtin_types_compatibl RUBY_CHECK_BUILTIN_FUNC(__builtin_trap, [__builtin_trap()]) RUBY_CHECK_BUILTIN_FUNC(__builtin_expect, [__builtin_expect(0, 0)]) +RUBY_CHECK_BUILTIN_OVERFLOW(add) +RUBY_CHECK_BUILTIN_OVERFLOW(sub) +RUBY_CHECK_BUILTIN_OVERFLOW(mul) + AS_IF([test "$ac_cv_func_qsort_r" != no], [ AC_CACHE_CHECK(whether qsort_r is GNU version, rb_cv_gnu_qsort_r, [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @@ -2330,9 +2514,7 @@ AC_CACHE_CHECK(for negative time_t for gmtime(3), rb_cv_negative_time_t, #include <time.h> void -check(tm, y, m, d, h, s) - struct tm *tm; - int y, m, d, h, s; +check(struct tm *tm, int y, int m, int d, int h, int s) { if (!tm || tm->tm_year != y || @@ -2416,8 +2598,7 @@ AS_IF([test "$ac_cv_func_sigprocmask" = yes && test "$ac_cv_func_sigaction" = ye #include <signal.h> void -sig_handler(dummy) - int dummy; +sig_handler(int dummy) { } @@ -2567,10 +2748,13 @@ AS_CASE([$coroutine_type], [yes|''], [ [arm64-darwin*], [ coroutine_type=arm64 ], - [powerpc-darwin*], [ + # Correct target name is powerpc*-, but Ruby seems to prefer ppc*-. + # Notice that Darwin PPC ABI differs from AIX and ELF. + # Adding PPC targets for AIX, *BSD and *Linux will require separate implementations. + [powerpc-darwin*|ppc-darwin*], [ coroutine_type=ppc ], - [powerpc64-darwin*], [ + [powerpc64-darwin*|ppc64-darwin*], [ coroutine_type=ppc64 ], [x*64-linux*], [ @@ -2589,6 +2773,9 @@ AS_CASE([$coroutine_type], [yes|''], [ [*86-mingw*], [ coroutine_type=win32 ], + [aarch64-mingw*], [ + coroutine_type=arm64 + ], [arm*-linux*], [ coroutine_type=arm32 ], @@ -2601,6 +2788,9 @@ AS_CASE([$coroutine_type], [yes|''], [ [riscv64-linux*], [ coroutine_type=riscv64 ], + [loongarch64-linux*], [ + coroutine_type=loongarch64 + ], [x86_64-freebsd*], [ coroutine_type=amd64 ], @@ -2610,6 +2800,12 @@ AS_CASE([$coroutine_type], [yes|''], [ [aarch64-freebsd*], [ coroutine_type=arm64 ], + [powerpc64-freebsd*], [ + coroutine_type=ppc64le + ], + [powerpc64le-freebsd*], [ + coroutine_type=ppc64le + ], [x86_64-netbsd*], [ coroutine_type=amd64 ], @@ -2625,6 +2821,12 @@ AS_CASE([$coroutine_type], [yes|''], [ [i386-openbsd*], [ coroutine_type=x86 ], + [aarch64-openbsd*], [ + coroutine_type=arm64 + ], + [riscv64-openbsd*], [ + coroutine_type=riscv64 + ], [*-openbsd*], [ coroutine_type=pthread ], @@ -2722,6 +2924,22 @@ AS_IF([test "$THREAD_MODEL" = pthread], [ AC_DEFINE_UNQUOTED(SET_ANOTHER_THREAD_NAME(thid,name), $set_another_thread_name) ]) ]) + + AC_CACHE_CHECK([for thread-local storage specifier], [rb_cv_tls_specifier], + rb_cv_tls_specifier=none + RUBY_WERROR_FLAG([ + for attr in \ + _Thread_local \ + __thread \ + ; do + AC_LINK_IFELSE([AC_LANG_PROGRAM([[$attr int conftest;]])], + [rb_cv_tls_specifier=$attr; break]) + done + ]) + ) + AS_IF([test x"${rb_cv_tls_specifier}" != xnone], + [AC_DEFINE_UNQUOTED(RB_THREAD_LOCAL_SPECIFIER, ${rb_cv_tls_specifier})] + ) ]) AS_IF([test x"$ac_cv_header_ucontext_h" = xno], [ @@ -2865,8 +3083,8 @@ AS_IF([test "x$ac_cv_func_ioctl" = xyes], [ } -: "runtime section" && { -dnl wheather use dln_a_out or not +[begin]_group "runtime section" && { +dnl whether use dln_a_out or not AC_ARG_WITH(dln-a-out, AS_HELP_STRING([--with-dln-a-out], [dln_a_out is deprecated]), [ @@ -2876,12 +3094,6 @@ AC_ARG_WITH(dln-a-out, ]) ]) -AC_CACHE_CHECK(whether ELF binaries are produced, rb_cv_binary_elf, -[AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[ -AS_CASE(["`head -1 conftest$EXEEXT | tr -dc '\177ELF' | tr '\177' .`"], -[.ELF*], [rb_cv_binary_elf=yes], [rb_cv_binary_elf=no])], -rb_cv_binary_elf=no)]) - AS_IF([test "$rb_cv_binary_elf" = yes], [ AC_DEFINE(USE_ELF) AC_CHECK_HEADERS([elf.h elf_abi.h]) @@ -2905,22 +3117,8 @@ AS_CASE(["$target_os"], ])]) LIBEXT=a -AC_ARG_WITH(mjit-tabs, - AS_HELP_STRING([--without-mjit-tabs], [expand tabs in mjit header]), - [AS_IF([test $withval = no], [MJIT_TABS=false])]) -AC_SUBST(MJIT_TABS)dnl AC_SUBST(DLDFLAGS)dnl AC_SUBST(ARCH_FLAG)dnl -AC_SUBST(MJIT_HEADER_FLAGS)dnl -AC_SUBST(MJIT_HEADER_INSTALL_DIR)dnl -AC_SUBST(MJIT_CC)dnl -AS_CASE(["$GCC:$target_os"], - [yes:aix*], [mjit_std_cflag="-std=gnu99"], - [mjit_std_cflag=]) -AC_SUBST(MJIT_CFLAGS, [${MJIT_CFLAGS-"-w ${mjit_std_cflag} ${orig_cflags}"}])dnl -AC_SUBST(MJIT_OPTFLAGS, [${MJIT_OPTFLAGS-'$(optflags)'}])dnl -AC_SUBST(MJIT_DEBUGFLAGS, [${MJIT_DEBUGFLAGS-'$(debugflags)'}])dnl -AC_SUBST(MJIT_LDSHARED)dnl AC_SUBST(STATIC)dnl AC_SUBST(CCDLFLAGS)dnl @@ -2958,13 +3156,25 @@ STATIC= ]) } -: "rpath" && { - AC_ARG_ENABLE(rpath, - AS_HELP_STRING([--enable-rpath], [embed run path into extension libraries. - enabled by default on ELF platforms]), - [enable_rpath=$enableval], [enable_rpath="$rb_cv_binary_elf"]) +EXTSTATIC= +AC_SUBST(EXTSTATIC)dnl +AC_ARG_WITH(static-linked-ext, + AS_HELP_STRING([--with-static-linked-ext], [link external modules statically]), + [AS_CASE([$withval],[yes],[STATIC=;EXTSTATIC=static],[no],[],[EXTSTATIC="$withval"])]) +AS_CASE([",$EXTSTATIC,"], [,static,|*,enc,*], [ + ENCOBJS='enc/encinit.$(OBJEXT) enc/libenc.$(LIBEXT) enc/libtrans.$(LIBEXT)' + EXTOBJS='ext/extinit.$(OBJEXT)' + AC_DEFINE_UNQUOTED(EXTSTATIC, 1) + AC_SUBST(ENCSTATIC, static) +], [ + ENCOBJS='dmyenc.$(OBJEXT)' + EXTOBJS='dmyext.$(OBJEXT)' +]) +AC_SUBST(ENCOBJS) +AC_SUBST(EXTOBJS) - AS_CASE(["$target_os"], +: "rpath" && { + AS_CASE(["$target_os"], [solaris*], [ AS_IF([test "$GCC" = yes], [ : ${LDSHARED='$(CC) -shared'} AS_IF([test "$rb_cv_prog_gnu_ld" = yes], [ @@ -3004,7 +3214,6 @@ STATIC= rb_cv_dlopen=yes], [interix*], [ : ${LDSHARED='$(CC) -shared'} XLDFLAGS="$XLDFLAGS -Wl,-E" - LIBPATHFLAG=" -L%1\$-s" rb_cv_dlopen=yes], [freebsd*|dragonfly*], [ : ${LDSHARED='$(CC) -shared'} @@ -3023,11 +3232,10 @@ STATIC= [darwin*], [ : ${LDSHARED='$(CC) -dynamic -bundle'} : ${DLDSHARED='$(CC) -dynamiclib'} : ${LDFLAGS=""} - : ${LIBPATHENV=DYLD_FALLBACK_LIBRARY_PATH} + : ${LIBPATHENV=DYLD_LIBRARY_PATH} : ${PRELOADENV=DYLD_INSERT_LIBRARIES} AS_IF([test x"$enable_shared" = xyes], [ - # Resolve symbols from libruby.dylib when --enable-shared - EXTDLDFLAGS='$(LIBRUBYARG_SHARED)' + # Resolve symbols from libruby.dylib in $(LIBS) when --enable-shared ], [test "x$EXTSTATIC" = x], [ # When building exts as bundles, a mach-o bundle needs to know its loader # program to bind symbols from the ruby executable @@ -3063,31 +3271,37 @@ STATIC= [hiuxmpp], [ : ${LDSHARED='$(LD) -r'}], [atheos*], [ : ${LDSHARED='$(CC) -shared'} rb_cv_dlopen=yes], + [wasi*], [ : ${LDSHARED='$(LD) -shared -Xlinker --export-dynamic'}], [ : ${LDSHARED='$(LD)'}]) - AC_MSG_RESULT($rb_cv_dlopen) + AC_MSG_RESULT($rb_cv_dlopen) +} - AS_IF([test "$rb_cv_dlopen" = yes], [ +AS_IF([test "$rb_cv_dlopen" = yes], [ AS_CASE(["$target_os"], - [darwin*], [ + [darwin*], [ + AC_SUBST(ADDITIONAL_DLDFLAGS, "") for flag in \ - "-undefined dynamic_lookup" \ "-multiply_defined suppress" \ + "-undefined dynamic_lookup" \ ; do - test "x${linker_flag}" = x || flag="${linker_flag}`echo ${flag} | tr ' ' ,`" - RUBY_TRY_LDFLAGS([$flag], [], [flag=]) - AS_IF([test "x$flag" != x], [ - RUBY_APPEND_OPTIONS(DLDFLAGS, [$flag]) - ]) + test "x${linker_flag}" = x || flag="${linker_flag}`echo ${flag} | tr ' ' ,`" + RUBY_TRY_LDFLAGS([$flag], [], [flag=]) + AS_IF([test x"$flag" = x], [continue]) + + AC_MSG_CHECKING([whether $flag is accepted for bundle]) + : > conftest.c + AS_IF([${LDSHARED%%'$(CC)'*}$CC${LDSHARED@%:@*'$(CC)'} -o conftest.bundle $flag conftest.c >/dev/null 2>conftest.err && + test ! -s conftest.err], [ + AC_MSG_RESULT([yes]) + RUBY_APPEND_OPTIONS(DLDFLAGS, [$flag]) + ], [ + AC_MSG_RESULT([no]) + RUBY_APPEND_OPTIONS(ADDITIONAL_DLDFLAGS, [$flag]) + ]) + rm -fr conftest.* done - ]) - ]) - - AS_IF([test "$enable_rpath:${RPATHFLAG}" = yes:], [ - AS_IF([test "x$rpathflag" != x], [ - RPATHFLAG=" ${rpathflag}%1\$-s" - ]) - ]) -} + ]) +]) AS_IF([test "${LDSHAREDXX}" = ""], [ AS_CASE(["${LDSHARED}"], @@ -3103,7 +3317,6 @@ AS_IF([test "${LDSHAREDXX}" = ""], [ [ld" "*], [ ]) ]) -AS_CASE([${RPATHFLAG}],[*'%1$'*],[: ${LIBPATHFLAG=' -L%1$-s'}],[: ${LIBPATHFLAG=' -L%s'}]) AC_SUBST(LINK_SO) AC_SUBST(LIBPATHFLAG) @@ -3112,23 +3325,6 @@ AC_SUBST(LIBPATHENV, "${LIBPATHENV-LD_LIBRARY_PATH}") AC_SUBST(PRELOADENV, "${PRELOADENV-LD_PRELOAD}") AC_SUBST(TRY_LINK) -AS_IF([test "x$OPT_DIR" != x], [ - pat=`echo "${LDFLAGS_OPTDIR}" | sed ['s/[][\\.*|]/\\\\&/']` - LDFLAGS=`echo "${LDFLAGS}" | sed "s| ${pat}||"` - val=`IFS="$PATH_SEPARATOR" - for dir in $OPT_DIR; do - echo x ${LIBPATHFLAG} ${RPATHFLAG} | - sed "s/^x *//;s${IFS}"'%1\\$-s'"${IFS}${dir}/lib${IFS}g;s${IFS}%s${IFS}${dir}/lib${IFS}g" - done | tr '\012' ' ' | sed 's/ *$//'` - AS_IF([test x"$val" != x], [ - test x"${LDFLAGS}" = x || LDFLAGS="$LDFLAGS " - LDFLAGS="$LDFLAGS$val" - test x"${DLDFLAGS}" = x || DLDFLAGS="$DLDFLAGS " - DLDFLAGS="$DLDFLAGS$val" - ]) - LDFLAGS_OPTDIR="$val" -]) - AS_CASE(["$target_os"], [freebsd*], [ AC_CHECK_LIB([procstat], [procstat_open_sysctl]) @@ -3240,7 +3436,6 @@ AS_IF([test x$with_valgrind != xno], DLEXT=so]) : ${SOEXT="${DLEXT}"} AC_SUBST(SOEXT) -} AS_IF([test "$rb_cv_dlopen:$load_relative" = yes:yes], [ AS_IF([test "$ac_cv_func_dladdr" = yes], [ @@ -3259,6 +3454,9 @@ AC_DEFINE_UNQUOTED(DLEXT_MAXLEN, `expr $len + 1`) test ".$DLEXT" = "." || AC_DEFINE_UNQUOTED(DLEXT, ".$DLEXT") AC_SUBST(DLEXT) +AC_DEFINE_UNQUOTED(SOEXT, ".$SOEXT") +} + : "strip" && { AC_MSG_CHECKING([for $STRIP flags]) AC_LINK_IFELSE([AC_LANG_PROGRAM], [AS_IF( @@ -3281,23 +3479,6 @@ AC_ARG_WITH(ext, AC_ARG_WITH(out-ext, AS_HELP_STRING([--with-out-ext=EXTS], [pass to --without-ext option of extmk.rb])) -EXTSTATIC= -AC_SUBST(EXTSTATIC)dnl -AC_ARG_WITH(static-linked-ext, - AS_HELP_STRING([--with-static-linked-ext], [link external modules statically]), - [AS_CASE([$withval],[yes],[STATIC=;EXTSTATIC=static],[no],[],[EXTSTATIC="$withval"])]) -AS_CASE([",$EXTSTATIC,"], [,static,|*,enc,*], [ - ENCOBJS='enc/encinit.$(OBJEXT) enc/libenc.$(LIBEXT) enc/libtrans.$(LIBEXT)' - EXTOBJS='ext/extinit.$(OBJEXT)' - AC_DEFINE_UNQUOTED(EXTSTATIC, 1) - AC_SUBST(ENCSTATIC, static) -], [ - ENCOBJS='dmyenc.$(OBJEXT)' - EXTOBJS='dmyext.$(OBJEXT)' -]) -AC_SUBST(ENCOBJS) -AC_SUBST(EXTOBJS) - AC_ARG_WITH(setup, AS_HELP_STRING([--with-setup=SETUP], [use extension libraries setup]), [setup=$withval]) @@ -3347,10 +3528,8 @@ for var in bindir includedir libdir rubylibprefix; do done BTESTRUBY='$(MINIRUBY)' -BOOTSTRAPRUBY='$(BASERUBY)' -BOOTSTRAPRUBY_COMMAND='$(BOOTSTRAPRUBY)' AS_IF([test x"$cross_compiling" = xyes], [ - test x"$MINIRUBY" = x && MINIRUBY="${RUBY-$BASERUBY} -I`$CHDIR .; pwd` "-r'$(arch)-fake' + test x"$MINIRUBY" = x && MINIRUBY="${RUBY-$BASERUBY} -I${ac_abs_builddir-.} "-r'$(arch)-fake' XRUBY_LIBDIR=`${RUBY-$BASERUBY} -rrbconfig -e ['puts RbConfig::CONFIG["libdir"]']` XRUBY_RUBYLIBDIR=`${RUBY-$BASERUBY} -rrbconfig -e ['puts RbConfig::CONFIG["rubylibdir"]']` XRUBY_RUBYHDRDIR=`${RUBY-$BASERUBY} -rrbconfig -e ['puts RbConfig::CONFIG["rubyhdrdir"]']` @@ -3358,10 +3537,13 @@ AS_IF([test x"$cross_compiling" = xyes], [ AC_SUBST(XRUBY_RUBYLIBDIR) AC_SUBST(XRUBY_RUBYHDRDIR) PREP='$(arch)-fake.rb' - RUNRUBY_COMMAND='$(MINIRUBY) -I`cd $(srcdir)/lib; pwd`' + AS_CASE(["$enable_shared:$EXTSTATIC:$target_os"], [no::darwin*], [ + # darwin target requires miniruby for linking ext bundles + PREP="$PREP"' miniruby$(EXEEXT)' + ]) + RUNRUBY_COMMAND='$(MINIRUBY) -I`$(CHDIR) $(srcdir)/lib; pwd`' RUNRUBY='$(RUNRUBY_COMMAND)' XRUBY='$(MINIRUBY)' - BOOTSTRAPRUBY_COMMAND='$(BOOTSTRAPRUBY) -r./$(arch)-fake' TEST_RUNNABLE=no CROSS_COMPILING=yes AC_DEFINE(CROSS_COMPILING, 1) @@ -3372,9 +3554,6 @@ AS_IF([test x"$cross_compiling" = xyes], [ RUNRUBY_COMMAND='$(MINIRUBY) $(tooldir)/runruby.rb --extout=$(EXTOUT) $(RUNRUBYOPT)' RUNRUBY='$(RUNRUBY_COMMAND) --' XRUBY='$(RUNRUBY)' - AS_CASE(["$HAVE_BASERUBY"], - [yes], [BOOTSTRAPRUBY_COMMAND='$(BOOTSTRAPRUBY) -r./$(arch)-fake'], - [BOOTSTRAPRUBY='$(MINIRUBY)']) TEST_RUNNABLE=yes CROSS_COMPILING=no ]) @@ -3386,11 +3565,8 @@ AC_SUBST(PREP) AC_SUBST(RUNRUBY_COMMAND) AC_SUBST(RUNRUBY) AC_SUBST(XRUBY) -AC_SUBST(BOOTSTRAPRUBY) -AC_SUBST(BOOTSTRAPRUBY_COMMAND) AC_SUBST(EXTOUT, [${EXTOUT=.ext}]) -FIRSTMAKEFILE="" LIBRUBY_A='lib$(RUBY_SO_NAME)-static.a' LIBRUBY='$(LIBRUBY_A)' LIBRUBYARG_STATIC='-l$(RUBY_SO_NAME)-static' @@ -3407,12 +3583,10 @@ AS_CASE(["$target_os"], AC_ARG_ENABLE(multiarch, AS_HELP_STRING([--enable-multiarch], [enable multiarch compatible directories]), - [multiarch=], [unset multiarch]) + [AS_CASE([$enableval], [no], [unset multiarch], [multiarch=])], + [unset multiarch]) AS_IF([test ${multiarch+set}], [ AC_DEFINE(ENABLE_MULTIARCH) - MJIT_HEADER_INSTALL_DIR=include/'${arch}/${RUBY_VERSION_NAME}' -], [ - MJIT_HEADER_INSTALL_DIR=include/'${RUBY_VERSION_NAME}/${arch}' ]) archlibdir='${libdir}/${arch}' @@ -3433,7 +3607,7 @@ AC_ARG_WITH(soname, ], [mingw*], [ RUBY_SO_NAME="${rb_cv_msvcrt}"'-$(RUBY_BASE_NAME)$(MAJOR)$(MINOR)0' - AS_IF([test x"${target_cpu}" != xi386], [ + AS_IF([test x"${target_cpu}" != xi386 || test x"${rb_cv_msvcrt}" != xmsvcrt], [ RUBY_SO_NAME="${target_cpu}-${RUBY_SO_NAME}" ]) ], @@ -3490,6 +3664,7 @@ AS_CASE("$enable_shared", [yes], [ ]) ]) + relative_libprefix="/../${multiarch+../}${libdir_basename}" AS_CASE(["$target_os"], [sunos4*], [ LIBRUBY_ALIASES='$(LIBRUBY_SONAME) lib$(RUBY_SO_NAME).$(SOEXT)' @@ -3498,7 +3673,7 @@ AS_CASE("$enable_shared", [yes], [ RUBY_APPEND_OPTIONS(LIBRUBY_DLDFLAGS, ['-Wl,-soname,$(LIBRUBY_SONAME)' "$LDFLAGS_OPTDIR"]) LIBRUBY_ALIASES='$(LIBRUBY_SONAME) lib$(RUBY_SO_NAME).$(SOEXT)' AS_IF([test "$load_relative" = yes], [ - libprefix="'\$\${ORIGIN}/../${libdir_basename}'" + libprefix="'\$\${ORIGIN}${relative_libprefix}'" LIBRUBY_RPATHFLAGS="-Wl,-rpath,${libprefix}" LIBRUBY_RELATIVE=yes ]) @@ -3510,7 +3685,7 @@ AS_CASE("$enable_shared", [yes], [ LIBRUBY_SO="$LIBRUBY_SO.\$(TEENY)" LIBRUBY_ALIASES='' ], [test "$load_relative" = yes], [ - libprefix="'\$\$ORIGIN/../${libdir_basename}'" + libprefix="'\$\$ORIGIN${relative_libprefix}'" LIBRUBY_RPATHFLAGS="-Wl,-rpath,${libprefix}" LIBRUBY_RELATIVE=yes ]) @@ -3534,7 +3709,7 @@ AS_CASE("$enable_shared", [yes], [ LIBRUBY_ALIASES='$(LIBRUBY_SONAME) lib$(RUBY_SO_NAME).$(SOEXT)' RUBY_APPEND_OPTIONS(LIBRUBY_DLDFLAGS, ["${linker_flag}-h${linker_flag:+,}"'$(@F)']) AS_IF([test "$load_relative" = yes], [ - libprefix="'\$\$ORIGIN/../${libdir_basename}'" + libprefix="'\$\$ORIGIN${relative_libprefix}'" LIBRUBY_RPATHFLAGS="-R${libprefix}" LIBRUBY_RELATIVE=yes ], [ @@ -3551,7 +3726,7 @@ AS_CASE("$enable_shared", [yes], [ LIBRUBY_SONAME='$(LIBRUBY_SO)' LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).$(SOEXT)' AS_IF([test "$load_relative" = yes], [ - libprefix="@executable_path/../${libdir_basename}" + libprefix="@executable_path${relative_libprefix}" LIBRUBY_RELATIVE=yes ]) LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS -install_name ${libprefix}"'/$(LIBRUBY_SONAME)' @@ -3559,6 +3734,7 @@ AS_CASE("$enable_shared", [yes], [ LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-current_version $(RUBY_PROGRAM_VERSION)' AS_IF([test "$visibility_option" = ld], [ LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-Wl,-unexported_symbol,_Init_*' + LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-Wl,-unexported_symbol,_InitVM_*' LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-Wl,-unexported_symbol,_ruby_static_id_*' LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-Wl,-unexported_symbol,*_threadptr_*' ]) @@ -3599,16 +3775,16 @@ AS_CASE("$enable_shared", [yes], [ ]) ]) AS_IF([test "$enable_rpath" = yes], [ - test -z "$LIBRUBY_RPATHFLAGS" || LIBRUBY_RPATHFLAGS="$LIBRUBY_RPATHFLAGS " - rpathflag="${RPATHFLAG}" - AS_CASE(["${cross_compiling}${load_relative}"], [*yes*], [], [rpathflag="$RPATHFLAG$LIBPATHFLAG"]) + AS_CASE(["${cross_compiling}${load_relative}"], + [*yes*], [rpathflag="${RPATHFLAG}"], + [rpathflag="$RPATHFLAG${LIBPATHFLAG:+${RPATHFLAG:+ }$LIBPATHFLAG}"]) rpathflag=`IFS="$PATH_SEPARATOR" echo x "$rpathflag" | sed "s/^x *//;s${IFS}"'%1\\$-s'"${IFS}${libprefix}${IFS}g;s${IFS}%s${IFS}${libprefix}${IFS}g" ` - LIBRUBY_RPATHFLAGS="$LIBRUBY_RPATHFLAGS${rpathflag}" - LIBRUBYARG_SHARED="$LIBRUBY_RPATHFLAGS $LIBRUBYARG_SHARED" - LIBRUBYARG_STATIC="$LIBRUBY_RPATHFLAGS $LIBRUBYARG_STATIC" + LIBRUBY_RPATHFLAGS="${LIBRUBY_RPATHFLAGS:+$LIBRUBY_RPATHFLAGS }${rpathflag}" + LIBRUBYARG_SHARED="${LIBRUBY_RPATHFLAGS:+$LIBRUBY_RPATHFLAGS }$LIBRUBYARG_SHARED" + LIBRUBYARG_STATIC="${LIBRUBY_RPATHFLAGS:+$LIBRUBY_RPATHFLAGS }$LIBRUBYARG_STATIC" ]) AC_SUBST(LIBRUBY_RELATIVE) @@ -3685,14 +3861,15 @@ AC_ARG_ENABLE(gcov, AS_HELP_STRING([--enable-gcov], [enable coverage measurement by gcov]), [gcov=yes]) AS_IF([test x"$gcov" = xyes], [ - CFLAGS="$CFLAGS -coverage" + CFLAGS="$CFLAGS -coverage -fprofile-update=atomic" LDFLAGS="$LDFLAGS -coverage" ]) RUBY_SETJMP_TYPE +RUBY_MODULAR_GC } -: "build section" && { +[begin]_group "installation section" && { dnl build rdoc index if requested RDOCTARGET="" CAPITARGET="" @@ -3740,87 +3917,250 @@ AC_SUBST(CAPITARGET) AS_CASE(["$RDOCTARGET:$CAPITARGET"],[nodoc:nodoc],[INSTALLDOC=nodoc],[INSTALLDOC=all]) AC_SUBST(INSTALLDOC) -AC_ARG_ENABLE(jit-support, - AS_HELP_STRING([--disable-jit-support], [disable JIT features]), - [MJIT_SUPPORT=$enableval], - [AS_CASE(["$target_os"], - [wasi | mingw*], [MJIT_SUPPORT=no], - [MJIT_SUPPORT=yes] - )]) +AC_ARG_ENABLE(install-static-library, + AS_HELP_STRING([--disable-install-static-library], [do not install static ruby library]), + [INSTALL_STATIC_LIBRARY=$enableval + AS_IF([test x"$enable_shared" = xno -a x"$INSTALL_STATIC_LIBRARY" = xno], + [AC_MSG_ERROR([must install either static or shared library])], + [])], + AS_IF([test x"$enable_shared" = xyes], + [INSTALL_STATIC_LIBRARY=no], + [INSTALL_STATIC_LIBRARY=yes])) +AC_SUBST(INSTALL_STATIC_LIBRARY) +} -AS_IF([test x"$MJIT_SUPPORT" = "xyes"], - [AC_DEFINE(USE_MJIT, 1)], - [AC_DEFINE(USE_MJIT, 0)]) +[begin]_group "JIT section" && { +AC_CHECK_PROG(RUSTC, [rustc], [rustc], [no]) dnl no ac_tool_prefix + +dnl check if rustc is recent enough to build YJIT (rustc >= 1.58.0) +JIT_RUSTC_OK=no +JIT_TARGET_ARCH= +AS_IF([test "$RUSTC" != "no"], + AC_MSG_CHECKING([whether ${RUSTC} works for YJIT]) + AS_CASE(["$target_cpu"], + [arm64|aarch64], [JIT_TARGET_ARCH=aarch64], + [x86_64], [JIT_TARGET_ARCH=x86_64], + ) + dnl Fails in case rustc target doesn't match ruby target. + dnl Can happen on Rosetta, for example. + AS_IF([echo "#[cfg(target_arch = \"$JIT_TARGET_ARCH\")] fn main() { let x = 1; format!(\"{x}\"); }" | + $RUSTC - --emit asm=/dev/null 2>/dev/null], + [JIT_RUSTC_OK=yes] + ) + AC_MSG_RESULT($JIT_RUSTC_OK) +) -AC_SUBST(MJIT_SUPPORT) +dnl check if we can build YJIT/ZJIT on this target platform +dnl we can't easily cross-compile with rustc so we don't support that +JIT_TARGET_OK=no +AS_IF([test "$cross_compiling" = no], + AS_CASE(["$target_cpu-$target_os"], + [*android*], [ + JIT_TARGET_OK=no + ], + [arm64-darwin*|aarch64-darwin*|x86_64-darwin*], [ + JIT_TARGET_OK=yes + ], + [arm64-*linux*|aarch64-*linux*|x86_64-*linux*], [ + JIT_TARGET_OK=yes + ], + [arm64-*bsd*|aarch64-*bsd*|x86_64-*bsd*], [ + JIT_TARGET_OK=yes + ] + ) +) +dnl build YJIT in release mode if rustc >= 1.58.0 is present and we are on a supported platform AC_ARG_ENABLE(yjit, - AS_HELP_STRING([--enable-yjit], - [enable experimental in-process JIT compiler that requires Rust build tools [default=no]]), - [YJIT_SUPPORT=$enableval], [YJIT_SUPPORT=no]) + AS_HELP_STRING([--enable-yjit], + [enable in-process JIT compiler that requires Rust build tools. enabled by default on supported platforms if rustc 1.58.0+ is available]), + [YJIT_SUPPORT=$enableval], + [AS_CASE(["$JIT_TARGET_OK:$JIT_RUSTC_OK"], + [yes:yes], [ + YJIT_SUPPORT=yes + ], + [YJIT_SUPPORT=no] + )] +) + +dnl build ZJIT in release mode if rustc >= 1.85.0 is present and we are on a supported platform +ZJIT_SUPPORT=no +AC_ARG_ENABLE(zjit, + AS_HELP_STRING([--enable-zjit], + [enable experimental JIT compiler that requires Rust build tools. enabled by default on supported platforms if rustc 1.85.0+ is available]), + [ZJIT_SUPPORT=$enableval], + [AS_CASE(["$JIT_TARGET_OK"], + [yes], [ + rb_zjit_build_possible=no + AC_MSG_CHECKING([prerequisites for ZJIT])dnl only checked when --enable-zjit is not specified + # Fails in case rustc target doesn't match ruby target. Can happen on Rosetta, for example. + # 1.85.0 is the first stable version that supports the 2024 edition. + AS_IF([test "$RUSTC" != "no" && echo "#[cfg(target_arch = \"$JIT_TARGET_ARCH\")] fn main() {}" | + $RUSTC - --edition=2024 --emit asm=/dev/null 2>/dev/null], + AS_IF([test "$gnumake" = "yes"], [ + rb_zjit_build_possible=yes + ]) + ) + AC_MSG_RESULT($rb_zjit_build_possible) + ZJIT_SUPPORT=$rb_zjit_build_possible + ] + )] +) -CARGO= CARGO_BUILD_ARGS= YJIT_LIBS= +JIT_CARGO_SUPPORT=no AS_CASE(["${YJIT_SUPPORT}"], [yes|dev|stats|dev_nodebug], [ - AS_IF([test x"$enable_jit_support" = "xno"], - AC_MSG_ERROR([--disable-jit-support but --enable-yjit. YJIT requires JIT support]) - ) - AC_CHECK_TOOL(RUSTC, [rustc], [no]) AS_IF([test x"$RUSTC" = "xno"], AC_MSG_ERROR([rustc is required. Installation instructions available at https://www.rust-lang.org/tools/install]) ) AS_CASE(["${YJIT_SUPPORT}"], [yes], [ - rb_rust_target_subdir=release ], [dev], [ - rb_rust_target_subdir=debug - CARGO_BUILD_ARGS='--features stats,disasm,asm_comments' + rb_cargo_features='disasm,runtime_checks' + JIT_CARGO_SUPPORT=dev AC_DEFINE(RUBY_DEBUG, 1) ], [dev_nodebug], [ - rb_rust_target_subdir=dev_nodebug - CARGO_BUILD_ARGS='--profile dev_nodebug --features stats,disasm,asm_comments' + rb_cargo_features='disasm' + JIT_CARGO_SUPPORT=dev_nodebug + AC_DEFINE(YJIT_STATS, 1) ], [stats], [ - rb_rust_target_subdir=stats - CARGO_BUILD_ARGS='--profile stats --features stats' + JIT_CARGO_SUPPORT=stats + AC_DEFINE(YJIT_STATS, 1) ]) - AS_IF([test -n "${CARGO_BUILD_ARGS}"], [ - AC_CHECK_TOOL(CARGO, [cargo], [no]) - AS_IF([test x"$CARGO" = "xno"], - AC_MSG_ERROR([cargo is required. Installation instructions available at https://www.rust-lang.org/tools/install]) - ])) - - YJIT_LIBS="yjit/target/${rb_rust_target_subdir}/libyjit.a" + YJIT_LIBS="target/release/libyjit.a" + RUST_LIB='$(YJIT_LIBS)' YJIT_OBJ='yjit.$(OBJEXT)' + JIT_OBJ='jit.$(OBJEXT)' + AS_IF([test x"$YJIT_SUPPORT" != "xyes" ], [ + AC_DEFINE_UNQUOTED(YJIT_SUPPORT, [$YJIT_SUPPORT]) + ]) AC_DEFINE(USE_YJIT, 1) -], [AC_DEFINE(USE_YJIT, 0)]) +], [ + AC_DEFINE(USE_YJIT, 0) +]) +ZJIT_LIBS= +AS_CASE(["${ZJIT_SUPPORT}"], +[yes|dev|dev_nodebug|stats], [ + AS_IF([test x"$RUSTC" = "xno"], + AC_MSG_ERROR([rustc is required. Installation instructions available at https://www.rust-lang.org/tools/install]) + ) + + AS_CASE(["${ZJIT_SUPPORT}"], + [yes], [ + ], + [dev], [ + rb_cargo_features="$rb_cargo_features,disasm,runtime_checks" + JIT_CARGO_SUPPORT=dev + AC_DEFINE(RUBY_DEBUG, 1) + ], + [dev_nodebug], [ + rb_cargo_features="$rb_cargo_features,disasm" + JIT_CARGO_SUPPORT=dev_nodebug + AC_DEFINE(ZJIT_STATS, 1) + ], + [stats], [ + JIT_CARGO_SUPPORT=stats + AC_DEFINE(ZJIT_STATS, 1) + ]) + + ZJIT_LIBS="target/release/libzjit.a" + RUST_LIB='$(ZJIT_LIBS)' + ZJIT_OBJ='zjit.$(OBJEXT)' + JIT_OBJ='jit.$(OBJEXT)' + AS_IF([test x"$ZJIT_SUPPORT" != "xyes" ], [ + AC_DEFINE_UNQUOTED(ZJIT_SUPPORT, [$ZJIT_SUPPORT]) + ]) + AC_DEFINE(USE_ZJIT, 1) +], [ + AC_DEFINE(USE_ZJIT, 0) +]) + +RUSTC_FLAGS='-g -C lto=thin -C opt-level=3 -C overflow-checks=on' +AS_IF([test -n "${rustc_flags}"], [ + RUSTC_FLAGS="${RUSTC_FLAGS} ${rustc_flags}" +]) + +JIT_RUST_FLAGS='--crate-type=staticlib --cfg feature=\"stats_allocator\"' +RLIB_DIR= +AS_CASE(["$JIT_CARGO_SUPPORT:$YJIT_SUPPORT:$ZJIT_SUPPORT"], +[no:yes:yes], [ # release build of YJIT+ZJIT + YJIT_LIBS= + ZJIT_LIBS= + JIT_RUST_FLAGS="--crate-type=rlib" + RLIB_DIR="target/release" + RUST_LIB="target/release/libruby.a" +], +[no:*], [], +[ # JIT_CARGO_SUPPORT not "no" -- cargo required. + AC_CHECK_TOOL(CARGO, [cargo], [no]) + AS_IF([test x"$CARGO" = "xno"], + AC_MSG_ERROR([this build configuration requires cargo. Installation instructions available at https://www.rust-lang.org/tools/install])) + + YJIT_LIBS= + ZJIT_LIBS= + + # There's more processing below to get the feature set for the + # top-level crate, so capture at this point for feature set of + # just the zjit crate. + ZJIT_TEST_FEATURES="${rb_cargo_features}" + + AS_IF([test x"${YJIT_SUPPORT}" != x"no"], [ + rb_cargo_features="$rb_cargo_features,yjit" + ]) + AS_IF([test x"${ZJIT_SUPPORT}" != x"no"], [ + AC_SUBST(ZJIT_TEST_FEATURES) + rb_cargo_features="$rb_cargo_features,zjit" + ]) + # if YJIT and ZJIT release mode + AS_IF([test "${YJIT_SUPPORT}:${ZJIT_SUPPORT}" = "yes:yes"], [ + JIT_CARGO_SUPPORT=release + ]) + CARGO_BUILD_ARGS="--profile ${JIT_CARGO_SUPPORT} --features ${rb_cargo_features}" + AS_IF([test "${JIT_CARGO_SUPPORT}" = "dev"], [ + RUST_LIB="target/debug/libruby.a" + ], [ + RUST_LIB="target/${JIT_CARGO_SUPPORT}/libruby.a" + ]) +]) + +# In case either we're linking rust code +AS_IF([test -n "$RUST_LIB"], [ + AS_CASE(["$target_os"],[openbsd*],[ + # Link libc++abi (which requires libpthread) for _Unwind_* functions needed by rust stdlib + LDFLAGS="$LDFLAGS -lpthread -lc++abi" + ]) + + # absolute path to stop the "target" dir in src dir from interfering through VPATH + RUST_LIB="$(pwd)/${RUST_LIB}" +]) dnl These variables end up in ::RbConfig::CONFIG -AC_SUBST(YJIT_SUPPORT)dnl what flavor of YJIT the Ruby build includes AC_SUBST(RUSTC)dnl Rust compiler command +AC_SUBST(JIT_RUST_FLAGS)dnl the common rustc flags for JIT crates such as zjit +AC_SUBST(RUSTC_FLAGS)dnl user-configurable rustc compiler flags AC_SUBST(CARGO)dnl Cargo command for Rust builds AC_SUBST(CARGO_BUILD_ARGS)dnl for selecting Rust build profiles -AC_SUBST(YJIT_LIBS)dnl for optionally building the Rust parts of YJIT +AC_SUBST(YJIT_SUPPORT)dnl what flavor of YJIT the Ruby build includes +AC_SUBST(YJIT_LIBS)dnl the .a library of YJIT AC_SUBST(YJIT_OBJ)dnl for optionally building the C parts of YJIT +AC_SUBST(ZJIT_SUPPORT)dnl what flavor of ZJIT the Ruby build includes +AC_SUBST(ZJIT_LIBS)dnl path to the .a library of ZJIT +AC_SUBST(ZJIT_OBJ)dnl for optionally building the C parts of ZJIT +AC_SUBST(JIT_OBJ)dnl for optionally building C glue code for Rust FFI +AC_SUBST(RUST_LIB)dnl path to the rust .a library that contains either or both JITs +AC_SUBST(RLIB_DIR)dnl subpath of build directory for .rlib files +AC_SUBST(JIT_CARGO_SUPPORT)dnl "no" or the cargo profile of the rust code +} -AC_ARG_ENABLE(install-static-library, - AS_HELP_STRING([--disable-install-static-library], [do not install static ruby library]), - [INSTALL_STATIC_LIBRARY=$enableval - AS_IF([test x"$enable_shared" = xno -a x"$INSTALL_STATIC_LIBRARY" = xno], - [AC_MSG_ERROR([must install either static or shared library])], - [])], - AS_IF([test x"$enable_shared" = xyes], - [INSTALL_STATIC_LIBRARY=no], - [INSTALL_STATIC_LIBRARY=yes])) -AC_SUBST(INSTALL_STATIC_LIBRARY) - +[begin]_group "build section" && { AC_CACHE_CHECK([for prefix of external symbols], rb_cv_symbol_prefix, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[extern void conftest_external(void) {}]], [[]])],[ rb_cv_symbol_prefix=`$NM conftest.$ac_objext | @@ -3831,6 +4171,25 @@ AC_CACHE_CHECK([for prefix of external symbols], rb_cv_symbol_prefix, [ ]) SYMBOL_PREFIX="$rb_cv_symbol_prefix" test "x$SYMBOL_PREFIX" = xNONE && SYMBOL_PREFIX='' + +AS_IF([test x"$SOEXT" = xdll], [ + # DLL on Windows is managed by win32/mkexports.rb +], [test x"$enable_shared" = xyes], [ + AC_CACHE_CHECK([for default symbols in empty shared library], rb_cv_symbols_in_emptylib, [ + save_CC="$CC" + eval CC=\"`printf "%s" "${DLDSHARED}" | sed ['s/\$(CC)/${CC}/']`\" + AC_LINK_IFELSE([AC_LANG_PROGRAM()],[ + rb_cv_symbols_in_emptylib=`$NM -Pgp conftest$ac_exeext | + sed ["/ [A-TV-Z] .*/!d;s///;s/^${SYMBOL_PREFIX}//;/^main$/d"]` + ]) + set dummy ${rb_cv_symbols_in_emptylib} + shift + rb_cv_symbols_in_emptylib="$*" + CC="$save_CC" + ]) +]) +AC_SUBST(XSYMBOLS_IN_EMPTYLIB, "${rb_cv_symbols_in_emptylib}") + DLNOBJ=dln.o AC_ARG_ENABLE(dln, AS_HELP_STRING([--disable-dln], [disable dynamic link feature]), @@ -3845,7 +4204,8 @@ AS_CASE(["$target_os"], RUBY_APPEND_OPTION(CFLAGS, -pipe) ], [darwin*], [ - RUBY_APPEND_OPTION(CFLAGS, -pipe) + RUBY_TRY_CFLAGS(-pipe, [pipe_opt=yes], [pipe_opt=no]) + AS_IF([test $pipe_opt = yes], [RUBY_APPEND_OPTION(CFLAGS, -pipe)]) AC_MSG_CHECKING([whether Security framework is needed]) AC_COMPILE_IFELSE([ AC_LANG_BOOL_COMPILE_TRY([ @@ -3898,6 +4258,7 @@ enum { [mingw*], [ AS_IF([test x"$enable_shared" = xyes], [ LIBRUBY_SO='$(RUBY_SO_NAME)'.dll + LIBRUBY_SONAME='' LIBRUBY_DLDFLAGS="${LIBRUBY_DLDFLAGS}"' $(RUBYDEF)' ]) EXPORT_PREFIX=' ' @@ -3910,7 +4271,6 @@ enum { PLATFORM_DIR=win32 ]) LIBRUBY_ALIASES='' - FIRSTMAKEFILE=GNUmakefile:cygwin/GNUmakefile.in AS_IF([test x"$enable_shared" = xyes], [ LIBRUBY='lib$(RUBY_SO_NAME).dll.a' ], [ @@ -3920,7 +4280,6 @@ enum { ]) ], [wasi*], [ - FIRSTMAKEFILE=GNUmakefile:wasm/GNUmakefile.in AC_LIBOBJ([wasm/missing]) AC_LIBOBJ([wasm/runtime]) AC_LIBOBJ([wasm/fiber]) @@ -3937,21 +4296,6 @@ AC_ARG_ENABLE(debug-env, AS_HELP_STRING([--enable-debug-env], [enable RUBY_DEBUG environment variable]), [AC_SUBST(ENABLE_DEBUG_ENV, yes)]) -AS_CASE(["$FIRSTMAKEFILE"], [*GNUmakefile:*], [gnumake=yes], [ - AC_MSG_CHECKING([if ${MAKE-make} is GNU make]) - mkdir conftest.dir - echo "all:; @echo yes" > conftest.dir/GNUmakefile - echo "all:; @echo no" > conftest.dir/Makefile - gnumake=`(cd conftest.dir; ${MAKE-make})` - rm -fr conftest.dir - AS_CASE(["$gnumake"], - [*yes*], [ - FIRSTMAKEFILE=GNUmakefile:template/GNUmakefile.in - gnumake=yes], - [ - gnumake=no]) - AC_MSG_RESULT($gnumake) -]) AS_IF([test "$gnumake" = yes], [ NULLCMD=: ], [ AC_MSG_CHECKING([for safe null command for ${MAKE-make}]) mkdir conftest.dir @@ -4008,8 +4352,9 @@ AS_IF([test "${universal_binary-no}" = yes ], [ const char arch[[]] = __ARCHITECTURE__;]], [[puts(arch);]])], [rb_cv_architecture_available=yes], [rb_cv_architecture_available=no])) ]) +} -: ${MJIT_LDSHARED=`echo "$LDSHARED" | sed ['s|\$(LD)|'"${LD}"'|g;s|\$(CC)|$(MJIT_CC)|g']`} +[end]_group MAINLIBS="$LIBS" LIBS=$ORIG_LIBS @@ -4018,8 +4363,7 @@ AS_IF([test -n "${LIBS}"], [ MAINFLAGS=`echo " $MAINLIBS " | sed "s|$libspat"'||;s/^ *//;s/ *$//'` ]) LIBRUBYARG_STATIC="${LIBRUBYARG_STATIC} \$(MAINLIBS)" -CPPFLAGS="$CPPFLAGS "'$(DEFS)' -test -z "$CPPFLAGS" || CPPFLAGS="$CPPFLAGS "; CPPFLAGS="$CPPFLAGS"'${cppflags}' +CPPFLAGS="$CPPFLAGS "'$(DEFS) ${cppflags}' AS_IF([test -n "${cflags+set}"], [ cflagspat=`eval echo '"'"${cflags}"'"' | sed 's/[[][|.*]]/\\&/g;s/^ */ /;s/^ *$/ /'` CFLAGS=`echo " $CFLAGS " | sed "s|$cflagspat"'|${cflags}|;s/^ *//;s/ *$//'` @@ -4034,15 +4378,34 @@ AS_IF([test "${ARCH_FLAG}"], [ CXXFLAGS=`echo "$CXXFLAGS" | sed "s| *$archflagpat"'||'` LDFLAGS=`echo "$LDFLAGS" | sed "s| *$archflagpat"'||'` ]) +AS_CASE([" $rb_cv_warnflags "], [*" -Wshorten-64-to-32 "*|*" -Werror=shorten-64-to-32 "*], [ + voidp_ll= + AS_CASE([$ac_cv_sizeof_voidp], + [SIZEOF_LONG_LONG], [voidp_ll=true], + [@<:@0-9@:>@*], [ + AS_IF([test $ac_cv_sizeof_voidp -gt $ac_cv_sizeof_long], [voidp_ll=true]) + ]) + AS_IF([test "$voidp_ll"], [ + # Disable the shorten-64-to-32 warning for now, because it currently + # generates a lot of warnings on platforms where `sizeof(void*)` is + # larger than `sizeof(long)`. + # + # TODO: Replace `long` with `ptrdiff_t` or something in the all sources. + rb_cv_warnflags=`echo "$rb_cv_warnflags" | + sed -e 's/ -W\(shorten-64-to-32 \)/ -Wno-\1/' \ + -e 's/ -Werror=\(shorten-64-to-32 \)/ -Wno-\1/'` + ]) +]) rb_cv_warnflags=`echo "$rb_cv_warnflags" | sed 's/^ *//;s/ *$//'` warnflags="$rb_cv_warnflags" AC_SUBST(cppflags)dnl -AC_SUBST(cflags, ["${orig_cflags:+$orig_cflags }"'${optflags} ${debugflags} ${warnflags}'])dnl +AC_SUBST(cflags, ['${hardenflags} '"${orig_cflags:+$orig_cflags }"' ${optflags} ${debugflags} ${warnflags}'])dnl AC_SUBST(cxxflags)dnl AC_SUBST(optflags)dnl AC_SUBST(debugflags)dnl AC_SUBST(warnflags)dnl AC_SUBST(strict_warnflags)dnl +AC_SUBST(hardenflags)dnl AC_SUBST(XCFLAGS)dnl AC_SUBST(XLDFLAGS)dnl AC_SUBST(EXTLDFLAGS)dnl @@ -4226,6 +4589,10 @@ AS_IF([test "${universal_binary-no}" = yes ], [ arch="${target_cpu}-${target_os}" ]) AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "$arch") + + AS_IF([test "$arch" = "s390x-linux"], [ + AC_DEFINE_UNQUOTED(USE_MN_THREADS, 0) + ]) ]) unset sitearch @@ -4323,6 +4690,20 @@ AS_IF([test x"$enable_rubygems" = xno], [ ]) AC_SUBST(USE_RUBYGEMS) +m4_define(available_parsers, [parse.y, prism]) +AC_ARG_WITH(parser, + AS_HELP_STRING([--with-parser=PARSER], + [specify default parser; PARSER is one of ]m4_join([, ],available_parsers)), + [], [with_parser=prism]) +AS_CASE([$with_parser], +m4_foreach(parser, [available_parsers], + parser[,][AC_DEFINE_UNQUOTED(RB_DEFAULT_PARSER, RB_DEFAULT_PARSER_[]AS_TR_CPP(parser)),]) + [AC_MSG_ERROR([Unknown parser: $with_parser])] +) + +# Use the ruby allocator for prism. See prism/defines.h +RUBY_APPEND_OPTIONS(XCFLAGS, -DPRISM_XALLOCATOR) + arch_hdrdir="${EXTOUT}/include/${arch}/ruby" AS_MKDIR_P("${arch_hdrdir}") config_h="${arch_hdrdir}/config.h" @@ -4330,7 +4711,7 @@ guard=INCLUDE_RUBY_CONFIG_H { echo "#ifndef $guard" echo "#define $guard 1" - grep -v "^#define PACKAGE_" confdefs.h + sed "/^@%:@define PACKAGE_/d;s/ *$//" confdefs.h echo "#endif /* $guard */" } | tr -d '\015' | ( @@ -4373,6 +4754,14 @@ AC_SUBST(XCC_WRAPPER) AS_CASE([" $CPP "], [*" $CC "*], [CPP=`echo " $CPP " | sed "s| $CC |"' $(CC) |;s/^ *//;s/ *$//'`]) +AS_IF([test ! -f "$srcdir/revision.h"], [ + AS_IF([test "x$HAVE_BASERUBY" = xyes], [ + ${BASERUBY} -C "$srcdir" tool/file2lastrev.rb -q --revision.h > "$srcdir/revision.h" + ], [ + touch "$srcdir/revision.h" + ]) +]) + AS_IF([test x"$firstmf" != x], [ AC_CONFIG_FILES($firstmf:$firsttmpl, [], [firstmf="$firstmf" firsttmpl="$firsttmpl"]) ]) @@ -4389,35 +4778,36 @@ AC_CONFIG_FILES(Makefile:template/Makefile.in, [ AS_CASE("$VCS", ['$(GIT)'|git], [VCSUP='$(VCS) pull --rebase $(GITPULLOPTIONS)'], [VCSUP='$(VCS)']) - sed -n \ - -e '[/^@%:@define \(RUBY_RELEASE_[A-Z]*\) \([0-9][0-9]*\)/]{' \ - -e 's//\1 = \2/' \ - -e '[s/ \([0-9]\)$/ 0\1/]' \ - -e p \ - -e '}' "$srcdir/version.h" + for f in "$srcdir/version.h" "$srcdir/revision.h"; do + test -f "$f" || continue + sed -n \ + -e '[/^@%:@define \(RUBY_RELEASE_[A-Z]*\) \([0-9][0-9]*\)/]{' \ + -e 's//\1 = \2/' \ + -e '[s/ \([0-9]\)$/ 0\1/]' \ + -e p \ + -e '}' "$f" + done sed '/^MISSING/s/\$U\././g;/^VCS *=/s#@VCS@#'"$VCS"'#;/^VCSUP *=/s#@VCSUP@#'"$VCSUP"'#' Makefile echo; test x"$EXEEXT" = x || echo 'miniruby: miniruby$(EXEEXT)' AS_IF([test "$gnumake" != yes], [ - echo ['$(MKFILES): $(srcdir)/common.mk'] - sed ['s/{\$([^(){}]*)[^{}]*}//g'] ${srcdir}/common.mk + # extract NMake-style include list + set = `sed -n 's/^!include *//p' ${srcdir}/common.mk` + echo common_mk_includes "@S|@*" # generate the macro assignment + shift + common_mk_includes="`echo \"@S|@*\" | sed 's|\$(srcdir)|.|g'`" + (PWD= cd ${srcdir} && sed -f tool/prereq.status common.mk ${common_mk_includes}) + AS_IF([test "$YJIT_SUPPORT" = yes], [ + cat ${srcdir}/yjit/not_gmake.mk + echo ['$(MKFILES): ${srcdir}/yjit/not_gmake.mk'] + ]) ], [ echo 'distclean-local::; @$(RM) GNUmakefile uncommon.mk' ]) - } > $tmpmk && AS_IF([! grep '^ruby:' $tmpmk > /dev/null], [ - AS_IF([test "${gnumake}" = yes], [ - tmpgmk=confgmk$$.tmp - { - echo "include $tmpmk" - echo "-include uncommon.mk" - } > $tmpgmk - ], [ - tmpgmk=$tmpmk - ]) && - test -z "`${MAKE-make} -f $tmpgmk info-program | grep '^PROGRAM=ruby$'`" && - echo 'ruby: $(PROGRAM);' >> $tmpmk - test "$tmpmk" = "$tmpgmk" || rm -f "$tmpgmk" - ]) && mv -f $tmpmk Makefile], -[EXEEXT='$EXEEXT' MAKE='${MAKE-make}' gnumake='$gnumake' GIT='$GIT']) + + echo; echo '$(srcdir)/$(CONFIGURE):RUBY_M4_INCLUDED \ + $(empty)' + } > $tmpmk && mv -f $tmpmk Makefile], +[EXEEXT='$EXEEXT' MAKE='${MAKE-make}' gnumake='$gnumake' GIT='$GIT' YJIT_SUPPORT='$YJIT_SUPPORT']) AC_ARG_WITH([ruby-pc], AS_HELP_STRING([--with-ruby-pc=FILENAME], [pc file basename]), @@ -4431,9 +4821,13 @@ AC_ARG_WITH(destdir, [DESTDIR="$withval"]) AC_SUBST(DESTDIR) +AS_IF([test "x$load_relative:$DESTDIR" = xyes:], [ + AS_IF([test "x$prefix" = xNONE], [DESTDIR="$ac_default_prefix"], [DESTDIR="$prefix"]) + prefix=/. +]) + AC_OUTPUT } -} AS_IF([test "$silent" = yes], [], [ AS_IF([${FOLD+:} false], [], [ @@ -4470,6 +4864,7 @@ config_summary "target OS" "$target_os" config_summary "compiler" "$CC" config_summary "with thread" "$THREAD_MODEL" config_summary "with coroutine" "$coroutine_type" +config_summary "with modular GC" "$modular_gc_summary" config_summary "enable shared libs" "$ENABLE_SHARED" config_summary "dynamic library ext" "$DLEXT" config_summary "CFLAGS" "$cflags" @@ -4479,10 +4874,12 @@ config_summary "DLDFLAGS" "$DLDFLAGS" config_summary "optflags" "$optflags" config_summary "debugflags" "$debugflags" config_summary "warnflags" "$warnflags" +config_summary "hardenflags" "$hardenflags" config_summary "strip command" "$STRIP" config_summary "install doc" "$DOCTARGETS" -config_summary "MJIT support" "$MJIT_SUPPORT" config_summary "YJIT support" "$YJIT_SUPPORT" +config_summary "ZJIT support" "$ZJIT_SUPPORT" +config_summary "RUSTC_FLAGS" "$RUSTC_FLAGS" config_summary "man page type" "$MANTYPE" config_summary "search path" "$search_path" config_summary "static-linked-ext" ${EXTSTATIC:+"yes"} |
