Skip to content

Commit

Permalink
Suppress useless linker warnings totally on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Apr 19, 2024
1 parent 74cd61f commit 7951b34
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions configure.ac
Expand Up @@ -427,15 +427,22 @@ AS_CASE(["$build_os"],
# default spec.
# Xcode linker warns for deprecated architecture and wrongly
# installed TBD files.
CC_WRAPPER="" CC_NO_WRAPPER="$CC"
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 -e '^ld: warning: ignoring duplicate libraries:' \
-e '^ld: warning: text-based stub file' >/dev/null], [
CC_WRAPPER=`cd -P "${tooldir}" && pwd`/darwin-cc
CC="$CC_WRAPPER $CC"
AS_IF([$CC -framework Foundation -o conftest -ggdb3 conftest.c 2>&1 |
grep \
-e '^ld: warning: ignoring duplicate libraries:' \
-e '^ld: warning: text-based stub file' \
-e '^ld: warning: -multiply_defined is obsolete' \
-e "^warning: '\.debug_macinfo'" \
-e '^note: while processing' \
>/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*], [
Expand Down Expand Up @@ -1768,15 +1775,16 @@ AC_CACHE_CHECK(for function name string predefined identifier,
[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>]],
[[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])
Expand Down

0 comments on commit 7951b34

Please sign in to comment.