From a04c53596735f563a09d628530a2adae7ba26c7a Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Sat, 28 Dec 2019 00:25:11 -0800 Subject: [PATCH] Use __func__ as rb_cv_function_name_string on OpenBSD The use of RUBY_WERROR_FLAG causes this test to fail on OpenBSD platforms that use the binutils linker (ld.bfd) instead of the llvm linker (ld.lld), due to warnings added to the binutils linker in OpenBSD. Removing the RUBY_WERROR_FLAG would probably also fix it, but that would affect other platforms. This should also be backported to Ruby 2.7. Analysis and similar fix recommended by George Koehler. --- configure.ac | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index f9e8573d45..e8d9aa6d5e 100644 --- a/configure.ac +++ b/configure.ac @@ -1525,15 +1525,18 @@ AC_SUBST(MATHN, $mathn) AC_CACHE_CHECK(for function name string predefined identifier, rb_cv_function_name_string, - [rb_cv_function_name_string=no - RUBY_WERROR_FLAG([ - for func in __func__ __FUNCTION__; do - AC_TRY_LINK([@%:@include ], - [puts($func);], - [rb_cv_function_name_string=$func - break]) - done - ])] + [AS_CASE(["$target_os"],[openbsd*],[ + rb_cv_function_name_string=__func__ + ],[ + rb_cv_function_name_string=no + RUBY_WERROR_FLAG([ + for func in __func__ __FUNCTION__; do + AC_TRY_LINK([@%:@include ], + [puts($func);], + [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])