summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2021-01-09 08:07:29 +0000
committerDaiki Ueno <ueno@gnu.org>2021-01-09 08:07:29 +0000
commit67ccc7d3a3cc4adab82fff546b97a44c244f38fd (patch)
tree4b7f0e3273aec76103867709d0a74fb13e933f10
parent384ac9f67cd4f3241b69ce4d47bf9b70b9f7d5cb (diff)
parent52f8617e705bfb05d2abd597fbdcd9594f4b04c3 (diff)
downloadgnutls-67ccc7d3a3cc4adab82fff546b97a44c244f38fd.tar.gz
Merge branch 'no-weak' into 'master'
configure: Remove -no_weak_links from LDFLAGS after detecting function availability Closes #966 See merge request gnutls/gnutls!1376
-rw-r--r--configure.ac19
1 files changed, 18 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 76d414b868..2d889c53ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -145,7 +145,7 @@ case "$host" in
dnl intended minimum runtime version.
LDFLAGS="$LDFLAGS -Wl,-no_weak_imports"
AC_MSG_CHECKING([whether the linker supports -Wl,-no_weak_imports])
- AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/select.h>], [fd_set rfds; FD_ZERO(&rfds); FD_SET(0, &rfds);])],
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no); LDFLAGS="$save_LDFLAGS"])
;;
*solaris*)
@@ -415,6 +415,23 @@ if test "$ac_cv_func_clock_gettime" != "yes";then
gnutls_needs_librt=yes
fi
+if test "$have_macosx" = "yes";then
+ dnl Remove -no_weak_imports from LDFLAGS after testing for function
+ dnl availability; keeping it included later breaks code that uses
+ dnl FD_SET, which since Xcode 11.4 implicitly adds a call to the
+ dnl weakly linked function __darwin_check_fd_set_overflow. We only
+ dnl need it above to make sure that we don't detect functions that
+ dnl are linked weakly (and can end up null at runtime) unless
+ dnl we check for their availability at runtime.
+ new_LDFLAGS=""
+ for f in $LDFLAGS; do
+ if test "$f" != "-Wl,-no_weak_imports"; then
+ new_LDFLAGS="$new_LDFLAGS $f"
+ fi
+ done
+ LDFLAGS="$new_LDFLAGS"
+fi
+
AC_ARG_WITH(included-unistring, AS_HELP_STRING([--with-included-unistring],
[disable linking with system libunistring]),
included_unistring="$withval",