Use -no-undefined on macOS to avoid "-undefined dynamic_lookup" warnings.
Starting with macOS 13, the linker warns when "-undefined dynamic_lookup" is used. This is added by libtool by default on macOS but we can suppress it by passing -no-undefined to libtool.
This commit is contained in:
80
configure
vendored
80
configure
vendored
@@ -9201,6 +9201,8 @@ fi
|
|||||||
printf "%s\n" "$ac_cv_path_EGREP" >&6; }
|
printf "%s\n" "$ac_cv_path_EGREP" >&6; }
|
||||||
EGREP="$ac_cv_path_EGREP"
|
EGREP="$ac_cv_path_EGREP"
|
||||||
|
|
||||||
|
EGREP_TRADITIONAL=$EGREP
|
||||||
|
ac_cv_path_EGREP_TRADITIONAL=$EGREP
|
||||||
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
|
||||||
printf %s "checking for fgrep... " >&6; }
|
printf %s "checking for fgrep... " >&6; }
|
||||||
@@ -20055,27 +20057,69 @@ fi
|
|||||||
if test -n "$GCC" -a X"${enable_sanitizer}${enable_fuzzer}" = X"nono"
|
if test -n "$GCC" -a X"${enable_sanitizer}${enable_fuzzer}" = X"nono"
|
||||||
then :
|
then :
|
||||||
|
|
||||||
# On FreeBSD and Dragonfly, environ is filled in by the dynamic loader
|
case $host_os in #(
|
||||||
# so -Wl,--no-undefined causes a link error when environ is used.
|
darwin*) :
|
||||||
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263265
|
|
||||||
# We use errno because OpenBSD shared libraries don't explicitly
|
# On macOS 13, using "-undefined dynamic_lookup" produces a
|
||||||
# link with libc, which can result in undefined reference errors.
|
# warning. Use the -no-undefined libtool option to avoid this.
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the linker accepts -Wl,--no-undefined" >&5
|
|
||||||
|
if test ${LT_LDFLAGS+y}
|
||||||
|
then :
|
||||||
|
|
||||||
|
case " $LT_LDFLAGS " in #(
|
||||||
|
*" -no-undefined "*) :
|
||||||
|
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LT_LDFLAGS already contains -no-undefined"; } >&5
|
||||||
|
(: LT_LDFLAGS already contains -no-undefined) 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
|
test $ac_status = 0; } ;; #(
|
||||||
|
*) :
|
||||||
|
|
||||||
|
as_fn_append LT_LDFLAGS " -no-undefined"
|
||||||
|
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LT_LDFLAGS=\"\$LT_LDFLAGS\""; } >&5
|
||||||
|
(: LT_LDFLAGS="$LT_LDFLAGS") 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
|
test $ac_status = 0; }
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
else case e in #(
|
||||||
|
e)
|
||||||
|
LT_LDFLAGS=-no-undefined
|
||||||
|
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LT_LDFLAGS=\"\$LT_LDFLAGS\""; } >&5
|
||||||
|
(: LT_LDFLAGS="$LT_LDFLAGS") 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
|
test $ac_status = 0; }
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
;; #(
|
||||||
|
*) :
|
||||||
|
|
||||||
|
# On FreeBSD and Dragonfly, environ is filled in by the dynamic loader
|
||||||
|
# so -Wl,--no-undefined causes a link error when environ is used.
|
||||||
|
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263265
|
||||||
|
# We use errno because OpenBSD shared libraries don't explicitly
|
||||||
|
# link with libc, which can result in undefined reference errors.
|
||||||
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the linker accepts -Wl,--no-undefined" >&5
|
||||||
printf %s "checking the linker accepts -Wl,--no-undefined... " >&6; }
|
printf %s "checking the linker accepts -Wl,--no-undefined... " >&6; }
|
||||||
if test ${sudo_cv_var_ld___no_undefined+y}
|
if test ${sudo_cv_var_ld___no_undefined+y}
|
||||||
then :
|
then :
|
||||||
printf %s "(cached) " >&6
|
printf %s "(cached) " >&6
|
||||||
else case e in #(
|
else case e in #(
|
||||||
e)
|
e)
|
||||||
sudo_cv_var_ld___no_undefined=no
|
sudo_cv_var_ld___no_undefined=no
|
||||||
_CFLAGS="$CFLAGS"
|
_CFLAGS="$CFLAGS"
|
||||||
CFLAGS="$CFLAGS $lt_prog_compiler_pic"
|
CFLAGS="$CFLAGS $lt_prog_compiler_pic"
|
||||||
_LDFLAGS="$LDFLAGS"
|
_LDFLAGS="$LDFLAGS"
|
||||||
LDFLAGS="$LDFLAGS $lt_prog_compiler_pic -shared -Wl,--no-undefined"
|
LDFLAGS="$LDFLAGS $lt_prog_compiler_pic -shared -Wl,--no-undefined"
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
int
|
int
|
||||||
main (void)
|
main (void)
|
||||||
{
|
{
|
||||||
@@ -20090,15 +20134,15 @@ then :
|
|||||||
fi
|
fi
|
||||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
CFLAGS="$_CFLAGS"
|
CFLAGS="$_CFLAGS"
|
||||||
LDFLAGS="$_LDFLAGS"
|
LDFLAGS="$_LDFLAGS"
|
||||||
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_var_ld___no_undefined" >&5
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_var_ld___no_undefined" >&5
|
||||||
printf "%s\n" "$sudo_cv_var_ld___no_undefined" >&6; }
|
printf "%s\n" "$sudo_cv_var_ld___no_undefined" >&6; }
|
||||||
if test "$sudo_cv_var_ld___no_undefined" = "yes"
|
if test "$sudo_cv_var_ld___no_undefined" = "yes"
|
||||||
then :
|
then :
|
||||||
|
|
||||||
|
|
||||||
@@ -20137,6 +20181,8 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
50
configure.ac
50
configure.ac
@@ -2410,28 +2410,34 @@ AC_INCLUDES_DEFAULT
|
|||||||
# We must set this *before* the library tests.
|
# We must set this *before* the library tests.
|
||||||
#
|
#
|
||||||
AS_IF([test -n "$GCC" -a X"${enable_sanitizer}${enable_fuzzer}" = X"nono"], [
|
AS_IF([test -n "$GCC" -a X"${enable_sanitizer}${enable_fuzzer}" = X"nono"], [
|
||||||
# On FreeBSD and Dragonfly, environ is filled in by the dynamic loader
|
AS_CASE([$host_os], [darwin*], [
|
||||||
# so -Wl,--no-undefined causes a link error when environ is used.
|
# On macOS 13, using "-undefined dynamic_lookup" produces a
|
||||||
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263265
|
# warning. Use the -no-undefined libtool option to avoid this.
|
||||||
# We use errno because OpenBSD shared libraries don't explicitly
|
AX_APPEND_FLAG([-no-undefined], [LT_LDFLAGS])
|
||||||
# link with libc, which can result in undefined reference errors.
|
], [
|
||||||
AC_CACHE_CHECK([the linker accepts -Wl,--no-undefined],
|
# On FreeBSD and Dragonfly, environ is filled in by the dynamic loader
|
||||||
[sudo_cv_var_ld___no_undefined],
|
# so -Wl,--no-undefined causes a link error when environ is used.
|
||||||
[
|
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263265
|
||||||
sudo_cv_var_ld___no_undefined=no
|
# We use errno because OpenBSD shared libraries don't explicitly
|
||||||
_CFLAGS="$CFLAGS"
|
# link with libc, which can result in undefined reference errors.
|
||||||
CFLAGS="$CFLAGS $lt_prog_compiler_pic"
|
AC_CACHE_CHECK([the linker accepts -Wl,--no-undefined],
|
||||||
_LDFLAGS="$LDFLAGS"
|
[sudo_cv_var_ld___no_undefined],
|
||||||
LDFLAGS="$LDFLAGS $lt_prog_compiler_pic -shared -Wl,--no-undefined"
|
[
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <errno.h>
|
sudo_cv_var_ld___no_undefined=no
|
||||||
extern char **environ;]], [[int ret = ((long)environ & 0xff) + errno; return ret;]])],
|
_CFLAGS="$CFLAGS"
|
||||||
[sudo_cv_var_ld___no_undefined=yes])
|
CFLAGS="$CFLAGS $lt_prog_compiler_pic"
|
||||||
CFLAGS="$_CFLAGS"
|
_LDFLAGS="$LDFLAGS"
|
||||||
LDFLAGS="$_LDFLAGS"
|
LDFLAGS="$LDFLAGS $lt_prog_compiler_pic -shared -Wl,--no-undefined"
|
||||||
]
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <errno.h>
|
||||||
)
|
extern char **environ;]], [[int ret = ((long)environ & 0xff) + errno; return ret;]])],
|
||||||
AS_IF([test "$sudo_cv_var_ld___no_undefined" = "yes"], [
|
[sudo_cv_var_ld___no_undefined=yes])
|
||||||
AX_APPEND_FLAG([-Wl,--no-undefined], [LDFLAGS])
|
CFLAGS="$_CFLAGS"
|
||||||
|
LDFLAGS="$_LDFLAGS"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
AS_IF([test "$sudo_cv_var_ld___no_undefined" = "yes"], [
|
||||||
|
AX_APPEND_FLAG([-Wl,--no-undefined], [LDFLAGS])
|
||||||
|
])
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user