# Process this file with autoconf to produce a configure script.
-# Copyright (C) 1994-2022 Free Software Foundation, Inc.
+# Copyright (C) 1994-2024 Free Software Foundation, Inc.
# Originally contributed by Dave Love (d.love@dl.ac.uk).
#
#This file is part of GCC.
# extra LD Flags which are required for targets
ACX_LT_HOST_FLAGS
-case "${host}" in
- *-darwin*)
- # Darwin needs -single_module when linking libobjc
- extra_ldflags_libobjc='$(lt_host_flags) -Wl,-single_module'
- ;;
- *-cygwin*|*-mingw*)
- # Tell libtool to build DLLs on Windows
- extra_ldflags_libobjc='$(lt_host_flags)'
- ;;
-esac
-AC_SUBST(extra_ldflags_libobjc)
# Add CET specific flags if CET is enabled
GCC_CET_FLAGS(CET_FLAGS)
AC_PROG_MAKE_SET
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
+# Must come after libtool is initialized.
+case "${host}" in
+ *-darwin[[4567]]*)
+ # Earlier Darwin versions need -single_module when linking libobjc; they
+ # do not support @rpath.
+ extra_ldflags_libobjc='$(lt_host_flags) -Wl,-single_module'
+ ;;
+ *-darwin*)
+ # Otherwise, single_module is the default and multi-module is ignored and
+ # obsolete.
+ extra_ldflags_libobjc='$(lt_host_flags)'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ extra_ldflags_libobjc="${extra_ldflags_libobjc} -Wc,-nodefaultrpaths"
+ extra_ldflags_libobjc="${extra_ldflags_libobjc} -Wl,-rpath,@loader_path"
+ fi
+ ;;
+ *-cygwin*|*-mingw*)
+ # Tell libtool to build DLLs on Windows
+ extra_ldflags_libobjc='$(lt_host_flags)'
+ ;;
+esac
+AC_SUBST(extra_ldflags_libobjc)
+
# -------
# Headers
# -------