* Darwin: Replace environment runpath with embedded [PR88590]
@ 2023-08-15 16:58 FX Coudert
2023-08-18 20:17 ` Joseph Myers
` (3 more replies)
0 siblings, 4 replies; 39+ messages in thread
From: FX Coudert @ 2023-08-15 16:58 UTC (permalink / raw)
To: gcc-patches; +Cc: Iain Sandoe, Joseph Myers
[-- Attachment #1: Type: text/plain, Size: 1288 bytes --]
Hi,
I’d like to post an updated and rebased version of Iain Sandoe’s patches for modern darwin, originally posted in November 2021: https://gcc.gnu.org/pipermail/gcc-patches/2021-November/584775.html
The rationale in that message is pretty much unchanged, and the patches have been since tested thoroughly on darwin (both Intel and ARM) for almost two years now. We have been shipping Iain’s branch (including these patches) since then in Homebrew and most other major distros of GCC on Darwin. So I think it’s been very thoroughly tested.
The main comment that arose from review in the previous incarnation was the need to at least offer the libtool part of the patch to upstream, in order to reduce in the long term the divergence between our version and upstream. I have done so in https://savannah.gnu.org/patch/index.php?10385
(I would also note that I have offered other suggestions of small snippets that could be upstream in libtool for darwin, but have not received much feedback for now: https://savannah.gnu.org/patch/?10371)
I am currently retesting the patches on various archs (Linux and Darwin) after a final rebase, but various previous versions were regression-tested, and have been shipped for a long time in Homebrew.
OK to commit?
FX
[-- Attachment #2: 0001-Driver-Provide-a-spec-to-insert-rpaths-for-compiler-.patch --]
[-- Type: application/octet-stream, Size: 3952 bytes --]
From d0184c9a3fb727bb1bce629831844569bfbfbef2 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Thu, 20 Dec 2018 09:00:38 +0000
Subject: [PATCH 1/4] Driver: Provide a spec to insert rpaths for compiler lib
dirs.
This provides a spec to insert "-rpath DDD" for each DDD corresponding
to a compiler startfile directory. This allows a target to use @rpath
as the install path for libraries, and have the compiler provide the
necessary rpath to handle this.
Embed real paths, not relative ones.
We embed a runpath for every path in which libraries might be found. This
change ensures that we embed the actual real path and not a relative one from
the compiler's version-specific directory.
e.g.
/opt/distro/gcc-11-3Dr0/lib
instead of:
/opt/distro/gcc-11-3Dr0/lib/gcc/x86_64-apple-darwin19/11.3.0/../../..
This ensures that if we install, for example, 11.4.0 (and delete the 11.3.0
installation) exes built by 11.3 would continue to function (providing, of course
that 11.4 does not bump any SO names).
gcc/ChangeLog:
* gcc.cc (RUNPATH_OPTION): New.
(do_spec_1): Provide '%P' as a spec to insert rpaths for
each compiler startfile path.
---
gcc/gcc.cc | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index fdfac0b4fe4..7c6e4879a31 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -579,6 +579,7 @@ or with constant text in a single argument.
%l process LINK_SPEC as a spec.
%L process LIB_SPEC as a spec.
%M Output multilib_os_dir.
+ %P Output a RUNPATH_OPTION for each directory in startfile_prefixes.
%G process LIBGCC_SPEC as a spec.
%R Output the concatenation of target_system_root and
target_sysroot_suffix.
@@ -1182,6 +1183,10 @@ proper position among the other output files. */
# define SYSROOT_HEADERS_SUFFIX_SPEC ""
#endif
+#ifndef RUNPATH_OPTION
+# define RUNPATH_OPTION "-rpath"
+#endif
+
static const char *asm_debug = ASM_DEBUG_SPEC;
static const char *asm_debug_option = ASM_DEBUG_OPTION_SPEC;
static const char *cpp_spec = CPP_SPEC;
@@ -5925,6 +5930,7 @@ struct spec_path_info {
size_t append_len;
bool omit_relative;
bool separate_options;
+ bool realpaths;
};
static void *
@@ -5934,6 +5940,16 @@ spec_path (char *path, void *data)
size_t len = 0;
char save = 0;
+ /* The path must exist; we want to resolve it to the realpath so that this
+ can be embedded as a runpath. */
+ if (info->realpaths)
+ path = lrealpath (path);
+
+ /* However, if we failed to resolve it - perhaps because there was a bogus
+ -B option on the command line, then punt on this entry. */
+ if (!path)
+ return NULL;
+
if (info->omit_relative && !IS_ABSOLUTE_PATH (path))
return NULL;
@@ -6165,6 +6181,22 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
info.omit_relative = false;
#endif
info.separate_options = false;
+ info.realpaths = false;
+
+ for_each_path (&startfile_prefixes, true, 0, spec_path, &info);
+ }
+ break;
+
+ case 'P':
+ {
+ struct spec_path_info info;
+
+ info.option = RUNPATH_OPTION;
+ info.append_len = 0;
+ info.omit_relative = false;
+ info.separate_options = true;
+ /* We want to embed the actual paths that have the libraries. */
+ info.realpaths = true;
for_each_path (&startfile_prefixes, true, 0, spec_path, &info);
}
@@ -6491,6 +6523,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
info.append_len = strlen (info.append);
info.omit_relative = false;
info.separate_options = true;
+ info.realpaths = false;
for_each_path (&include_prefixes, false, info.append_len,
spec_path, &info);
--
2.39.2 (Apple Git-143)
[-- Attachment #3: 0002-Darwin-Allow-for-configuring-Darwin-to-use-embedded-.patch --]
[-- Type: application/octet-stream, Size: 281749 bytes --]
From e1cf04cadb9fa065fb3f7d6bccf9ed6f1e9e3fc1 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Sun, 28 Mar 2021 14:48:17 +0100
Subject: [PATCH 2/4] Darwin: Allow for configuring Darwin to use embedded
runpath.
Recent Darwin versions place contraints on the use of run paths
specified in environment variables. This breaks some assumptions
in the GCC build.
This change allows the user to configure a Darwin build to use
'@rpath/libraryname.dylib' in library names and then to add an
embedded runpath to executables (and libraries with dependents).
The embedded runpath is added by default unless the user adds
'-nodefaultrpaths' to the link line.
For an installed compiler, it means that any executable built with
that compiler will reference the runtimes installed with the
compiler (equivalent to hard-coding the library path into the name
of the library).
During build-time configurations any "-B" entries will be added to
the runpath thus the newly-built libraries will be found by exes.
Since the install name is set in libtool, that decision needs to be
available here (but might also cause dependent ones in Makefiles,
so we need to export a conditional).
This facility is not available for Darwin 8 or earlier, however the
existing environment variable runpath does work there.
We default this on for systems where the external DYLD_LIBRARY_PATH
does not work and off for Darwin 8 or earlier. For systems that can
use either method, if the value is unset, we use the default (which
is currently DYLD_LIBRARY_PATH).
----
Ada changes:
add paths relative to @loader-path
JIT changes:
This patch expects DARWIN_RPATH to be computed and available; which
means that we will use @rpath or ${libdir} as the name prefix
depending on the system version and the setting of
--enable-darwin-at-rpath. For branches that do not have this
available, the value should be set to ${libdir}.
added m2 library changes.
ChangeLog:
* configure: Regenerate.
* configure.ac: Do not add default runpaths to GCC exes
when we are building -static-libstdc++/-static-libgcc (the
default).
* libtool.m4: Add 'enable-darwin-at-runpath'. Act on the
enable flag to alter Darwin libraries to use @rpath names.
fixincludes/ChangeLog:
* configure: Regenerate.
gcc/ChangeLog:
* aclocal.m4: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
* config/darwin-driver.cc: Handle Darwin rpaths.
* config/darwin.h: Handle Darwin rpaths.
* config/darwin.opt: Handle Darwin rpaths.
* Makefile.in: Handle Darwin rpaths.
gcc/ada/ChangeLog:
* gcc-interface/Makefile.in: Handle Darwin rpaths.
gcc/jit/ChangeLog:
* Make-lang.in: Handle Darwin rpaths.
libatomic/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libbacktrace/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libcc1/ChangeLog:
* configure: Regenerate.
libffi/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
libgcc/ChangeLog:
* config/t-slibgcc-darwin: Generate libgcc_s
with an @rpath name.
* config.host: Handle Darwin rpaths.
libgfortran/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths
libgm2/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* aclocal.m4: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
* libm2cor/Makefile.am: Handle Darwin rpaths.
* libm2cor/Makefile.in: Regenerate.
* libm2iso/Makefile.am: Handle Darwin rpaths.
* libm2iso/Makefile.in: Regenerate.
* libm2log/Makefile.am: Handle Darwin rpaths.
* libm2log/Makefile.in: Regenerate.
* libm2min/Makefile.am: Handle Darwin rpaths.
* libm2min/Makefile.in: Regenerate.
* libm2pim/Makefile.am: Handle Darwin rpaths.
* libm2pim/Makefile.in: Regenerate.
libgomp/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths
libitm/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libobjc/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libphobos/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
* libdruntime/Makefile.am: Handle Darwin rpaths.
* libdruntime/Makefile.in: Regenerate.
* src/Makefile.am: Handle Darwin rpaths.
* src/Makefile.in: Regenerate.
libquadmath/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libsanitizer/ChangeLog:
* asan/Makefile.am: Handle Darwin rpaths.
* asan/Makefile.in: Regenerate.
* configure: Regenerate.
* hwasan/Makefile.am: Handle Darwin rpaths.
* hwasan/Makefile.in: Regenerate.
* lsan/Makefile.am: Handle Darwin rpaths.
* lsan/Makefile.in: Regenerate.
* tsan/Makefile.am: Handle Darwin rpaths.
* tsan/Makefile.in: Regenerate.
* ubsan/Makefile.am: Handle Darwin rpaths.
* ubsan/Makefile.in: Regenerate.
libssp/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libstdc++-v3/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
* src/Makefile.am: Handle Darwin rpaths.
* src/Makefile.in: Regenerate.
libvtv/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
lto-plugin/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
zlib/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
---
configure | 14 ++
configure.ac | 14 ++
fixincludes/configure | 2 +-
gcc/Makefile.in | 11 +-
gcc/aclocal.m4 | 50 +++++++
gcc/ada/gcc-interface/Makefile.in | 5 +-
gcc/config/darwin-driver.cc | 24 ++++
gcc/config/darwin.h | 32 ++++-
gcc/config/darwin.opt | 4 +
gcc/configure | 132 ++++++++++++++++--
gcc/configure.ac | 2 +
gcc/jit/Make-lang.in | 2 +-
libatomic/Makefile.am | 7 +-
libatomic/Makefile.in | 7 +-
libatomic/configure | 75 ++++++++++-
libatomic/configure.ac | 2 +
libbacktrace/configure | 75 ++++++++++-
libbacktrace/configure.ac | 2 +
libcc1/configure | 117 ++++++++++++++--
libffi/Makefile.am | 7 +-
libffi/Makefile.in | 6 +-
libffi/configure | 131 ++++++++++++++++--
libffi/configure.ac | 1 +
libgcc/config.host | 23 +++-
libgcc/config/t-darwin-rpath | 2 +
libgcc/config/t-slibgcc-darwin | 28 ++--
libgfortran/Makefile.am | 7 +-
libgfortran/Makefile.in | 28 ++--
libgfortran/configure | 130 ++++++++++++++++--
libgfortran/configure.ac | 6 +-
libgm2/Makefile.am | 9 +-
libgm2/Makefile.in | 15 ++-
libgm2/aclocal.m4 | 10 +-
libgm2/configure | 144 ++++++++++++++++++--
libgm2/configure.ac | 6 +-
libgm2/libm2cor/Makefile.am | 4 +
libgm2/libm2cor/Makefile.in | 17 ++-
libgm2/libm2iso/Makefile.am | 4 +
libgm2/libm2iso/Makefile.in | 17 ++-
libgm2/libm2log/Makefile.am | 3 +
libgm2/libm2log/Makefile.in | 17 ++-
libgm2/libm2min/Makefile.am | 3 +
libgm2/libm2min/Makefile.in | 17 ++-
libgm2/libm2pim/Makefile.am | 3 +
libgm2/libm2pim/Makefile.in | 17 ++-
libgo/configure | 18 ++-
libgo/configure.ac | 1 +
libgomp/Makefile.am | 7 +-
libgomp/Makefile.in | 5 +-
libgomp/configure | 125 ++++++++++++++++-
libgomp/configure.ac | 1 +
libitm/Makefile.am | 7 +-
libitm/Makefile.in | 7 +-
libitm/configure | 131 ++++++++++++++++--
libitm/configure.ac | 1 +
libobjc/configure | 111 ++++++++++++---
libobjc/configure.ac | 36 +++--
libphobos/configure | 125 ++++++++++++++++-
libphobos/configure.ac | 1 +
libphobos/libdruntime/Makefile.am | 5 +-
libphobos/libdruntime/Makefile.in | 3 +-
libphobos/src/Makefile.am | 5 +-
libphobos/src/Makefile.in | 3 +-
libquadmath/Makefile.am | 7 +-
libquadmath/Makefile.in | 5 +-
libquadmath/configure | 217 +++++++++++++++++++++++++++++-
libquadmath/configure.ac | 3 +
libsanitizer/asan/Makefile.am | 7 +-
libsanitizer/asan/Makefile.in | 7 +-
libsanitizer/configure | 132 ++++++++++++++++--
libsanitizer/configure.ac | 2 +
libsanitizer/hwasan/Makefile.am | 6 +-
libsanitizer/hwasan/Makefile.in | 5 +-
libsanitizer/lsan/Makefile.am | 8 +-
libsanitizer/lsan/Makefile.in | 8 +-
libsanitizer/tsan/Makefile.am | 6 +-
libsanitizer/tsan/Makefile.in | 5 +-
libsanitizer/ubsan/Makefile.am | 7 +-
libsanitizer/ubsan/Makefile.in | 7 +-
libssp/Makefile.am | 6 +-
libssp/Makefile.in | 5 +-
libssp/configure | 75 ++++++++++-
libssp/configure.ac | 2 +
libstdc++-v3/configure | 143 ++++++++++++++++++--
libstdc++-v3/configure.ac | 1 +
libstdc++-v3/src/Makefile.am | 7 +-
libstdc++-v3/src/Makefile.in | 5 +-
libtool.m4 | 57 +++++++-
libvtv/configure | 131 ++++++++++++++++--
libvtv/configure.ac | 1 +
lto-plugin/configure | 74 +++++++++-
lto-plugin/configure.ac | 1 +
zlib/configure | 74 +++++++++-
zlib/configure.ac | 1 +
94 files changed, 2561 insertions(+), 278 deletions(-)
create mode 100644 libgcc/config/t-darwin-rpath
diff --git a/configure b/configure
index 28f0913bdd4..28e25bf7162 100755
--- a/configure
+++ b/configure
@@ -8492,6 +8492,20 @@ else
fi
fi
+case $target in
+ *-darwin2* | *-darwin1[56789]*)
+ # For these versions, we default to using embedded rpaths.
+ if test "x$enable_darwin_at_rpath" != "xno"; then
+ poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths"
+ fi
+ ;;
+ *-darwin*)
+ # For these versions, we only use embedded rpaths on demand.
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths"
+ fi
+ ;;
+esac
# GCC GRAPHITE dependency isl.
diff --git a/configure.ac b/configure.ac
index 5d25dc864c3..49c237bb8b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1855,6 +1855,20 @@ AC_ARG_WITH(boot-ldflags,
if test "$poststage1_libs" = ""; then
poststage1_ldflags="-static-libstdc++ -static-libgcc"
fi])
+case $target in
+ *-darwin2* | *-darwin1[[56789]]*)
+ # For these versions, we default to using embedded rpaths.
+ if test "x$enable_darwin_at_rpath" != "xno"; then
+ poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths"
+ fi
+ ;;
+ *-darwin*)
+ # For these versions, we only use embedded rpaths on demand.
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths"
+ fi
+ ;;
+esac
AC_SUBST(poststage1_ldflags)
# GCC GRAPHITE dependency isl.
diff --git a/fixincludes/configure b/fixincludes/configure
index b9770489adc..1bb547a1724 100755
--- a/fixincludes/configure
+++ b/fixincludes/configure
@@ -3027,6 +3027,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# ---------------------------
# _LT_COMPILER_PIC
+enable_darwin_at_rpath_$1=no
# _LT_LINKER_SHLIBS([TAGNAME])
# ----------------------------
@@ -3049,7 +3050,6 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# the compiler configuration to `libtool'.
# _LT_LANG_CXX_CONFIG
-
# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
# ---------------------------------
# Figure out "hidden" library dependencies from verbose
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index a00dad965c5..6809a7781a1 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1191,6 +1191,8 @@ LANG_MAKEFRAGS = @all_lang_makefrags@
# Used by gcc/jit/Make-lang.in
LD_VERSION_SCRIPT_OPTION = @ld_version_script_option@
LD_SONAME_OPTION = @ld_soname_option@
+@ENABLE_DARWIN_AT_RPATH_TRUE@DARWIN_RPATH = @rpath
+@ENABLE_DARWIN_AT_RPATH_FALSE@DARWIN_RPATH = ${libdir}
# Flags to pass to recursive makes.
# CC is set by configure.
@@ -2012,9 +2014,12 @@ cs-tconfig.h: Makefile
$(SHELL) $(srcdir)/mkconfig.sh tconfig.h
cs-tm.h: Makefile
- TARGET_CPU_DEFAULT="$(target_cpu_default)" \
- HEADERS="$(tm_include_list)" DEFINES="$(tm_defines)" \
- $(SHELL) $(srcdir)/mkconfig.sh tm.h
+@ENABLE_DARWIN_AT_RPATH_FALSE@ TARGET_CPU_DEFAULT="$(target_cpu_default)" \
+@ENABLE_DARWIN_AT_RPATH_FALSE@ HEADERS="$(tm_include_list)" DEFINES="$(tm_defines)" \
+@ENABLE_DARWIN_AT_RPATH_FALSE@ $(SHELL) $(srcdir)/mkconfig.sh tm.h
+@ENABLE_DARWIN_AT_RPATH_TRUE@ TARGET_CPU_DEFAULT="$(target_cpu_default)" \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ HEADERS="$(tm_include_list)" DEFINES="$(tm_defines) DARWIN_AT_RPATH=1" \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ $(SHELL) $(srcdir)/mkconfig.sh tm.h
cs-tm_p.h: Makefile
TARGET_CPU_DEFAULT="" \
diff --git a/gcc/aclocal.m4 b/gcc/aclocal.m4
index 6be36df5190..126e09bbcd1 100644
--- a/gcc/aclocal.m4
+++ b/gcc/aclocal.m4
@@ -12,6 +12,56 @@
# PARTICULAR PURPOSE.
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ([2.52])dnl
+ m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 2006-2017 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# --------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
m4_include([../libtool.m4])
m4_include([../ltoptions.m4])
m4_include([../ltsugar.m4])
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index b5243a24a8f..ad7cf5072e5 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -794,12 +794,15 @@ gnatlib-shared-darwin:
$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
$(SO_OPTS) \
-Wl,-install_name,@rpath/libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
- $(MISCLIB)
+ -nodefaultrpaths -Wl,-rpath,@loader_path/,-rpath,@loader_path/.. \
+ -Wl,-rpath,@loader_path/../../../../ $(MISCLIB)
cd $(RTSDIR); $(GCC_FOR_ADA_RTS) -dynamiclib $(PICFLAG_FOR_TARGET) \
-o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
$(GNATRTL_TASKING_OBJS) \
$(SO_OPTS) \
-Wl,-install_name,@rpath/libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ -nodefaultrpaths -Wl,-rpath,@loader_path/,-rpath,@loader_path/.. \
+ -Wl,-rpath,@loader_path/../../../../ \
$(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
cd $(RTSDIR); $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
libgnat$(soext)
diff --git a/gcc/config/darwin-driver.cc b/gcc/config/darwin-driver.cc
index 9c1dcc3d794..cdfcac93b00 100644
--- a/gcc/config/darwin-driver.cc
+++ b/gcc/config/darwin-driver.cc
@@ -276,6 +276,10 @@ darwin_driver_init (unsigned int *decoded_options_count,
bool seen_version_min = false;
bool seen_sysroot_p = false;
bool noexport_p = true;
+#ifdef RPATH_SETS_NODEFAULT
+ bool seen_rpath_p = false;
+ bool seen_nodefaultrpaths_p = false;
+#endif
for (i = 1; i < *decoded_options_count; i++)
{
@@ -349,8 +353,16 @@ darwin_driver_init (unsigned int *decoded_options_count,
gcc_checking_assert ((*decoded_options)[i].arg);
if (startswith ((*decoded_options)[i].arg, "-exported_symbol"))
noexport_p = false;
+#ifdef RPATH_SETS_NODEFAULT
+ else if (strncmp ((*decoded_options)[i].arg, "-rpath", 6) == 0)
+ seen_rpath_p = true;
+#endif
break;
+#ifdef RPATH_SETS_NODEFAULT
+ case OPT_nodefaultrpaths:
+ seen_nodefaultrpaths_p = true;
+#endif
default:
break;
}
@@ -490,4 +502,16 @@ darwin_driver_init (unsigned int *decoded_options_count,
generate_option (OPT_nodefaultexport, NULL, 1, CL_DRIVER,
&(*decoded_options)[*decoded_options_count - 1]);
}
+
+#ifdef RPATH_SETS_NODEFAULT
+ if (seen_rpath_p && !seen_nodefaultrpaths_p)
+ {
+ ++*decoded_options_count;
+ *decoded_options = XRESIZEVEC (struct cl_decoded_option,
+ *decoded_options,
+ *decoded_options_count);
+ generate_option (OPT_nodefaultrpaths, NULL, 1, CL_DRIVER,
+ &(*decoded_options)[*decoded_options_count - 1]);
+ }
+#endif
}
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index e0e8672a455..44c92db6214 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -309,6 +309,18 @@ extern GTY(()) int darwin_ms_struct;
#define DARWIN_CC1_SPEC \
"%<dynamic %<dynamiclib %<force_cpusubtype_ALL %<multiply_defined* "
+/* When we are using embedded runpaths DARWIN_AT_RPATH is set. */
+#if DARWIN_AT_RPATH
+# define DARWIN_RPATH_LINK \
+"%{!r:%{!nostdlib:%{!nodefaultrpaths:%(darwin_rpaths)}}}"
+# define DARWIN_SHARED_LIBGCC "-lgcc_s.1.1"
+#else
+# define DARWIN_RPATH_LINK ""
+# define DARWIN_SHARED_LIBGCC \
+"%:version-compare(!> 10.11 mmacosx-version-min= -lgcc_s.1.1) \
+ %:version-compare(>= 10.11 mmacosx-version-min= -lemutls_w) "
+#endif
+
#define SUBSUBTARGET_OVERRIDE_OPTIONS \
do { \
darwin_override_options (); \
@@ -403,7 +415,8 @@ extern GTY(()) int darwin_ms_struct;
DARWIN_NOPIE_SPEC \
DARWIN_RDYNAMIC \
DARWIN_NOCOMPACT_UNWIND \
- "}}}}}}} %<pie %<no-pie %<rdynamic %<X %<rpath "
+ DARWIN_RPATH_LINK \
+ "}}}}}}} %<pie %<no-pie %<rdynamic %<X %<rpath %<nodefaultrpaths "
/* Spec that controls whether the debug linker is run automatically for
a link step. This needs to be done if there is a source file on the
@@ -518,8 +531,7 @@ extern GTY(()) int darwin_ms_struct;
%:version-compare(!> 10.6 mmacosx-version-min= -lgcc_eh) \
%:version-compare(>= 10.6 mmacosx-version-min= -lemutls_w); \
shared-libgcc|fexceptions|fobjc-exceptions|fgnu-runtime: \
- %:version-compare(!> 10.11 mmacosx-version-min= -lgcc_s.1.1) \
- %:version-compare(>= 10.11 mmacosx-version-min= -lemutls_w) \
+ " DARWIN_SHARED_LIBGCC " \
%:version-compare(!> 10.3.9 mmacosx-version-min= -lgcc_eh) \
%:version-compare(>< 10.3.9 10.5 mmacosx-version-min= -lgcc_s.10.4) \
%:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5); \
@@ -554,7 +566,8 @@ extern GTY(()) int darwin_ms_struct;
{ "darwin_crt2", DARWIN_CRT2_SPEC }, \
{ "darwin_crt3", DARWIN_CRT3_SPEC }, \
{ "darwin_dylib1", DARWIN_DYLIB1_SPEC }, \
- { "darwin_bundle1", DARWIN_BUNDLE1_SPEC },
+ { "darwin_bundle1", DARWIN_BUNDLE1_SPEC }, \
+ { "darwin_rpaths", DARWIN_RPATH_SPEC },
#define DARWIN_CRT1_SPEC \
"%:version-compare(!> 10.5 mmacosx-version-min= -lcrt1.o) \
@@ -580,6 +593,17 @@ extern GTY(()) int darwin_ms_struct;
"%{!static:%:version-compare(< 10.6 mmacosx-version-min= -lbundle1.o) \
%{fgnu-tm: -lcrttms.o}}"
+#if DARWIN_AT_RPATH
+/* A default rpath, that picks up dependent libraries installed in the same
+ director as one being loaded. */
+#define DARWIN_RPATH_SPEC \
+ "%:version-compare(>= 10.5 mmacosx-version-min= -rpath) \
+ %:version-compare(>= 10.5 mmacosx-version-min= @loader_path) \
+ %P "
+#else
+#define DARWIN_RPATH_SPEC ""
+#endif
+
#ifdef HAVE_AS_MMACOSX_VERSION_MIN_OPTION
/* Emit macosx version (but only major). */
#define ASM_MMACOSX_VERSION_MIN_SPEC \
diff --git a/gcc/config/darwin.opt b/gcc/config/darwin.opt
index d655aaef2fb..ff624ffd82a 100644
--- a/gcc/config/darwin.opt
+++ b/gcc/config/darwin.opt
@@ -241,6 +241,10 @@ nodefaultexport
Driver RejectNegative
Do not add a default symbol exports to modules or dynamic libraries.
+nodefaultrpaths
+Driver RejectNegative
+Do not add default run paths (for the compiler library directories) to executables, modules or dynamic libraries.
+
nofixprebinding
Driver RejectNegative
(Obsolete after 10.3.9) Set MH_NOPREFIXBINDING, in an executable.
diff --git a/gcc/configure b/gcc/configure
index db5812d4a63..89c370f750e 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -741,6 +741,8 @@ ORIGINAL_PLUGIN_LD_FOR_TARGET
gcc_cv_ld
ORIGINAL_AS_FOR_TARGET
gcc_cv_as
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_fast_install
objdir
OTOOL64
@@ -1006,6 +1008,7 @@ enable_static
with_pic
enable_fast_install
enable_libtool_lock
+enable_darwin_at_rpath
enable_ld
enable_gold
with_plugin_ld
@@ -1741,6 +1744,8 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-path install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-ld[=ARG] build ld [ARG={default,yes,no}]
--enable-gold[=ARG] build gold [ARG={default,yes,no}]
--enable-gnu-indirect-function
@@ -16356,7 +16361,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -18061,6 +18066,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -18078,9 +18126,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -19886,7 +19938,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19889 "configure"
+#line 19941 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -19992,7 +20044,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19995 "configure"
+#line 20047 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -20868,6 +20920,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -20885,12 +20980,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -23261,6 +23364,15 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# Identify the assembler which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the assembler
# which will be driven by the driver program.
@@ -32850,6 +32962,10 @@ LTLIBOBJS=$ac_ltlibobjs
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 46e58a27661..6c9d0ad6897 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2599,6 +2599,8 @@ AC_PROG_LIBTOOL
AC_SUBST(objdir)
AC_SUBST(enable_fast_install)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
# Identify the assembler which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the assembler
# which will be driven by the driver program.
diff --git a/gcc/jit/Make-lang.in b/gcc/jit/Make-lang.in
index a65f13853ae..3fd564a5932 100644
--- a/gcc/jit/Make-lang.in
+++ b/gcc/jit/Make-lang.in
@@ -59,7 +59,7 @@ LIBGCCJIT_AGE = 1
LIBGCCJIT_BASENAME = libgccjit
LIBGCCJIT_SONAME = \
- ${libdir}/$(LIBGCCJIT_BASENAME).$(LIBGCCJIT_VERSION_NUM).dylib
+ $(DARWIN_RPATH)/$(LIBGCCJIT_BASENAME).$(LIBGCCJIT_VERSION_NUM).dylib
LIBGCCJIT_FILENAME = $(LIBGCCJIT_BASENAME).$(LIBGCCJIT_VERSION_NUM).dylib
LIBGCCJIT_LINKER_NAME = $(LIBGCCJIT_BASENAME).dylib
diff --git a/libatomic/Makefile.am b/libatomic/Makefile.am
index c6c8d81c56a..d18738cd7e6 100644
--- a/libatomic/Makefile.am
+++ b/libatomic/Makefile.am
@@ -65,8 +65,13 @@ libatomic_version_script =
libatomic_version_dep =
endif
libatomic_version_info = -version-info $(libtool_VERSION)
+if ENABLE_DARWIN_AT_RPATH
+libatomic_darwin_rpath = -Wc,-nodefaultrpaths
+libatomic_darwin_rpath += -Wl,-rpath,@loader_path
+endif
-libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) $(lt_host_flags)
+libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) \
+ $(lt_host_flags) $(libatomic_darwin_rpath)
libatomic_la_SOURCES = gload.c gstore.c gcas.c gexch.c glfree.c lock.c init.c \
fenv.c fence.c flag.c
diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in
index 83efe7d2694..47425efae01 100644
--- a/libatomic/Makefile.in
+++ b/libatomic/Makefile.in
@@ -416,7 +416,12 @@ noinst_LTLIBRARIES = libatomic_convenience.la
@LIBAT_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@libatomic_version_dep = $(top_srcdir)/libatomic.map
@LIBAT_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@libatomic_version_dep = libatomic.map-sun
libatomic_version_info = -version-info $(libtool_VERSION)
-libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) $(lt_host_flags)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libatomic_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) \
+ $(lt_host_flags) $(libatomic_darwin_rpath)
+
libatomic_la_SOURCES = gload.c gstore.c gcas.c gexch.c glfree.c lock.c \
init.c fenv.c fence.c flag.c $(am__append_2)
SIZEOBJS = load store cas exch fadd fsub fand fior fxor fnand tas
diff --git a/libatomic/configure b/libatomic/configure
index 57f320753e1..e682249216b 100755
--- a/libatomic/configure
+++ b/libatomic/configure
@@ -658,6 +658,8 @@ OPT_LDFLAGS
SECTION_LDFLAGS
enable_aarch64_lse
libtool_VERSION
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
@@ -802,6 +804,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
enable_symvers
enable_werror
@@ -1451,6 +1454,8 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-path install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -7604,7 +7609,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9577,6 +9582,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9594,9 +9642,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11402,7 +11454,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11405 "configure"
+#line 11457 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11508,7 +11560,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11511 "configure"
+#line 11563 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11793,6 +11845,15 @@ fi
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=3:0:2
@@ -15920,6 +15981,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${LIBAT_BUILD_VERSIONED_SHLIB_TRUE}" && test -z "${LIBAT_BUILD_VERSIONED_SHLIB_FALSE}"; then
as_fn_error $? "conditional \"LIBAT_BUILD_VERSIONED_SHLIB\" was never defined.
diff --git a/libatomic/configure.ac b/libatomic/configure.ac
index 318b605a1d7..6919d212ae5 100644
--- a/libatomic/configure.ac
+++ b/libatomic/configure.ac
@@ -155,6 +155,8 @@ AC_SUBST(enable_shared)
AC_SUBST(enable_static)
AM_MAINTAINER_MODE
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=3:0:2
AC_SUBST(libtool_VERSION)
diff --git a/libbacktrace/configure b/libbacktrace/configure
index c3e7b884e36..bdb1f907105 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -681,6 +681,8 @@ PIC_FLAG
WARN_FLAGS
EXTRA_FLAGS
BACKTRACE_FILE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
OTOOL64
OTOOL
LIPO
@@ -805,6 +807,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_largefile
enable_cet
enable_werror
@@ -1453,6 +1456,8 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-path install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--disable-largefile omit support for large files
--enable-cet enable Intel CET in target libraries [default=auto]
--disable-werror disable building with -Werror
@@ -8048,7 +8053,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9754,6 +9759,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9771,9 +9819,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11579,7 +11631,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11582 "configure"
+#line 11634 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11685,7 +11737,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11688 "configure"
+#line 11740 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11924,6 +11976,15 @@ CC="$lt_save_CC"
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# Check whether --enable-largefile was given.
if test "${enable_largefile+set}" = set; then :
enableval=$enable_largefile;
@@ -14486,6 +14547,10 @@ if test -z "${HAVE_DWZ_TRUE}" && test -z "${HAVE_DWZ_FALSE}"; then
as_fn_error $? "conditional \"HAVE_DWZ\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${HAVE_ELF_TRUE}" && test -z "${HAVE_ELF_FALSE}"; then
as_fn_error $? "conditional \"HAVE_ELF\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac
index 72ff2b30053..71cd50f8cdf 100644
--- a/libbacktrace/configure.ac
+++ b/libbacktrace/configure.ac
@@ -84,6 +84,8 @@ AM_CONDITIONAL(HAVE_DWZ, test "$DWZ" != "")
LT_INIT
AM_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
AC_SYS_LARGEFILE
backtrace_supported=yes
diff --git a/libcc1/configure b/libcc1/configure
index 2a914a0bfc8..a12ffa4af27 100755
--- a/libcc1/configure
+++ b/libcc1/configure
@@ -787,6 +787,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_cet
with_gcc_major_version_only
enable_werror_always
@@ -1439,6 +1440,8 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-path install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-cet enable Intel CET in host libraries [default=auto]
--enable-werror-always enable -Werror despite compiler version
--enable-plugin enable plugin support
@@ -7309,7 +7312,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9014,6 +9017,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9031,9 +9077,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -10839,7 +10889,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10842 "configure"
+#line 10892 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10945,7 +10995,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10948 "configure"
+#line 10998 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12227,6 +12277,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -12244,12 +12337,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
diff --git a/libffi/Makefile.am b/libffi/Makefile.am
index c6d6f849c53..d2ae0c04c7b 100644
--- a/libffi/Makefile.am
+++ b/libffi/Makefile.am
@@ -214,7 +214,12 @@ libffi.map: $(top_srcdir)/libffi.map.in
$(COMPILE) -D$(TARGET) -DGENERATE_LIBFFI_MAP \
-E -x assembler-with-cpp -o $@ $(top_srcdir)/libffi.map.in
-libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS)
+if ENABLE_DARWIN_AT_RPATH
+libffi_darwin_rpath = -Wl,-rpath,@loader_path
+endif
+libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) \
+ $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS) \
+ $(libffi_darwin_rpath)
libffi_la_DEPENDENCIES = $(libffi_la_LIBADD) $(libffi_version_dep)
AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
diff --git a/libffi/Makefile.in b/libffi/Makefile.in
index 5524a6a571e..34e77a45d1a 100644
--- a/libffi/Makefile.in
+++ b/libffi/Makefile.in
@@ -597,7 +597,11 @@ AM_CFLAGS = -Wall -g -fexceptions $(CET_FLAGS) $(am__append_2)
@LIBFFI_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBFFI_BUILD_VERSIONED_SHLIB_TRUE@libffi_version_dep = libffi.map
@LIBFFI_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBFFI_BUILD_VERSIONED_SHLIB_TRUE@libffi_version_dep = libffi.map-sun
libffi_version_info = -version-info `grep -v '^\#' $(srcdir)/libtool-version`
-libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libffi_darwin_rpath = -Wl,-rpath,@loader_path
+libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) \
+ $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS) \
+ $(libffi_darwin_rpath)
+
libffi_la_DEPENDENCIES = $(libffi_la_LIBADD) $(libffi_version_dep)
AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
AM_CCASFLAGS = $(AM_CPPFLAGS) $(CET_FLAGS)
diff --git a/libffi/configure b/libffi/configure
index 9eac9c907bf..74f6777652e 100755
--- a/libffi/configure
+++ b/libffi/configure
@@ -667,6 +667,8 @@ MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
READELF
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
CXXCPP
CPP
OTOOL64
@@ -810,6 +812,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
enable_pax_emutramp
enable_debug
@@ -1465,6 +1468,8 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-path install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -7835,7 +7840,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9809,6 +9814,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9826,9 +9874,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11634,7 +11686,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11637 "configure"
+#line 11689 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11740,7 +11792,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11743 "configure"
+#line 11795 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12616,6 +12668,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -12633,12 +12728,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15008,6 +15111,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# Only expand once:
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}readelf", so it can be a program name with args.
@@ -17153,6 +17264,10 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libffi/configure.ac b/libffi/configure.ac
index 014d89d0423..716f20ae313 100644
--- a/libffi/configure.ac
+++ b/libffi/configure.ac
@@ -55,6 +55,7 @@ AC_SUBST(CET_FLAGS)
AM_PROG_AS
AM_PROG_CC_C_O
AC_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
AC_CHECK_TOOL(READELF, readelf)
diff --git a/libgcc/config.host b/libgcc/config.host
index c94d69d84b7..d40cf55acb6 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -233,7 +233,6 @@ case ${host} in
;;
esac
tmake_file="$tmake_file t-slibgcc-darwin"
- # newer toolsets produce warnings when building for unsupported versions.
case ${host} in
*-*-darwin1[89]* | *-*-darwin2* )
tmake_file="t-darwin-min-8 $tmake_file"
@@ -251,6 +250,28 @@ case ${host} in
echo "Warning: libgcc configured to support macOS 10.5" 1>&2
;;
esac
+ # We are not using libtool to build the libs here, so we need to replicate
+ # a little of the logic around setting Darwin rpaths. Setting an explicit
+ # yes or no is honoured, otherwise we choose a suitable default.
+ # Sadly, this has to be kept in line with the rules in libtool.m4.
+ # This make fragment will override the setting in t-slibgcc-darwin so it
+ # must appear after it.
+ if test "x$enable_darwin_at_rpath" = "x"; then
+ echo "enable_darwin_at_rpath is unset" 1>&2
+ case ${host} in
+ *-darwin[45678]*) ;;
+ *-darwin9* | *-darwin1[01234]*) ;; # We might default these on later.
+ *-darwin*)
+ echo "but is needed after macOS 10.11 (setting it on)" 1>&2
+ enable_darwin_at_rpath=yes
+ ;;
+ esac
+ else
+ echo "enable_darwin_at_rpath is '$enable_darwin_at_rpath'" 1>&2
+ fi
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ tmake_file="$tmake_file t-darwin-rpath "
+ fi
extra_parts="crt3.o libd10-uwfef.a crttms.o crttme.o libemutls_w.a"
;;
*-*-dragonfly*)
diff --git a/libgcc/config/t-darwin-rpath b/libgcc/config/t-darwin-rpath
new file mode 100644
index 00000000000..e73d7f378b0
--- /dev/null
+++ b/libgcc/config/t-darwin-rpath
@@ -0,0 +1,2 @@
+# Use @rpath and add a search path to exes and dylibs that depend on this.
+SHLIB_RPATH = @rpath
diff --git a/libgcc/config/t-slibgcc-darwin b/libgcc/config/t-slibgcc-darwin
index cb0cbbdb1c5..da4886848e8 100644
--- a/libgcc/config/t-slibgcc-darwin
+++ b/libgcc/config/t-slibgcc-darwin
@@ -1,4 +1,4 @@
-# Build a shared libgcc library with the darwin linker.
+# Build a shared libgcc library able to use embedded runpaths.
SHLIB_SOVERSION = 1.1
SHLIB_SO_MINVERSION = 1
@@ -6,7 +6,6 @@ SHLIB_VERSTRING = -compatibility_version $(SHLIB_SO_MINVERSION) \
-current_version $(SHLIB_SOVERSION)
SHLIB_EXT = .dylib
SHLIB_LC = -lSystem
-SHLIB_INSTALL_DIR = $(slibdir)
SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
SHLIB_MKMAP_OPTS = -v leading_underscore=1
@@ -23,11 +22,16 @@ SHLIB_SONAME = @shlib_base_name@$(SHLIB_EXT)
# subdir. The code under MULTIBUILDTOP combines these into a single FAT
# library, that is what we eventually install.
+# When enable_darwin_at_rpath is true, use @rpath instead of $(slibdir) for
+# this and dylibs that depend on this. So this def must come first and be
+# overridden in a make fragment that depends on the rpath setting.
+SHLIB_RPATH = $(slibdir)
+
SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) $(LDFLAGS) -dynamiclib -nodefaultlibs \
- -install_name $(SHLIB_INSTALL_DIR)/$(SHLIB_INSTALL_NAME) \
+ -install_name $(SHLIB_RPATH)/$(SHLIB_INSTALL_NAME) \
-single_module -o $(SHLIB_DIR)/$(SHLIB_SONAME) \
-Wl,-exported_symbols_list,$(SHLIB_MAP) \
- $(SHLIB_VERSTRING) \
+ $(SHLIB_VERSTRING) -nodefaultrpaths \
@multilib_flags@ @shlib_objs@ $(SHLIB_LC)
# we do our own thing
@@ -63,9 +67,9 @@ EHS_INSTNAME = libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT)
libgcc_ehs$(SHLIB_EXT): $(LIBEHSOBJS) $(extra-parts)
mkdir -p $(MULTIDIR)
$(CC) $(LIBGCC2_CFLAGS) $(LDFLAGS) -dynamiclib -nodefaultlibs \
- -install_name $(SHLIB_INSTALL_DIR)/$(EHS_INSTNAME) \
+ -install_name $(SHLIB_RPATH)/$(EHS_INSTNAME) \
-o $(MULTIDIR)/libgcc_ehs$(SHLIB_EXT) $(SHLIB_VERSTRING) \
- $(LIBEHSOBJS) $(SHLIB_LC)
+ -nodefaultrpaths $(LIBEHSOBJS) $(SHLIB_LC)
all: libgcc_ehs$(SHLIB_EXT)
@@ -122,12 +126,12 @@ libgcc_s.1.dylib: all-multi libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT) \
cp ../$${mlib}/libgcc/$${mlib}/libgcc_ehs$(SHLIB_EXT) \
./libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} || exit 1 ; \
arch=`$(LIPO) -info libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} | sed -e 's/.*:\ //'` ; \
- $(CC) -arch $${arch} -nodefaultlibs -dynamiclib \
+ $(CC) -arch $${arch} -nodefaultlibs -dynamiclib -nodefaultrpaths \
-o libgcc_s.1$(SHLIB_EXT)_T_$${mlib} \
-Wl,-reexport_library,libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} \
-Wl,-reexport_library,libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} \
- -install_name $(SHLIB_INSTALL_DIR)/libgcc_s.1.dylib \
- -compatibility_version 1 -current_version 1 ; \
+ -install_name $(SHLIB_RPATH)/libgcc_s.1.dylib \
+ -compatibility_version 1 -current_version 1.1 ; \
done
$(LIPO) -output libgcc_s.1$(SHLIB_EXT) -create libgcc_s.1$(SHLIB_EXT)_T*
rm libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T*
@@ -141,13 +145,13 @@ libgcc_s.1.dylib: all-multi libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)
cp ../$${mlib}/libgcc/$${mlib}/libgcc_s$(SHLIB_EXT) \
./libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} || exit 1 ; \
arch=`$(LIPO) -info libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} | sed -e 's/.*:\ //'` ; \
- $(CC) -arch $${arch} -nodefaultlibs -dynamiclib \
+ $(CC) -arch $${arch} -nodefaultlibs -dynamiclib -nodefaultrpaths \
-o libgcc_s.1$(SHLIB_EXT)_T_$${mlib} \
-Wl,-reexport_library,libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} \
-lSystem \
-Wl,-reexported_symbols_list,$(srcdir)/config/darwin-unwind.ver \
- -install_name $(SHLIB_INSTALL_DIR)/libgcc_s.1.dylib \
- -compatibility_version 1 -current_version 1 ; \
+ -install_name $(SHLIB_RPATH)/libgcc_s.1.dylib \
+ -compatibility_version 1 -current_version 1.1 ; \
done
$(LIPO) -output libgcc_s.1$(SHLIB_EXT) -create libgcc_s.1$(SHLIB_EXT)_T*
rm libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T*
diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am
index 9fab07c9a50..0a4ae4fca4f 100644
--- a/libgfortran/Makefile.am
+++ b/libgfortran/Makefile.am
@@ -37,6 +37,11 @@ else
version_arg =
version_dep =
endif
+extra_darwin_ldflags_libgfortran = @extra_ldflags_libgfortran@
+if ENABLE_DARWIN_AT_RPATH
+extra_darwin_ldflags_libgfortran += -Wc,-nodefaultrpaths
+extra_darwin_ldflags_libgfortran += -Wl,-rpath,@loader_path
+endif
gfor_c_HEADERS = ISO_Fortran_binding.h
gfor_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
@@ -50,7 +55,7 @@ libgfortran_la_LINK = $(LINK) $(libgfortran_la_LDFLAGS)
libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
$(LTLDFLAGS) $(LIBQUADLIB) ../libbacktrace/libbacktrace.la \
$(HWCAP_LDFLAGS) \
- $(LIBM) $(extra_ldflags_libgfortran) \
+ $(LIBM) $(extra_darwin_ldflags_libgfortran) \
$(version_arg) -Wc,-shared-libgcc
libgfortran_la_DEPENDENCIES = $(version_dep) libgfortran.spec $(LIBQUADLIB_DEP)
diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in
index e8627f9a4bc..30d1dc56da7 100644
--- a/libgfortran/Makefile.in
+++ b/libgfortran/Makefile.in
@@ -91,8 +91,10 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-@LIBGFOR_MINIMAL_TRUE@am__append_1 = -DLIBGFOR_MINIMAL
-@LIBGFOR_MINIMAL_FALSE@am__append_2 = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+@LIBGFOR_MINIMAL_TRUE@am__append_2 = -DLIBGFOR_MINIMAL
+@LIBGFOR_MINIMAL_FALSE@am__append_3 = \
@LIBGFOR_MINIMAL_FALSE@io/close.c \
@LIBGFOR_MINIMAL_FALSE@io/file_pos.c \
@LIBGFOR_MINIMAL_FALSE@io/format.c \
@@ -110,7 +112,7 @@ target_triplet = @target@
@LIBGFOR_MINIMAL_FALSE@io/fbuf.c \
@LIBGFOR_MINIMAL_FALSE@io/async.c
-@LIBGFOR_MINIMAL_FALSE@am__append_3 = \
+@LIBGFOR_MINIMAL_FALSE@am__append_4 = \
@LIBGFOR_MINIMAL_FALSE@intrinsics/access.c \
@LIBGFOR_MINIMAL_FALSE@intrinsics/c99_functions.c \
@LIBGFOR_MINIMAL_FALSE@intrinsics/chdir.c \
@@ -143,9 +145,9 @@ target_triplet = @target@
@LIBGFOR_MINIMAL_FALSE@intrinsics/umask.c \
@LIBGFOR_MINIMAL_FALSE@intrinsics/unlink.c
-@IEEE_SUPPORT_TRUE@am__append_4 = ieee/ieee_helper.c
-@LIBGFOR_MINIMAL_TRUE@am__append_5 = runtime/minimal.c
-@LIBGFOR_MINIMAL_FALSE@am__append_6 = \
+@IEEE_SUPPORT_TRUE@am__append_5 = ieee/ieee_helper.c
+@LIBGFOR_MINIMAL_TRUE@am__append_6 = runtime/minimal.c
+@LIBGFOR_MINIMAL_FALSE@am__append_7 = \
@LIBGFOR_MINIMAL_FALSE@runtime/backtrace.c \
@LIBGFOR_MINIMAL_FALSE@runtime/convert_char.c \
@LIBGFOR_MINIMAL_FALSE@runtime/environ.c \
@@ -584,7 +586,7 @@ AMTAR = @AMTAR@
# Some targets require additional compiler options for IEEE compatibility.
AM_CFLAGS = @AM_CFLAGS@ -fcx-fortran-rules $(SECTION_FLAGS) \
- $(IEEE_FLAGS) $(am__append_1)
+ $(IEEE_FLAGS) $(am__append_2)
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ $(IEEE_FLAGS)
AR = @AR@
@@ -743,6 +745,8 @@ gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
@LIBGFOR_USE_SYMVER_FALSE@version_dep =
@LIBGFOR_USE_SYMVER_GNU_TRUE@@LIBGFOR_USE_SYMVER_TRUE@version_dep = gfortran.ver
@LIBGFOR_USE_SYMVER_SUN_TRUE@@LIBGFOR_USE_SYMVER_TRUE@version_dep = gfortran.ver-sun gfortran.ver
+extra_darwin_ldflags_libgfortran = @extra_ldflags_libgfortran@ \
+ $(am__append_1)
gfor_c_HEADERS = ISO_Fortran_binding.h
gfor_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) \
@@ -754,7 +758,7 @@ libgfortran_la_LINK = $(LINK) $(libgfortran_la_LDFLAGS)
libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
$(LTLDFLAGS) $(LIBQUADLIB) ../libbacktrace/libbacktrace.la \
$(HWCAP_LDFLAGS) \
- $(LIBM) $(extra_ldflags_libgfortran) \
+ $(LIBM) $(extra_darwin_ldflags_libgfortran) \
$(version_arg) -Wc,-shared-libgcc
libgfortran_la_DEPENDENCIES = $(version_dep) libgfortran.spec $(LIBQUADLIB_DEP)
@@ -775,7 +779,7 @@ AM_CPPFLAGS = -iquote$(srcdir)/io -I$(srcdir)/$(MULTISRCTOP)../gcc \
-I$(MULTIBUILDTOP)../libbacktrace \
-I../libbacktrace
-gfor_io_src = io/size_from_kind.c $(am__append_2)
+gfor_io_src = io/size_from_kind.c $(am__append_3)
gfor_io_headers = \
io/io.h \
io/fbuf.h \
@@ -797,7 +801,7 @@ gfor_helper_src = intrinsics/associated.c intrinsics/abort.c \
intrinsics/selected_int_kind.f90 \
intrinsics/selected_real_kind.f90 intrinsics/trigd.c \
intrinsics/unpack_generic.c runtime/in_pack_generic.c \
- runtime/in_unpack_generic.c $(am__append_3) $(am__append_4)
+ runtime/in_unpack_generic.c $(am__append_4) $(am__append_5)
@IEEE_SUPPORT_TRUE@gfor_ieee_helper_src = ieee/ieee_helper.c
@IEEE_SUPPORT_FALSE@gfor_ieee_src =
@IEEE_SUPPORT_TRUE@gfor_ieee_src = \
@@ -806,8 +810,8 @@ gfor_helper_src = intrinsics/associated.c intrinsics/abort.c \
@IEEE_SUPPORT_TRUE@ieee/ieee_features.F90
gfor_src = runtime/bounds.c runtime/compile_options.c runtime/memory.c \
- runtime/string.c runtime/select.c $(am__append_5) \
- $(am__append_6)
+ runtime/string.c runtime/select.c $(am__append_6) \
+ $(am__append_7)
i_all_c = \
$(srcdir)/generated/all_l1.c \
$(srcdir)/generated/all_l2.c \
diff --git a/libgfortran/configure b/libgfortran/configure
index cd176b04a14..3d4c690a6e5 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -654,6 +654,8 @@ extra_ldflags_libgfortran
ac_ct_FC
FCFLAGS
FC
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -819,6 +821,7 @@ enable_static
with_pic
enable_fast_install
enable_libtool_lock
+enable_darwin_at_rpath
enable_largefile
enable_libquadmath_support
with_gcc_major_version_only
@@ -1473,6 +1476,8 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-path install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--disable-largefile omit support for large files
--disable-libquadmath-support
disable libquadmath support for Fortran
@@ -9243,7 +9248,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10953,6 +10958,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10970,9 +11018,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12799,7 +12851,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12802 "configure"
+#line 12854 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12905,7 +12957,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12908 "configure"
+#line 12960 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13307,6 +13359,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
#AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10
# We need gfortran to compile parts of the library
@@ -14950,6 +15010,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_FC=no
hardcode_direct_FC=no
hardcode_automatic_FC=yes
@@ -14967,9 +15070,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_FC="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_FC="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -16242,9 +16349,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# extra LD Flags which are required for targets
+extra_ldflags_libgfortran=
case "${host}" in
- *-darwin*)
- # Darwin needs -single_module when linking libgfortran
+ *-*-darwin[4567]*)
+ # Earlier Darwin needs -single_module when linking libgfortran
extra_ldflags_libgfortran=-Wl,-single_module
;;
esac
@@ -31601,6 +31709,10 @@ if test -z "${HAVE_HWCAP_TRUE}" && test -z "${HAVE_HWCAP_FALSE}"; then
as_fn_error $? "conditional \"HAVE_HWCAP\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${IEEE_SUPPORT_TRUE}" && test -z "${IEEE_SUPPORT_FALSE}"; then
as_fn_error $? "conditional \"IEEE_SUPPORT\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index 8bd2af966c8..46585a3ee14 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -269,6 +269,7 @@ LT_LIB_M
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
#AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10
# We need gfortran to compile parts of the library
@@ -277,9 +278,10 @@ FC="$GFORTRAN"
AC_PROG_FC(gfortran)
# extra LD Flags which are required for targets
+extra_ldflags_libgfortran=
case "${host}" in
- *-darwin*)
- # Darwin needs -single_module when linking libgfortran
+ *-*-darwin[[4567]]*)
+ # Earlier Darwin needs -single_module when linking libgfortran
extra_ldflags_libgfortran=-Wl,-single_module
;;
esac
diff --git a/libgm2/Makefile.am b/libgm2/Makefile.am
index 95df3ed7a30..aa35e747c9a 100644
--- a/libgm2/Makefile.am
+++ b/libgm2/Makefile.am
@@ -46,6 +46,12 @@ SUBDIRS = libm2min libm2log libm2cor libm2iso libm2pim
GM2_BUILDDIR := $(shell pwd)
gm2_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
+if ENABLE_DARWIN_AT_RPATH
+DARWIN_AT_RPATH=yes
+else
+DARWIN_AT_RPATH=yes
+endif
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
# friends when we are called from the top level Makefile.
@@ -91,7 +97,8 @@ AM_MAKEFLAGS = \
"WERROR=$(WERROR)" \
"TARGET_LIB_PATH=$(TARGET_LIB_PATH)" \
"TARGET_LIB_PATH_libgm2=$(TARGET_LIB_PATH_libgm2)" \
- "LIBTOOL=$(GM2_BUILDDIR)/libtool"
+ "LIBTOOL=$(GM2_BUILDDIR)/libtool" \
+ "DARWIN_AT_RPATH=$(DARWIN_AT_RPATH)"
# Subdir rules rely on $(FLAGS_TO_PASS)
FLAGS_TO_PASS = $(AM_MAKEFLAGS)
diff --git a/libgm2/Makefile.in b/libgm2/Makefile.in
index c0396791f48..e8fa4aa52dc 100644
--- a/libgm2/Makefile.in
+++ b/libgm2/Makefile.in
@@ -90,15 +90,15 @@ host_triplet = @host@
target_triplet = @target@
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
@@ -343,6 +343,8 @@ GM2_SRC = $(GCC_DIR)/m2
SUBDIRS = libm2min libm2log libm2cor libm2iso libm2pim
GM2_BUILDDIR := $(shell pwd)
gm2_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
+@ENABLE_DARWIN_AT_RPATH_FALSE@DARWIN_AT_RPATH = yes
+@ENABLE_DARWIN_AT_RPATH_TRUE@DARWIN_AT_RPATH = yes
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
@@ -389,7 +391,8 @@ AM_MAKEFLAGS = \
"WERROR=$(WERROR)" \
"TARGET_LIB_PATH=$(TARGET_LIB_PATH)" \
"TARGET_LIB_PATH_libgm2=$(TARGET_LIB_PATH_libgm2)" \
- "LIBTOOL=$(GM2_BUILDDIR)/libtool"
+ "LIBTOOL=$(GM2_BUILDDIR)/libtool" \
+ "DARWIN_AT_RPATH=$(DARWIN_AT_RPATH)"
# Subdir rules rely on $(FLAGS_TO_PASS)
diff --git a/libgm2/aclocal.m4 b/libgm2/aclocal.m4
index c352303012d..832065fbb9b 100644
--- a/libgm2/aclocal.m4
+++ b/libgm2/aclocal.m4
@@ -1187,14 +1187,14 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
-m4_include([../libtool.m4])
-m4_include([../ltoptions.m4])
-m4_include([../ltsugar.m4])
-m4_include([../ltversion.m4])
-m4_include([../lt~obsolete.m4])
m4_include([../config/acx.m4])
m4_include([../config/depstand.m4])
m4_include([../config/lead-dot.m4])
m4_include([../config/multi.m4])
m4_include([../config/no-executables.m4])
m4_include([../config/override.m4])
+m4_include([../libtool.m4])
+m4_include([../ltoptions.m4])
+m4_include([../ltsugar.m4])
+m4_include([../ltversion.m4])
+m4_include([../lt~obsolete.m4])
diff --git a/libgm2/configure b/libgm2/configure
index 072d584544e..3d9fa2a3615 100755
--- a/libgm2/configure
+++ b/libgm2/configure
@@ -649,6 +649,8 @@ GM2_FOR_TARGET
CC_FOR_BUILD
enable_static
enable_shared
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
CXXCPP
OTOOL64
OTOOL
@@ -805,6 +807,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
with_gcc_major_version_only
'
ac_precious_vars='build_alias
@@ -1455,6 +1458,8 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-path install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -6569,10 +6574,6 @@ fi
-enable_dlopen=yes
-
-
-
case `pwd` in
*\ * | *\ *)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
@@ -9181,7 +9182,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9229,6 +9230,8 @@ done
+ enable_dlopen=no
+
enable_win32_dll=no
@@ -10892,6 +10895,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10909,9 +10955,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12738,7 +12788,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12741 "configure"
+#line 12791 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12844,7 +12894,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12847 "configure"
+#line 12897 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13726,6 +13776,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13743,12 +13836,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -16122,6 +16223,21 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+enable_dlopen=yes
+
+
+
+
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
+
if test "${multilib}" = "yes"; then
@@ -20310,6 +20426,10 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${BUILD_PIMLIB_TRUE}" && test -z "${BUILD_PIMLIB_FALSE}"; then
as_fn_error $? "conditional \"BUILD_PIMLIB\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgm2/configure.ac b/libgm2/configure.ac
index 92e76c9346c..5701b95878b 100644
--- a/libgm2/configure.ac
+++ b/libgm2/configure.ac
@@ -212,8 +212,12 @@ AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
AC_PROG_MAKE_SET
AC_PROG_INSTALL
-AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
+LT_INIT
+AC_LIBTOOL_DLOPEN
+
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
diff --git a/libgm2/libm2cor/Makefile.am b/libgm2/libm2cor/Makefile.am
index 48de40c22dd..e50c7a2ef55 100644
--- a/libgm2/libm2cor/Makefile.am
+++ b/libgm2/libm2cor/Makefile.am
@@ -123,6 +123,10 @@ libm2cor_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2cor_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2cor_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
+
libm2cor_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2cor_la_link_flags)
BUILT_SOURCES = SYSTEM.def
CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2cor/Makefile.in b/libgm2/libm2cor/Makefile.in
index 3b0b40fea60..cc8a3fa73ed 100644
--- a/libgm2/libm2cor/Makefile.in
+++ b/libgm2/libm2cor/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@BUILD_CORLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2cor
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -468,8 +469,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_CORLIB_TRUE@ -fm2-pathname=m2iso -I$(GM2_SRC)/gm2-libs-iso \
@BUILD_CORLIB_TRUE@ -fm2-g -g -Wreturn-type -fcase -fm2-prefix=m2cor
-@BUILD_CORLIB_TRUE@@TARGET_DARWIN_FALSE@libm2cor_la_link_flags =
-@BUILD_CORLIB_TRUE@@TARGET_DARWIN_TRUE@libm2cor_la_link_flags = -Wl,-undefined,dynamic_lookup
+@BUILD_CORLIB_TRUE@@TARGET_DARWIN_FALSE@libm2cor_la_link_flags = \
+@BUILD_CORLIB_TRUE@@TARGET_DARWIN_FALSE@ $(am__append_1)
+@BUILD_CORLIB_TRUE@@TARGET_DARWIN_TRUE@libm2cor_la_link_flags = -Wl,-undefined,dynamic_lookup \
+@BUILD_CORLIB_TRUE@@TARGET_DARWIN_TRUE@ $(am__append_1)
@BUILD_CORLIB_TRUE@libm2cor_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2cor_la_link_flags)
@BUILD_CORLIB_TRUE@BUILT_SOURCES = SYSTEM.def
@BUILD_CORLIB_TRUE@CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2iso/Makefile.am b/libgm2/libm2iso/Makefile.am
index 1386f156cab..4d8e897266f 100644
--- a/libgm2/libm2iso/Makefile.am
+++ b/libgm2/libm2iso/Makefile.am
@@ -197,6 +197,10 @@ libm2iso_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2iso_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2iso_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
+
libm2iso_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2iso_la_link_flags)
CLEANFILES = SYSTEM.def
BUILT_SOURCES = SYSTEM.def
diff --git a/libgm2/libm2iso/Makefile.in b/libgm2/libm2iso/Makefile.in
index b939581b7c1..08563adfe78 100644
--- a/libgm2/libm2iso/Makefile.in
+++ b/libgm2/libm2iso/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@BUILD_ISOLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2iso
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -569,8 +570,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_ISOLIB_TRUE@ -fm2-pathname=m2pim -I$(GM2_SRC)/gm2-libs \
@BUILD_ISOLIB_TRUE@ -fiso -fextended-opaque -fm2-g -g -Wreturn-type -fcase -fm2-prefix=m2iso
-@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_FALSE@libm2iso_la_link_flags =
-@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_TRUE@libm2iso_la_link_flags = -Wl,-undefined,dynamic_lookup
+@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_FALSE@libm2iso_la_link_flags = \
+@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_FALSE@ $(am__append_1)
+@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_TRUE@libm2iso_la_link_flags = -Wl,-undefined,dynamic_lookup \
+@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_TRUE@ $(am__append_1)
@BUILD_ISOLIB_TRUE@libm2iso_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2iso_la_link_flags)
@BUILD_ISOLIB_TRUE@CLEANFILES = SYSTEM.def
@BUILD_ISOLIB_TRUE@BUILT_SOURCES = SYSTEM.def
diff --git a/libgm2/libm2log/Makefile.am b/libgm2/libm2log/Makefile.am
index a15747fd245..3b7609ee5c1 100644
--- a/libgm2/libm2log/Makefile.am
+++ b/libgm2/libm2log/Makefile.am
@@ -142,6 +142,9 @@ libm2log_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2log_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2log_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
libm2log_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2log_la_link_flags)
BUILT_SOURCES = ../libm2pim/SYSTEM.def
diff --git a/libgm2/libm2log/Makefile.in b/libgm2/libm2log/Makefile.in
index ba34a6b445a..fa12a386c55 100644
--- a/libgm2/libm2log/Makefile.in
+++ b/libgm2/libm2log/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@BUILD_LOGLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2log
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -477,8 +478,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_LOGLIB_TRUE@ -fm2-pathname=m2iso -I$(GM2_SRC)/gm2-libs-iso \
@BUILD_LOGLIB_TRUE@ -Wreturn-type -fcase -fm2-prefix=m2log
-@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_FALSE@libm2log_la_link_flags =
-@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_TRUE@libm2log_la_link_flags = -Wl,-undefined,dynamic_lookup
+@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_FALSE@libm2log_la_link_flags = \
+@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_FALSE@ $(am__append_1)
+@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_TRUE@libm2log_la_link_flags = -Wl,-undefined,dynamic_lookup \
+@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_TRUE@ $(am__append_1)
@BUILD_LOGLIB_TRUE@libm2log_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2log_la_link_flags)
@BUILD_LOGLIB_TRUE@BUILT_SOURCES = ../libm2pim/SYSTEM.def
@BUILD_LOGLIB_TRUE@M2LIBDIR = /m2/m2log/
diff --git a/libgm2/libm2min/Makefile.am b/libgm2/libm2min/Makefile.am
index 1ff160028f6..21411769505 100644
--- a/libgm2/libm2min/Makefile.am
+++ b/libgm2/libm2min/Makefile.am
@@ -113,6 +113,9 @@ libm2min_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2min_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2min_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
libm2min_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2min_la_link_flags)
BUILT_SOURCES = SYSTEM.def
CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2min/Makefile.in b/libgm2/libm2min/Makefile.in
index 9ead8397fd0..73af6568b88 100644
--- a/libgm2/libm2min/Makefile.in
+++ b/libgm2/libm2min/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2min
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -441,8 +442,10 @@ libm2min_la_M2FLAGS = \
-fm2-pathname=m2pim -I$(GM2_SRC)/gm2-libs -fno-exceptions \
-fno-m2-plugin -fno-scaffold-dynamic -fno-scaffold-main -fm2-prefix=m2min
-@TARGET_DARWIN_FALSE@libm2min_la_link_flags =
-@TARGET_DARWIN_TRUE@libm2min_la_link_flags = -Wl,-undefined,dynamic_lookup
+@TARGET_DARWIN_FALSE@libm2min_la_link_flags = $(am__append_1)
+@TARGET_DARWIN_TRUE@libm2min_la_link_flags = \
+@TARGET_DARWIN_TRUE@ -Wl,-undefined,dynamic_lookup \
+@TARGET_DARWIN_TRUE@ $(am__append_1)
libm2min_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2min_la_link_flags)
BUILT_SOURCES = SYSTEM.def
CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2pim/Makefile.am b/libgm2/libm2pim/Makefile.am
index ebfeba1ac1d..e777a60c077 100644
--- a/libgm2/libm2pim/Makefile.am
+++ b/libgm2/libm2pim/Makefile.am
@@ -175,6 +175,9 @@ libm2pim_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2pim_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2pim_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
libm2pim_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2pim_la_link_flags)
BUILT_SOURCES = SYSTEM.def
CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2pim/Makefile.in b/libgm2/libm2pim/Makefile.in
index 660488f9692..54414058bc5 100644
--- a/libgm2/libm2pim/Makefile.in
+++ b/libgm2/libm2pim/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@BUILD_PIMLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2pim
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -538,8 +539,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_PIMLIB_TRUE@ -fm2-pathname=m2iso -I$(GM2_SRC)/gm2-libs-iso \
@BUILD_PIMLIB_TRUE@ -fm2-g -g -Wreturn-type -fcase -fm2-prefix=m2pim
-@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_FALSE@libm2pim_la_link_flags =
-@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_TRUE@libm2pim_la_link_flags = -Wl,-undefined,dynamic_lookup
+@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_FALSE@libm2pim_la_link_flags = \
+@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_FALSE@ $(am__append_1)
+@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_TRUE@libm2pim_la_link_flags = -Wl,-undefined,dynamic_lookup \
+@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_TRUE@ $(am__append_1)
@BUILD_PIMLIB_TRUE@libm2pim_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2pim_la_link_flags)
@BUILD_PIMLIB_TRUE@BUILT_SOURCES = SYSTEM.def
@BUILD_PIMLIB_TRUE@CLEANFILES = SYSTEM.def
diff --git a/libgo/configure b/libgo/configure
index a607dbff68e..72d46c3eec3 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -708,6 +708,8 @@ glibgo_toolexecdir
WERROR
WARN_FLAGS
CC_FOR_BUILD
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
CPP
@@ -11544,7 +11546,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11547 "configure"
+#line 11549 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11650,7 +11652,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11653 "configure"
+#line 11655 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13779,6 +13781,14 @@ CC="$lt_save_CC"
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
CC_FOR_BUILD=${CC_FOR_BUILD:-gcc}
@@ -16386,6 +16396,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${USE_LIBFFI_TRUE}" && test -z "${USE_LIBFFI_FALSE}"; then
as_fn_error $? "conditional \"USE_LIBFFI\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgo/configure.ac b/libgo/configure.ac
index a59aa091d1d..6f1ac32660b 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -53,6 +53,7 @@ AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
CC_FOR_BUILD=${CC_FOR_BUILD:-gcc}
AC_SUBST(CC_FOR_BUILD)
diff --git a/libgomp/Makefile.am b/libgomp/Makefile.am
index 428f7a9dab5..ceb8c910abd 100644
--- a/libgomp/Makefile.am
+++ b/libgomp/Makefile.am
@@ -53,9 +53,14 @@ else
libgomp_version_script =
libgomp_version_dep =
endif
+
libgomp_version_info = -version-info $(libtool_VERSION)
+if ENABLE_DARWIN_AT_RPATH
+libgomp_darwin_rpath = -Wc,-nodefaultrpaths
+libgomp_darwin_rpath += -Wl,-rpath,@loader_path
+endif
libgomp_la_LDFLAGS = $(libgomp_version_info) $(libgomp_version_script) \
- $(lt_host_flags)
+ $(lt_host_flags) $(libgomp_darwin_rpath)
libgomp_la_LIBADD =
libgomp_la_DEPENDENCIES = $(libgomp_version_dep)
libgomp_la_LINK = $(LINK) $(libgomp_la_LDFLAGS)
diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
index 3ef05e6a3cb..2467250215e 100644
--- a/libgomp/Makefile.in
+++ b/libgomp/Makefile.in
@@ -535,8 +535,11 @@ nodist_toolexeclib_HEADERS = libgomp.spec
@LIBGOMP_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgomp_version_dep = libgomp.ver
@LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgomp_version_dep = libgomp.ver-sun
libgomp_version_info = -version-info $(libtool_VERSION)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libgomp_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
libgomp_la_LDFLAGS = $(libgomp_version_info) $(libgomp_version_script) \
- $(lt_host_flags)
+ $(lt_host_flags) $(libgomp_darwin_rpath)
libgomp_la_LIBADD = $(DL_LIBS)
libgomp_la_DEPENDENCIES = $(libgomp_version_dep)
diff --git a/libgomp/configure b/libgomp/configure
index a12b30f1b0f..1bc1459380f 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -683,6 +683,8 @@ CXX
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -822,6 +824,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
enable_linux_futex
enable_tls
@@ -1477,6 +1480,8 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-path install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -7618,7 +7623,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9591,6 +9596,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9608,9 +9656,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11416,7 +11468,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11419 "configure"
+#line 11471 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11522,7 +11574,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11525 "configure"
+#line 11577 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11783,6 +11835,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
@@ -13469,6 +13529,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_FC=no
hardcode_direct_FC=no
hardcode_automatic_FC=yes
@@ -13486,9 +13589,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_FC="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_FC="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -17130,6 +17237,10 @@ if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then
as_fn_error $? "conditional \"BUILD_INFO\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index 1aad83a79da..8c941cddd2f 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -148,6 +148,7 @@ AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
AM_MAINTAINER_MODE
diff --git a/libitm/Makefile.am b/libitm/Makefile.am
index 3f31ad30556..a25317b07fe 100644
--- a/libitm/Makefile.am
+++ b/libitm/Makefile.am
@@ -54,7 +54,12 @@ libitm_version_info = -version-info $(libtool_VERSION)
# want or need libstdc++.
libitm_la_DEPENDENCIES = $(libitm_version_dep)
libitm_la_LINK = $(LINK) $(libitm_la_LDFLAGS)
-libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script)
+if ENABLE_DARWIN_AT_RPATH
+libitm_darwin_rpath = -Wc,-nodefaultrpaths
+libitm_darwin_rpath += -Wl,-rpath,@loader_path
+endif
+libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script) \
+ $(libitm_darwin_rpath)
libitm_la_SOURCES = \
aatree.cc alloc.cc alloc_c.cc alloc_cpp.cc barrier.cc beginend.cc \
diff --git a/libitm/Makefile.in b/libitm/Makefile.in
index 7c51fe02511..9f0691018a9 100644
--- a/libitm/Makefile.in
+++ b/libitm/Makefile.in
@@ -480,7 +480,12 @@ libitm_version_info = -version-info $(libtool_VERSION)
# want or need libstdc++.
libitm_la_DEPENDENCIES = $(libitm_version_dep)
libitm_la_LINK = $(LINK) $(libitm_la_LDFLAGS)
-libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libitm_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script) \
+ $(libitm_darwin_rpath)
+
libitm_la_SOURCES = aatree.cc alloc.cc alloc_c.cc alloc_cpp.cc \
barrier.cc beginend.cc clone.cc eh_cpp.cc local.cc query.cc \
retry.cc rwlock.cc useraction.cc util.cc sjlj.S tls.cc \
diff --git a/libitm/configure b/libitm/configure
index 02e8de7896b..0ccf10a1f5e 100755
--- a/libitm/configure
+++ b/libitm/configure
@@ -660,6 +660,8 @@ libtool_VERSION
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
CXXCPP
@@ -809,6 +811,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
enable_linux_futex
enable_tls
@@ -1461,6 +1464,8 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-path install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -8279,7 +8284,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10253,6 +10258,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10270,9 +10318,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12078,7 +12130,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12081 "configure"
+#line 12133 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12184,7 +12236,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12187 "configure"
+#line 12239 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13060,6 +13112,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13077,12 +13172,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15454,6 +15557,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
@@ -18212,6 +18323,10 @@ if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then
as_fn_error $? "conditional \"BUILD_INFO\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libitm/configure.ac b/libitm/configure.ac
index 892a24caa85..dded4d387be 100644
--- a/libitm/configure.ac
+++ b/libitm/configure.ac
@@ -156,6 +156,7 @@ AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes")
AM_PROG_LIBTOOL
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
AM_MAINTAINER_MODE
diff --git a/libobjc/configure b/libobjc/configure
index 752f6fdfebd..41e39cdd027 100755
--- a/libobjc/configure
+++ b/libobjc/configure
@@ -636,6 +636,9 @@ OBJC_BOEHM_GC_LIBS
OBJC_BOEHM_GC_INCLUDES
OBJC_BOEHM_GC
OBJC_GCFLAGS
+extra_ldflags_libobjc
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
SET_MAKE
CPP
OTOOL64
@@ -667,7 +670,6 @@ RANLIB
AR
AS
XCFLAGS
-extra_ldflags_libobjc
lt_host_flags
OBJEXT
EXEEXT
@@ -755,6 +757,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_tls
enable_objc_gc
with_target_bdw_gc
@@ -1392,6 +1395,8 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-path install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-tls Use thread-local storage [default=yes]
--enable-objc-gc enable use of Boehm's garbage collector with the GNU
Objective-C runtime
@@ -3431,17 +3436,6 @@ esac
-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
-
# Add CET specific flags if CET is enabled
@@ -7011,7 +7005,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -8988,6 +8982,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9005,9 +9042,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -10834,7 +10875,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10837 "configure"
+#line 10878 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10940,7 +10981,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10943 "configure"
+#line 10984 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11212,6 +11253,38 @@ $as_echo "no" >&6; }
fi
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
+# 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
+
+
# -------
# Headers
# -------
@@ -11953,6 +12026,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/libobjc/configure.ac b/libobjc/configure.ac
index 9bd7d59d597..cb21ebbfcc7 100644
--- a/libobjc/configure.ac
+++ b/libobjc/configure.ac
@@ -148,17 +148,6 @@ m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
# 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)
@@ -183,6 +172,31 @@ AM_PROG_CC_C_O
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
# -------
diff --git a/libphobos/configure b/libphobos/configure
index b7276d95010..997986424da 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -707,6 +707,8 @@ get_gcc_base_ver
phobos_compiler_shared_flag
phobos_compiler_pic_flag
phobos_lt_pic_flag
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
OTOOL64
@@ -838,6 +840,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
with_gcc_major_version_only
enable_werror
with_libatomic
@@ -1490,6 +1493,8 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-path install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-werror turns on -Werror [default=no]
--enable-version-specific-runtime-libs
Specify that runtime libraries should be installed
@@ -8282,7 +8287,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9987,6 +9992,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10004,9 +10052,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11812,7 +11864,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11815 "configure"
+#line 11867 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11918,7 +11970,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11921 "configure"
+#line 11973 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13443,6 +13495,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_D=no
hardcode_direct_D=no
hardcode_automatic_D=yes
@@ -13460,9 +13555,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_D="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_D="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_D="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_D="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_D="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_D="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -14064,6 +14163,14 @@ CFLAGS=$lt_save_CFLAGS
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
# libtool variables for Phobos shared and position-independent compiles.
#
@@ -15877,6 +15984,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${DRUNTIME_CPU_AARCH64_TRUE}" && test -z "${DRUNTIME_CPU_AARCH64_FALSE}"; then
as_fn_error $? "conditional \"DRUNTIME_CPU_AARCH64\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libphobos/configure.ac b/libphobos/configure.ac
index 3b2e6df5d5c..bb669675ce0 100644
--- a/libphobos/configure.ac
+++ b/libphobos/configure.ac
@@ -93,6 +93,7 @@ AM_PROG_LIBTOOL
WITH_LOCAL_DRUNTIME([LT_LANG([D])], [])
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
# libtool variables for Phobos shared and position-independent compiles.
#
diff --git a/libphobos/libdruntime/Makefile.am b/libphobos/libdruntime/Makefile.am
index 832a0524ab3..b78bcdd203f 100644
--- a/libphobos/libdruntime/Makefile.am
+++ b/libphobos/libdruntime/Makefile.am
@@ -128,8 +128,11 @@ ALL_DRUNTIME_SOURCES = $(DRUNTIME_DSOURCES) $(DRUNTIME_CSOURCES) \
toolexeclib_LTLIBRARIES = libgdruntime.la
libgdruntime_la_SOURCES = $(ALL_DRUNTIME_SOURCES)
libgdruntime_la_LIBTOOLFLAGS =
+if ENABLE_DARWIN_AT_RPATH
+libgdruntime_darwin_rpath = -Wl,-rpath,@loader_path
+endif
libgdruntime_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../src,-Bgcc \
- -version-info $(libtool_VERSION)
+ -version-info $(libtool_VERSION) $(libgdruntime_darwin_rpath)
libgdruntime_la_LIBADD = $(LIBATOMIC) $(LIBBACKTRACE)
libgdruntime_la_DEPENDENCIES = $(DRTSTUFF)
# Also override library link commands: This is not strictly
diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in
index 61a2a770888..4d62985349b 100644
--- a/libphobos/libdruntime/Makefile.in
+++ b/libphobos/libdruntime/Makefile.in
@@ -813,8 +813,9 @@ ALL_DRUNTIME_SOURCES = $(DRUNTIME_DSOURCES) $(DRUNTIME_CSOURCES) \
toolexeclib_LTLIBRARIES = libgdruntime.la
libgdruntime_la_SOURCES = $(ALL_DRUNTIME_SOURCES)
libgdruntime_la_LIBTOOLFLAGS =
+@ENABLE_DARWIN_AT_RPATH_TRUE@libgdruntime_darwin_rpath = -Wl,-rpath,@loader_path
libgdruntime_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../src,-Bgcc \
- -version-info $(libtool_VERSION)
+ -version-info $(libtool_VERSION) $(libgdruntime_darwin_rpath)
libgdruntime_la_LIBADD = $(LIBATOMIC) $(LIBBACKTRACE)
libgdruntime_la_DEPENDENCIES = $(DRTSTUFF)
diff --git a/libphobos/src/Makefile.am b/libphobos/src/Makefile.am
index 6474fca5eb5..f6521ed5860 100644
--- a/libphobos/src/Makefile.am
+++ b/libphobos/src/Makefile.am
@@ -44,8 +44,11 @@ toolexeclib_DATA = libgphobos.spec
toolexeclib_LTLIBRARIES = libgphobos.la
libgphobos_la_SOURCES = $(ALL_PHOBOS_SOURCES)
libgphobos_la_LIBTOOLFLAGS =
+if ENABLE_DARWIN_AT_RPATH
+libgphobos_darwin_rpath = -Wl,-rpath,@loader_path
+endif
libgphobos_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../libdruntime/gcc \
- -version-info $(libtool_VERSION)
+ -version-info $(libtool_VERSION) $(libgphobos_darwin_rpath)
if ENABLE_LIBDRUNTIME_ONLY
libgphobos_la_LIBADD = ../libdruntime/libgdruntime_convenience.la
else
diff --git a/libphobos/src/Makefile.in b/libphobos/src/Makefile.in
index a6229587e7b..cc3358b437e 100644
--- a/libphobos/src/Makefile.in
+++ b/libphobos/src/Makefile.in
@@ -529,8 +529,9 @@ toolexeclib_DATA = libgphobos.spec
toolexeclib_LTLIBRARIES = libgphobos.la
libgphobos_la_SOURCES = $(ALL_PHOBOS_SOURCES)
libgphobos_la_LIBTOOLFLAGS =
+@ENABLE_DARWIN_AT_RPATH_TRUE@libgphobos_darwin_rpath = -Wl,-rpath,@loader_path
libgphobos_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../libdruntime/gcc \
- -version-info $(libtool_VERSION)
+ -version-info $(libtool_VERSION) $(libgphobos_darwin_rpath)
@ENABLE_LIBDRUNTIME_ONLY_FALSE@libgphobos_la_LIBADD = \
@ENABLE_LIBDRUNTIME_ONLY_FALSE@ ../libdruntime/libgdruntime_convenience.la $(LIBZ)
diff --git a/libquadmath/Makefile.am b/libquadmath/Makefile.am
index 35dffb46f6e..0d02c95e738 100644
--- a/libquadmath/Makefile.am
+++ b/libquadmath/Makefile.am
@@ -36,8 +36,13 @@ endif
toolexeclib_LTLIBRARIES = libquadmath.la
libquadmath_la_LIBADD =
+
+if ENABLE_DARWIN_AT_RPATH
+libquadmath_darwin_rpath = -Wc,-nodefaultrpaths
+libquadmath_darwin_rpath += -Wl,-rpath,@loader_path
+endif
libquadmath_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
- $(version_arg) $(lt_host_flags) -lm
+ $(version_arg) $(lt_host_flags) $(LIBM) $(libquadmath_darwin_rpath)
libquadmath_la_DEPENDENCIES = $(version_dep) $(libquadmath_la_LIBADD)
nodist_libsubinclude_HEADERS = quadmath.h quadmath_weak.h
diff --git a/libquadmath/Makefile.in b/libquadmath/Makefile.in
index 8c011212258..068af559457 100644
--- a/libquadmath/Makefile.in
+++ b/libquadmath/Makefile.in
@@ -355,6 +355,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
+LIBM = @LIBM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
@@ -463,8 +464,10 @@ AUTOMAKE_OPTIONS = foreign info-in-builddir
@BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_SUN_TRUE@@LIBQUAD_USE_SYMVER_TRUE@version_dep = quadmath.map-sun
@BUILD_LIBQUADMATH_TRUE@toolexeclib_LTLIBRARIES = libquadmath.la
@BUILD_LIBQUADMATH_TRUE@libquadmath_la_LIBADD =
+@BUILD_LIBQUADMATH_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@libquadmath_darwin_rpath = -Wc,-nodefaultrpaths \
+@BUILD_LIBQUADMATH_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
@BUILD_LIBQUADMATH_TRUE@libquadmath_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
-@BUILD_LIBQUADMATH_TRUE@ $(version_arg) $(lt_host_flags) -lm
+@BUILD_LIBQUADMATH_TRUE@ $(version_arg) $(lt_host_flags) $(LIBM) $(libquadmath_darwin_rpath)
@BUILD_LIBQUADMATH_TRUE@libquadmath_la_DEPENDENCIES = $(version_dep) $(libquadmath_la_LIBADD)
@BUILD_LIBQUADMATH_TRUE@nodist_libsubinclude_HEADERS = quadmath.h quadmath_weak.h
diff --git a/libquadmath/configure b/libquadmath/configure
index 0b145a644c3..953fa4ded01 100755
--- a/libquadmath/configure
+++ b/libquadmath/configure
@@ -644,11 +644,14 @@ LIBQUAD_USE_SYMVER_GNU_FALSE
LIBQUAD_USE_SYMVER_GNU_TRUE
LIBQUAD_USE_SYMVER_FALSE
LIBQUAD_USE_SYMVER_TRUE
+LIBM
toolexeclibdir
toolexecdir
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -785,6 +788,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
with_toolexeclibdir
enable_symvers
@@ -1435,6 +1439,8 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-path install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -7310,7 +7316,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9022,6 +9028,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9039,9 +9088,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -10868,7 +10921,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10871 "configure"
+#line 10924 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10974,7 +11027,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10977 "configure"
+#line 11030 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11235,6 +11288,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
@@ -12199,6 +12260,148 @@ esac
+LIBM=
+case $host in
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+ # These system don't have libm, or don't need it
+ ;;
+*-ncr-sysv4.3*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mwvalidcheckl in -lmw" >&5
+$as_echo_n "checking for _mwvalidcheckl in -lmw... " >&6; }
+if ${ac_cv_lib_mw__mwvalidcheckl+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lmw $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char _mwvalidcheckl ();
+int
+main ()
+{
+return _mwvalidcheckl ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_mw__mwvalidcheckl=yes
+else
+ ac_cv_lib_mw__mwvalidcheckl=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mw__mwvalidcheckl" >&5
+$as_echo "$ac_cv_lib_mw__mwvalidcheckl" >&6; }
+if test "x$ac_cv_lib_mw__mwvalidcheckl" = xyes; then :
+ LIBM="-lmw"
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
+$as_echo_n "checking for cos in -lm... " >&6; }
+if ${ac_cv_lib_m_cos+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char cos ();
+int
+main ()
+{
+return cos ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_cos=yes
+else
+ ac_cv_lib_m_cos=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
+$as_echo "$ac_cv_lib_m_cos" >&6; }
+if test "x$ac_cv_lib_m_cos" = xyes; then :
+ LIBM="$LIBM -lm"
+fi
+
+ ;;
+*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
+$as_echo_n "checking for cos in -lm... " >&6; }
+if ${ac_cv_lib_m_cos+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char cos ();
+int
+main ()
+{
+return cos ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_cos=yes
+else
+ ac_cv_lib_m_cos=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
+$as_echo "$ac_cv_lib_m_cos" >&6; }
+if test "x$ac_cv_lib_m_cos" = xyes; then :
+ LIBM="-lm"
+fi
+
+ ;;
+esac
+
+
+
for ac_header in fenv.h langinfo.h locale.h wchar.h wctype.h limits.h ctype.h printf.h errno.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
@@ -13459,6 +13662,10 @@ if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then
as_fn_error $? "conditional \"BUILD_INFO\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libquadmath/configure.ac b/libquadmath/configure.ac
index eec4084a45f..94a3f2179e9 100644
--- a/libquadmath/configure.ac
+++ b/libquadmath/configure.ac
@@ -59,6 +59,7 @@ AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
AM_MAINTAINER_MODE
@@ -121,6 +122,8 @@ esac
AC_SUBST(toolexecdir)
AC_SUBST(toolexeclibdir)
+AC_CHECK_LIBM
+
AC_CHECK_HEADERS(fenv.h langinfo.h locale.h wchar.h wctype.h limits.h ctype.h printf.h errno.h)
LIBQUAD_CHECK_MATH_H_SIGNGAM
diff --git a/libsanitizer/asan/Makefile.am b/libsanitizer/asan/Makefile.am
index 4f802f723d6..223d3e07816 100644
--- a/libsanitizer/asan/Makefile.am
+++ b/libsanitizer/asan/Makefile.am
@@ -60,7 +60,12 @@ libasan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
libasan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libasan)
+if ENABLE_DARWIN_AT_RPATH
+libasan_darwin_rpath = -Wc,-nodefaultrpaths
+libasan_darwin_rpath += -Wl,-rpath,@loader_path
+endif
+libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libasan) $(libasan_darwin_rpath)
libasan_preinit.o: asan_preinit.o
cp $< $@
diff --git a/libsanitizer/asan/Makefile.in b/libsanitizer/asan/Makefile.in
index 7833a9a4c3f..e88e5e0b0a7 100644
--- a/libsanitizer/asan/Makefile.in
+++ b/libsanitizer/asan/Makefile.in
@@ -465,7 +465,12 @@ libasan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(top_builddir)/lsan/libsanitizer_lsan.la $(am__append_2) \
$(am__append_3) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libasan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libasan_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libasan) $(libasan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
diff --git a/libsanitizer/configure b/libsanitizer/configure
index 0805d254fe5..7cf6bb02592 100755
--- a/libsanitizer/configure
+++ b/libsanitizer/configure
@@ -666,6 +666,8 @@ LSAN_SUPPORTED_FALSE
LSAN_SUPPORTED_TRUE
TSAN_SUPPORTED_FALSE
TSAN_SUPPORTED_TRUE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
CXXCPP
@@ -817,6 +819,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_werror
with_gcc_major_version_only
enable_cet
@@ -1471,6 +1474,8 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-path install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--disable-werror disable building with -Werror
--enable-cet enable Intel CET in target libraries [default=auto]
@@ -8891,7 +8896,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10596,6 +10601,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10613,9 +10661,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12421,7 +12473,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12424 "configure"
+#line 12476 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12527,7 +12579,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12530 "configure"
+#line 12582 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13403,6 +13455,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13420,12 +13515,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15845,6 +15948,15 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
@@ -17243,6 +17355,10 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${TSAN_SUPPORTED_TRUE}" && test -z "${TSAN_SUPPORTED_FALSE}"; then
as_fn_error $? "conditional \"TSAN_SUPPORTED\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libsanitizer/configure.ac b/libsanitizer/configure.ac
index 04cd8910ed6..5906c8d4887 100644
--- a/libsanitizer/configure.ac
+++ b/libsanitizer/configure.ac
@@ -85,6 +85,8 @@ esac
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
AC_CHECK_SIZEOF([void *])
if test "${multilib}" = "yes"; then
diff --git a/libsanitizer/hwasan/Makefile.am b/libsanitizer/hwasan/Makefile.am
index bb7f8fa0b7b..653fc8c4720 100644
--- a/libsanitizer/hwasan/Makefile.am
+++ b/libsanitizer/hwasan/Makefile.am
@@ -47,7 +47,11 @@ libhwasan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
libhwasan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libhwasan)
+if ENABLE_DARWIN_AT_RPATH
+libhwasan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
+libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libhwasan) $(libhwasan_darwin_rpath)
libhwasan_preinit.o: hwasan_preinit.o
cp $< $@
diff --git a/libsanitizer/hwasan/Makefile.in b/libsanitizer/hwasan/Makefile.in
index 58bc26b44b9..87971fd3374 100644
--- a/libsanitizer/hwasan/Makefile.in
+++ b/libsanitizer/hwasan/Makefile.in
@@ -447,7 +447,10 @@ libhwasan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(top_builddir)/lsan/libsanitizer_lsan.la $(am__append_1) \
$(am__append_2) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libhwasan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libhwasan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/
+libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libhwasan) $(libhwasan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
diff --git a/libsanitizer/lsan/Makefile.am b/libsanitizer/lsan/Makefile.am
index 6ff28ff5eea..7701b0e18cf 100644
--- a/libsanitizer/lsan/Makefile.am
+++ b/libsanitizer/lsan/Makefile.am
@@ -41,8 +41,12 @@ if LIBBACKTRACE_SUPPORTED
liblsan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
liblsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_liblsan)
-
+if ENABLE_DARWIN_AT_RPATH
+liblsan_darwin_rpath = -Wc,-nodefaultrpaths
+liblsan_darwin_rpath += -Wl,-rpath,@loader_path
+endif
+liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_liblsan) $(liblsan_darwin_rpath)
liblsan_preinit.o: lsan_preinit.o
cp $< $@
diff --git a/libsanitizer/lsan/Makefile.in b/libsanitizer/lsan/Makefile.in
index d8fd4ee9557..078edf01fda 100644
--- a/libsanitizer/lsan/Makefile.in
+++ b/libsanitizer/lsan/Makefile.in
@@ -413,7 +413,12 @@ liblsan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(top_builddir)/interception/libinterception.la \
$(am__append_1) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_liblsan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@liblsan_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_liblsan) $(liblsan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
@@ -788,7 +793,6 @@ uninstall-am: uninstall-nodist_toolexeclibHEADERS \
.PRECIOUS: Makefile
-
liblsan_preinit.o: lsan_preinit.o
cp $< $@
diff --git a/libsanitizer/tsan/Makefile.am b/libsanitizer/tsan/Makefile.am
index da80743da9d..01290b0313d 100644
--- a/libsanitizer/tsan/Makefile.am
+++ b/libsanitizer/tsan/Makefile.am
@@ -57,7 +57,11 @@ libtsan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
libtsan_la_DEPENDENCIES +=$(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
libtsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libtsan)
+if ENABLE_DARWIN_AT_RPATH
+libtsan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
+libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libtsan) $(libtsan_darwin_rpath)
libtsan_preinit.o: tsan_preinit.o
cp $< $@
diff --git a/libsanitizer/tsan/Makefile.in b/libsanitizer/tsan/Makefile.in
index 36498832bb8..95011584bcb 100644
--- a/libsanitizer/tsan/Makefile.in
+++ b/libsanitizer/tsan/Makefile.in
@@ -464,7 +464,10 @@ libtsan_la_DEPENDENCIES = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(top_builddir)/interception/libinterception.la \
$(TSAN_TARGET_DEPENDENT_OBJECTS) $(am__append_2)
-libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libtsan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libtsan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/
+libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libtsan) $(libtsan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
diff --git a/libsanitizer/ubsan/Makefile.am b/libsanitizer/ubsan/Makefile.am
index d480f26adc0..7769b3437e4 100644
--- a/libsanitizer/ubsan/Makefile.am
+++ b/libsanitizer/ubsan/Makefile.am
@@ -36,7 +36,12 @@ if LIBBACKTRACE_SUPPORTED
libubsan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
libubsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libubsan)
+if ENABLE_DARWIN_AT_RPATH
+libubsan_darwin_rpath = -Wc,-nodefaultrpaths
+libubsan_darwin_rpath += -Wl,-rpath,@loader_path
+endif
+libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libubsan) $(libubsan_darwin_rpath)
# Use special rules for files that require RTTI support.
ubsan_handlers_cxx.% ubsan_type_hash.% ubsan_type_hash_itanium.% : AM_CXXFLAGS += -frtti
diff --git a/libsanitizer/ubsan/Makefile.in b/libsanitizer/ubsan/Makefile.in
index 92a8e387fd7..7e51480e970 100644
--- a/libsanitizer/ubsan/Makefile.in
+++ b/libsanitizer/ubsan/Makefile.in
@@ -400,7 +400,12 @@ libubsan_la_SOURCES = $(ubsan_files)
libubsan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(am__append_1) $(am__append_2) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libubsan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libubsan_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libubsan) $(libubsan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
diff --git a/libssp/Makefile.am b/libssp/Makefile.am
index 1636e43b369..f7ed2aa6043 100644
--- a/libssp/Makefile.am
+++ b/libssp/Makefile.am
@@ -49,8 +49,12 @@ libssp_la_SOURCES = \
vsnprintf-chk.c vsprintf-chk.c
libssp_la_LIBADD =
libssp_la_DEPENDENCIES = $(version_dep) $(libssp_la_LIBADD)
+if ENABLE_DARWIN_AT_RPATH
+libssp_darwin_rpath = -Wc,-nodefaultrpaths
+libssp_darwin_rpath += -Wl,-rpath,@loader_path
+endif
libssp_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
- $(version_arg) $(lt_host_flags)
+ $(version_arg) $(lt_host_flags) $(libssp_darwin_rpath)
libssp_nonshared_la_SOURCES = \
ssp-local.c
diff --git a/libssp/Makefile.in b/libssp/Makefile.in
index bc8a0dc2b28..1cf86361b96 100644
--- a/libssp/Makefile.in
+++ b/libssp/Makefile.in
@@ -376,8 +376,11 @@ libssp_la_SOURCES = \
libssp_la_LIBADD =
libssp_la_DEPENDENCIES = $(version_dep) $(libssp_la_LIBADD)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libssp_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
libssp_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
- $(version_arg) $(lt_host_flags)
+ $(version_arg) $(lt_host_flags) $(libssp_darwin_rpath)
libssp_nonshared_la_SOURCES = \
ssp-local.c
diff --git a/libssp/configure b/libssp/configure
index 7f8b8fdf99d..096f5ba5e4e 100755
--- a/libssp/configure
+++ b/libssp/configure
@@ -636,6 +636,8 @@ LIBOBJS
get_gcc_base_ver
toolexeclibdir
toolexecdir
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -781,6 +783,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
with_toolexeclibdir
with_gcc_major_version_only
'
@@ -1426,6 +1429,8 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-path install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -7496,7 +7501,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9208,6 +9213,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9225,9 +9273,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11054,7 +11106,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11057 "configure"
+#line 11109 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11160,7 +11212,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11163 "configure"
+#line 11215 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11438,6 +11490,15 @@ fi
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# Calculate toolexeclibdir
# Also toolexecdir, though it's only used in toolexeclibdir
case ${version_specific_libs} in
@@ -11647,6 +11708,10 @@ if test -z "${LIBSSP_USE_SYMVER_SUN_TRUE}" && test -z "${LIBSSP_USE_SYMVER_SUN_F
as_fn_error $? "conditional \"LIBSSP_USE_SYMVER_SUN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/libssp/configure.ac b/libssp/configure.ac
index f30f81c54f6..90778e2355d 100644
--- a/libssp/configure.ac
+++ b/libssp/configure.ac
@@ -165,6 +165,8 @@ AC_SUBST(enable_static)
GCC_WITH_TOOLEXECLIBDIR
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
# Calculate toolexeclibdir
# Also toolexecdir, though it's only used in toolexeclibdir
case ${version_specific_libs} in
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index c4da56c3042..c205a3c1a4d 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -789,6 +789,8 @@ GLIBCXX_HOSTED_TRUE
glibcxx_compiler_shared_flag
glibcxx_compiler_pic_flag
glibcxx_lt_pic_flag
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -924,6 +926,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_hosted_libstdcxx
enable_libstdcxx_hosted
enable_libstdcxx_verbose
@@ -1615,6 +1618,8 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-path install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--disable-hosted-libstdcxx
only build freestanding C++ runtime support
--disable-libstdcxx-hosted
@@ -8539,7 +8544,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10379,6 +10384,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10396,9 +10444,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12225,7 +12277,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12228 "configure"
+#line 12280 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12331,7 +12383,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12334 "configure"
+#line 12386 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13213,6 +13265,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13230,12 +13325,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15632,6 +15735,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
if test "$enable_vtable_verify" = yes; then
predep_objects_CXX="${predep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_start.o"
@@ -16055,7 +16166,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; }
# Fake what AC_TRY_COMPILE does.
cat > conftest.$ac_ext << EOF
-#line 16058 "configure"
+#line 16169 "configure"
int main()
{
typedef bool atomic_type;
@@ -16090,7 +16201,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16093 "configure"
+#line 16204 "configure"
int main()
{
typedef short atomic_type;
@@ -16125,7 +16236,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16128 "configure"
+#line 16239 "configure"
int main()
{
// NB: _Atomic_word not necessarily int.
@@ -16161,7 +16272,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16164 "configure"
+#line 16275 "configure"
int main()
{
typedef long long atomic_type;
@@ -16317,7 +16428,7 @@ $as_echo "mutex" >&6; }
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 16320 "configure"
+#line 16431 "configure"
int main()
{
_Decimal32 d1;
@@ -16359,7 +16470,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 16362 "configure"
+#line 16473 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
@@ -74906,6 +75017,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${GLIBCXX_HOSTED_TRUE}" && test -z "${GLIBCXX_HOSTED_FALSE}"; then
as_fn_error $? "conditional \"GLIBCXX_HOSTED\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index fc0f2522027..80e573e690f 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -108,6 +108,7 @@ AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
if test "$enable_vtable_verify" = yes; then
predep_objects_CXX="${predep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_start.o"
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index 5b9af41cdb9..925137c2ccc 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -152,8 +152,13 @@ libstdc___la_DEPENDENCIES = \
$(top_builddir)/src/c++17/libc++17convenience.la \
$(top_builddir)/src/c++20/libc++20convenience.la
+if ENABLE_DARWIN_AT_RPATH
+libstdc___darwin_rpath = -Wc,-nodefaultrpaths
+libstdc___darwin_rpath += -Wl,-rpath,@loader_path
+endif
+
libstdc___la_LDFLAGS = \
- -version-info $(libtool_VERSION) ${version_arg} -lm
+ -version-info $(libtool_VERSION) ${version_arg} -lm $(libstdc___darwin_rpath)
libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) $(lt_host_flags)
diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
index f42d957af36..0ce75f30708 100644
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -560,8 +560,11 @@ libstdc___la_DEPENDENCIES = \
$(top_builddir)/src/c++17/libc++17convenience.la \
$(top_builddir)/src/c++20/libc++20convenience.la
+@ENABLE_DARWIN_AT_RPATH_TRUE@libstdc___darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
libstdc___la_LDFLAGS = \
- -version-info $(libtool_VERSION) ${version_arg} -lm
+ -version-info $(libtool_VERSION) ${version_arg} -lm $(libstdc___darwin_rpath)
libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) $(lt_host_flags)
@GLIBCXX_LDBL_ALT128_COMPAT_FALSE@@GLIBCXX_LDBL_COMPAT_TRUE@LTCXXCOMPILE64 = $(LTCXXCOMPILE)
diff --git a/libtool.m4 b/libtool.m4
index e36fdd3c0e2..959d2fba7ea 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -1005,7 +1005,7 @@ _LT_EOF
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[[89]]*|UNSET,*-darwin[[12]][[0123456789]]*)
+ UNSET,*-darwin[[89]]*|UNSET,*-darwin[[12]][[0-9]]*)
;;
10.[[012]][[,.]]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -1039,6 +1039,45 @@ _LT_EOF
m4_defun([_LT_DARWIN_LINKER_FEATURES],
[
m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ AC_ARG_ENABLE([darwin-at-rpath],
+ AS_HELP_STRING([--enable-darwin-at-path],
+ [install libraries with @rpath/library-name, requires rpaths to be added to executables]),
+ [if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[[4-8]]*|UNSET,rhapsody*|10.[[0-4]][[,.]]*)
+ AC_MSG_WARN([Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)])
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi],
+ [case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[[4-8]]*|UNSET,rhapsody*|10.[[0-4]][[,.]]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[[5-9]]*|UNSET,darwin2*|10.1[[1-9]][[,.]]*|1[[1-9]].*[[,.]]* )
+ AC_MSG_NOTICE([@rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)])
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+ ])
+
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_automatic, $1)=yes
@@ -1056,13 +1095,21 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
_LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
_LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
m4_if([$1], [CXX],
[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
_LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
],[])
@@ -4265,6 +4312,7 @@ _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
[Compiler flag to prevent dynamic linking])
])# _LT_COMPILER_PIC
+_LT_TAGVAR(enable_darwin_at_rpath, $1)=no
# _LT_LINKER_SHLIBS([TAGNAME])
# ----------------------------
@@ -6504,7 +6552,6 @@ fi # test "$_lt_caught_CXX_error" != yes
AC_LANG_POP
])# _LT_LANG_CXX_CONFIG
-
# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
# ---------------------------------
# Figure out "hidden" library dependencies from verbose
diff --git a/libvtv/configure b/libvtv/configure
index 917557103e9..2ff085ca8d8 100755
--- a/libvtv/configure
+++ b/libvtv/configure
@@ -640,6 +640,8 @@ VTV_CYGMIN_FALSE
VTV_CYGMIN_TRUE
XCFLAGS
libtool_VERSION
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -797,6 +799,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_cet
with_gcc_major_version_only
'
@@ -1446,6 +1449,8 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-path install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-cet enable Intel CET in target libraries [default=auto]
Optional Packages:
@@ -8786,7 +8791,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10491,6 +10496,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10508,9 +10556,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12316,7 +12368,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12319 "configure"
+#line 12371 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12422,7 +12474,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12425 "configure"
+#line 12477 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13298,6 +13350,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13315,12 +13410,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15714,6 +15817,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=1:0:0
@@ -16059,6 +16170,10 @@ if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${VTV_CYGMIN_TRUE}" && test -z "${VTV_CYGMIN_FALSE}"; then
as_fn_error $? "conditional \"VTV_CYGMIN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libvtv/configure.ac b/libvtv/configure.ac
index f3b937e4b10..50aaadbb3a3 100644
--- a/libvtv/configure.ac
+++ b/libvtv/configure.ac
@@ -153,6 +153,7 @@ AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=1:0:0
diff --git a/lto-plugin/configure b/lto-plugin/configure
index 37c44d04a0d..826d5cfe54d 100755
--- a/lto-plugin/configure
+++ b/lto-plugin/configure
@@ -634,6 +634,8 @@ LTLIBOBJS
LIBOBJS
target_noncanonical
lt_host_flags
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
OTOOL64
OTOOL
LIPO
@@ -788,6 +790,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
'
ac_precious_vars='build_alias
host_alias
@@ -1434,6 +1437,8 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-path install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -8657,7 +8662,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10363,6 +10368,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10380,9 +10428,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12188,7 +12240,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12191 "configure"
+#line 12243 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12294,7 +12346,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12297 "configure"
+#line 12349 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12531,6 +12583,14 @@ CC="$lt_save_CC"
# Only expand once:
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
@@ -12777,6 +12837,10 @@ if test -z "${LTO_PLUGIN_USE_SYMVER_SUN_TRUE}" && test -z "${LTO_PLUGIN_USE_SYMV
as_fn_error $? "conditional \"LTO_PLUGIN_USE_SYMVER_SUN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/lto-plugin/configure.ac b/lto-plugin/configure.ac
index 84f2a60b480..c051b8c6283 100644
--- a/lto-plugin/configure.ac
+++ b/lto-plugin/configure.ac
@@ -121,6 +121,7 @@ fi
AC_SUBST(ac_lto_plugin_extra_ldflags)
AM_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
ACX_LT_HOST_FLAGS
AC_SUBST(target_noncanonical)
AC_TYPE_INT64_T
diff --git a/zlib/configure b/zlib/configure
index 273ac36647d..ab5897d52de 100755
--- a/zlib/configure
+++ b/zlib/configure
@@ -641,6 +641,8 @@ TARGET_LIBRARY_FALSE
TARGET_LIBRARY_TRUE
toolexeclibdir
toolexecdir
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
CPP
OTOOL64
OTOOL
@@ -778,6 +780,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
with_toolexeclibdir
enable_host_shared
enable_host_pie
@@ -1422,6 +1425,8 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-path install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-host-shared build host code as shared libraries
--enable-host-pie build host code as PIE
@@ -6976,7 +6981,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -8955,6 +8960,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -8972,9 +9020,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -10801,7 +10853,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10804 "configure"
+#line 10856 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10907,7 +10959,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10910 "configure"
+#line 10962 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11144,6 +11196,14 @@ CC="$lt_save_CC"
# Only expand once:
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
# Find CPP now so that any conditional tests below won't do it and
# thereby make the resulting definitions conditional.
@@ -11790,6 +11850,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${TARGET_LIBRARY_TRUE}" && test -z "${TARGET_LIBRARY_FALSE}"; then
as_fn_error $? "conditional \"TARGET_LIBRARY\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/zlib/configure.ac b/zlib/configure.ac
index adf7aad4e51..9501cdfea85 100644
--- a/zlib/configure.ac
+++ b/zlib/configure.ac
@@ -64,6 +64,7 @@ GCC_CET_FLAGS(CET_FLAGS)
AC_SUBST(CET_FLAGS)
AC_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
# Find CPP now so that any conditional tests below won't do it and
# thereby make the resulting definitions conditional.
--
2.39.2 (Apple Git-143)
[-- Attachment #4: 0003-Darwin-rpaths-Add-with-darwin-extra-rpath.patch --]
[-- Type: application/octet-stream, Size: 6093 bytes --]
From 5093a13bbaec2e0f1f8ef93d041d501e0c0c5a1a Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Sat, 28 May 2022 10:16:27 +0100
Subject: [PATCH 3/4] Darwin, rpaths: Add --with-darwin-extra-rpath.
This is provided to allow distributions to add a single additional
runpath to allow for cases where the installed GCC library directories
are then symlinked to a common dirctory outside of any of the GCC
installations.
For example:
/opt/distro/lib:
libgfortran.dylib -> /opt/distro/lib/gcc-11.3/lib/libgfortran.dylib
So that libraries which are designed to be found in the runpath we would then
add --with-darwin-add-rpath=/opt/distro/lib to the configure line.
This patch makes the configuration a little more forgiving of using
--disable-darwin-at-rpath (although for platform versions >= 10.11 this will
result in misconfigured target libraries).
gcc/ChangeLog:
* configure.ac: Add --with-darwin-extra-rpath option.
* config/darwin.h: Handle DARWIN_EXTRA_RPATH.
* config.in: Regenerate.
* configure: Regenerate.
---
gcc/config.in | 13 +++++++++++++
gcc/config/darwin.h | 14 ++++++++++++++
gcc/configure | 28 ++++++++++++++++++++++++++--
gcc/configure.ac | 13 +++++++++++++
4 files changed, 66 insertions(+), 2 deletions(-)
diff --git a/gcc/config.in b/gcc/config.in
index 5cf51bc1b01..9bda18ab64b 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -49,6 +49,19 @@
#endif
+/* Specify a runpath directory, additional to those provided by the compiler
+ */
+#ifndef USED_FOR_TARGET
+#undef DARWIN_ADD_RPATH
+#endif
+
+
+/* Should add an extra runpath directory */
+#ifndef USED_FOR_TARGET
+#undef DARWIN_DO_EXTRA_RPATH
+#endif
+
+
/* Define to enable the use of a default assembler. */
#ifndef USED_FOR_TARGET
#undef DEFAULT_ASSEMBLER
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 44c92db6214..d1bf7b670a7 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -321,6 +321,19 @@ extern GTY(()) int darwin_ms_struct;
%:version-compare(>= 10.11 mmacosx-version-min= -lemutls_w) "
#endif
+/* We might elect to add a path even when this compiler does not use embedded
+ run paths, so that we can use libraries from an alternate compiler that is
+ using embedded runpaths. */
+#if DARWIN_DO_EXTRA_RPATH
+# define DARWIN_EXTRA_RPATH \
+"%{!r:%{!nostdlib:%{!nodefaultrpaths:\
+ %:version-compare(>= 10.5 mmacosx-version-min= -rpath) \
+ %:version-compare(>= 10.5 mmacosx-version-min= " DARWIN_ADD_RPATH ") \
+ }}}"
+#else
+# define DARWIN_EXTRA_RPATH ""
+#endif
+
#define SUBSUBTARGET_OVERRIDE_OPTIONS \
do { \
darwin_override_options (); \
@@ -415,6 +428,7 @@ extern GTY(()) int darwin_ms_struct;
DARWIN_NOPIE_SPEC \
DARWIN_RDYNAMIC \
DARWIN_NOCOMPACT_UNWIND \
+ DARWIN_EXTRA_RPATH \
DARWIN_RPATH_LINK \
"}}}}}}} %<pie %<no-pie %<rdynamic %<X %<rpath %<nodefaultrpaths "
diff --git a/gcc/configure b/gcc/configure
index 89c370f750e..a8e28ae7b82 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1009,6 +1009,7 @@ with_pic
enable_fast_install
enable_libtool_lock
enable_darwin_at_rpath
+with_darwin_extra_rpath
enable_ld
enable_gold
with_plugin_ld
@@ -1869,6 +1870,9 @@ Optional Packages:
--with-pic try to use only PIC/non-PIC objects [default=use
both]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
+ --with-darwin-extra-rpath=[ARG]
+ Specify a runpath directory, additional to those
+ provided by the compiler
--with-plugin-ld=[ARG] specify the plugin linker
--with-glibc-version=M.N
assume GCC used with glibc version M.N or later
@@ -19938,7 +19942,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19941 "configure"
+#line 19945 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -20044,7 +20048,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 20047 "configure"
+#line 20051 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -23372,6 +23376,26 @@ else
ENABLE_DARWIN_AT_RPATH_FALSE=
fi
+DARWIN_DO_EXTRA_RPATH=0
+
+# Check whether --with-darwin-extra-rpath was given.
+if test "${with_darwin_extra_rpath+set}" = set; then :
+ withval=$with_darwin_extra_rpath; if test x"$withval" != x; then
+ DARWIN_ADD_RPATH="$withval"
+ DARWIN_DO_EXTRA_RPATH=1
+ fi
+fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define DARWIN_DO_EXTRA_RPATH $DARWIN_DO_EXTRA_RPATH
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define DARWIN_ADD_RPATH "$DARWIN_ADD_RPATH"
+_ACEOF
+
# Identify the assembler which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the assembler
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 6c9d0ad6897..67118f5d133 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2600,6 +2600,19 @@ AC_SUBST(objdir)
AC_SUBST(enable_fast_install)
AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+DARWIN_DO_EXTRA_RPATH=0
+AC_ARG_WITH(darwin-extra-rpath,
+[AS_HELP_STRING(
+ [[--with-darwin-extra-rpath=[ARG]]],
+ [Specify a runpath directory, additional to those provided by the compiler])],
+[if test x"$withval" != x; then
+ DARWIN_ADD_RPATH="$withval"
+ DARWIN_DO_EXTRA_RPATH=1
+ fi])
+AC_DEFINE_UNQUOTED(DARWIN_DO_EXTRA_RPATH, $DARWIN_DO_EXTRA_RPATH,
+ [Should add an extra runpath directory])
+AC_DEFINE_UNQUOTED(DARWIN_ADD_RPATH, "$DARWIN_ADD_RPATH",
+ [Specify a runpath directory, additional to those provided by the compiler])
# Identify the assembler which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the assembler
--
2.39.2 (Apple Git-143)
[-- Attachment #5: 0004-Testsuite-allow-non-installed-testing-on-darwin.patch --]
[-- Type: application/octet-stream, Size: 12815 bytes --]
From 96eef92849a136c740462a6d4e2561d535155f98 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Fri, 16 Apr 2021 20:01:40 +0100
Subject: [PATCH 4/4] Testsuite: allow non-installed testing on darwin
DYLD_LIBRARY_PATH is now removed from the environment for all system
tools, including the shell. Adapt the testsuite and pass the right
options to allow testing, even when the compiler and libraries have not
been installed.
gcc/ChangeLog:
* Makefile.in: set ENABLE_DARWIN_AT_RPATH in site.tmp.
gcc/testsuite/ChangeLog:
* gfortran.dg/coarray/caf.exp: Correctly set
libatomic flags.
* gfortran.dg/dg.exp: Likewise.
* lib/asan-dg.exp: Set correct -B flags.
* lib/atomic-dg.exp: Likewise.
* lib/target-libpath.exp: Handle ENABLE_DARWIN_AT_RPATH.
libatomic/ChangeLog:
* testsuite/lib/libatomic.exp: Pass correct flags on darwin.
libffi/ChangeLog:
* testsuite/lib/libffi.exp: Likewise.
libitm/ChangeLog:
* testsuite/lib/libitm.exp: Likewise.
* testsuite/libitm.c++/c++.exp: Likewise.
---
gcc/Makefile.in | 3 +++
gcc/testsuite/gfortran.dg/coarray/caf.exp | 16 +++++++++---
gcc/testsuite/gfortran.dg/dg.exp | 32 ++++++++++++++++++++---
gcc/testsuite/lib/asan-dg.exp | 2 +-
gcc/testsuite/lib/atomic-dg.exp | 2 +-
gcc/testsuite/lib/target-libpath.exp | 23 +++++++++++++---
libatomic/testsuite/lib/libatomic.exp | 8 ++++--
libffi/testsuite/lib/libffi.exp | 11 +++++---
libitm/testsuite/lib/libitm.exp | 1 +
libitm/testsuite/libitm.c++/c++.exp | 4 ++-
10 files changed, 84 insertions(+), 18 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 6809a7781a1..0abd43e5e3f 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -4202,6 +4202,9 @@ site.exp: ./config.status Makefile
echo "set COMPAT_OPTIONS \"$(COMPAT_OPTIONS)\"" >> ./site.tmp; \
else true; \
fi
+ @if test "x@enable_darwin_at_rpath@" = "xyes" ; then \
+ echo "set ENABLE_DARWIN_AT_RPATH 1" >> ./site.tmp; \
+ fi
@echo "## All variables above are generated by configure. Do Not Edit ##" >> ./site.tmp
@cat ./site.tmp > site.exp
@cat site.bak | sed \
diff --git a/gcc/testsuite/gfortran.dg/coarray/caf.exp b/gcc/testsuite/gfortran.dg/coarray/caf.exp
index d232be2fa90..1c94743a977 100644
--- a/gcc/testsuite/gfortran.dg/coarray/caf.exp
+++ b/gcc/testsuite/gfortran.dg/coarray/caf.exp
@@ -28,6 +28,7 @@
# Load procedures from common libraries.
load_lib gfortran-dg.exp
+load_lib atomic-dg.exp
# If a testcase doesn't have special options, use these.
global DEFAULT_FFLAGS
@@ -47,6 +48,7 @@ global gfortran_test_path
global gfortran_aux_module_flags
set gfortran_test_path $srcdir/$subdir
set gfortran_aux_module_flags $DEFAULT_FFLAGS
+
proc dg-compile-aux-modules { args } {
global gfortran_test_path
global gfortran_aux_module_flags
@@ -71,7 +73,15 @@ proc dg-compile-aux-modules { args } {
# Add -latomic only where supported. Assume built-in support elsewhere.
set maybe_atomic_lib ""
if [check_effective_target_libatomic_available] {
- set maybe_atomic_lib "-latomic"
+ if ![is_remote host] {
+ if [info exists TOOL_OPTIONS] {
+ set maybe_atomic_lib "[atomic_link_flags [get_multilibs ${TOOL_OPTIONS}]]"
+ } else {
+ set maybe_atomic_lib "[atomic_link_flags [get_multilibs]]"
+ }
+ }
+ set t [get_multilibs]
+ puts "maybe al $maybe_atomic_lib ml $t"
}
# Main loop.
@@ -97,14 +107,14 @@ foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ]]
foreach flags $option_list {
verbose "Testing $nshort (single), $flags" 1
set gfortran_aux_module_flags "-fcoarray=single $flags"
- dg-test $test "-fcoarray=single $flags $maybe_atomic_lib" ""
+ dg-test $test "-fcoarray=single $flags" $maybe_atomic_lib
cleanup-modules ""
}
foreach flags $option_list {
verbose "Testing $nshort (libcaf_single), $flags" 1
set gfortran_aux_module_flags "-fcoarray=lib $flags -lcaf_single"
- dg-test $test "-fcoarray=lib $flags -lcaf_single $maybe_atomic_lib" ""
+ dg-test $test "-fcoarray=lib $flags -lcaf_single" $maybe_atomic_lib
cleanup-modules ""
}
}
diff --git a/gcc/testsuite/gfortran.dg/dg.exp b/gcc/testsuite/gfortran.dg/dg.exp
index ee2760327dc..73541ea7301 100644
--- a/gcc/testsuite/gfortran.dg/dg.exp
+++ b/gcc/testsuite/gfortran.dg/dg.exp
@@ -18,6 +18,7 @@
# Load support procs.
load_lib gfortran-dg.exp
+load_lib atomic-dg.exp
# If a testcase doesn't have special options, use these.
global DEFAULT_FFLAGS
@@ -53,13 +54,38 @@ proc dg-compile-aux-modules { args } {
}
}
+# coarray tests might need libatomic. Assume that it is either not needed or
+# provided by builtins if it's not available.
+set maybe_atomic_lib ""
+if [check_effective_target_libatomic_available] {
+ if ![is_remote host] {
+ if [info exists TOOL_OPTIONS] {
+ set maybe_atomic_lib "[atomic_link_flags [get_multilibs ${TOOL_OPTIONS}]]"
+ } else {
+ set maybe_atomic_lib "[atomic_link_flags [get_multilibs]]"
+ }
+ } else {
+ set maybe_atomic_lib ""
+ }
+ set t [get_multilibs]
+ puts "dg set al $maybe_atomic_lib ml $t"
+}
+
+set all_flags $DEFAULT_FFLAGS
+if { $maybe_atomic_lib != "" } {
+ foreach f $maybe_atomic_lib {
+ lappend all_flags $f
+ }
+}
+
+puts "revised FFLAGS $all_flags"
+
# Main loop.
gfortran-dg-runtest [lsort \
- [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ] ] "" $DEFAULT_FFLAGS
+ [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ] ] "" $all_flags
gfortran-dg-runtest [lsort \
- [glob -nocomplain $srcdir/$subdir/g77/*.\[fF\] ] ] "" $DEFAULT_FFLAGS
-
+ [glob -nocomplain $srcdir/$subdir/g77/*.\[fF\] ] ] "" $all_flags
# All done.
dg-finish
diff --git a/gcc/testsuite/lib/asan-dg.exp b/gcc/testsuite/lib/asan-dg.exp
index 35e60eaaed5..157b60908d6 100644
--- a/gcc/testsuite/lib/asan-dg.exp
+++ b/gcc/testsuite/lib/asan-dg.exp
@@ -78,7 +78,7 @@ proc asan_link_flags_1 { paths lib } {
|| [file exists "${gccpath}/libsanitizer/${lib}/.libs/lib${lib}.${shlib_ext}"] } {
append flags " -B${gccpath}/libsanitizer/ "
append flags " -B${gccpath}/libsanitizer/${lib}/ "
- append flags " -L${gccpath}/libsanitizer/${lib}/.libs "
+ append flags " -B${gccpath}/libsanitizer/${lib}/.libs "
append ld_library_path ":${gccpath}/libsanitizer/${lib}/.libs"
}
} else {
diff --git a/gcc/testsuite/lib/atomic-dg.exp b/gcc/testsuite/lib/atomic-dg.exp
index 1589acd8eaf..ce1799cef2d 100644
--- a/gcc/testsuite/lib/atomic-dg.exp
+++ b/gcc/testsuite/lib/atomic-dg.exp
@@ -33,7 +33,7 @@ proc atomic_link_flags { paths } {
if { [file exists "${gccpath}/libatomic/.libs/libatomic.a"]
|| [file exists "${gccpath}/libatomic/.libs/libatomic.${shlib_ext}"] } {
append flags " -B${gccpath}/libatomic/ "
- append flags " -L${gccpath}/libatomic/.libs"
+ append flags " -B${gccpath}/libatomic/.libs"
append ld_library_path ":${gccpath}/libatomic/.libs"
}
} else {
diff --git a/gcc/testsuite/lib/target-libpath.exp b/gcc/testsuite/lib/target-libpath.exp
index 6d530fb4af6..5de039b4fc2 100644
--- a/gcc/testsuite/lib/target-libpath.exp
+++ b/gcc/testsuite/lib/target-libpath.exp
@@ -67,6 +67,7 @@ proc set_ld_library_path_env_vars { } {
global orig_dyld_library_path
global orig_path
global orig_gcc_exec_prefix
+ global ENABLE_DARWIN_AT_RPATH
global env
# Save the original GCC_EXEC_PREFIX.
@@ -133,6 +134,7 @@ proc set_ld_library_path_env_vars { } {
#
# Doing this is somewhat of a hack as ld_library_path gets repeated in
# SHLIB_PATH and LD_LIBRARY_PATH when unix_load sets these variables.
+ if { ![istarget *-*-darwin*] } {
if { $orig_ld_library_path_saved } {
setenv LD_LIBRARY_PATH "$ld_library_path:$orig_ld_library_path"
} else {
@@ -166,11 +168,23 @@ proc set_ld_library_path_env_vars { } {
} else {
setenv LD_LIBRARY_PATH_64 "$ld_library_path"
}
- if { $orig_dyld_library_path_saved } {
- setenv DYLD_LIBRARY_PATH "$ld_library_path:$orig_dyld_library_path"
- } else {
- setenv DYLD_LIBRARY_PATH "$ld_library_path"
}
+ if { [istarget *-*-darwin*] } {
+ if { [info exists ENABLE_DARWIN_AT_RPATH] || [istarget *-*-darwin1\[5-9\]*]
+ || [istarget *-*-darwin20*] } {
+ # Either we are not using DYLD_LIBRARY_PATH or we're on a version of the
+ # OS for which it is not passed through system exes.
+ if [info exists env(DYLD_LIBRARY_PATH)] {
+ unsetenv DYLD_LIBRARY_PATH
+ }
+ } else {
+ if { $orig_dyld_library_path_saved } {
+ setenv DYLD_LIBRARY_PATH "$ld_library_path:$orig_dyld_library_path"
+ } else {
+ setenv DYLD_LIBRARY_PATH "$ld_library_path"
+ }
+ }
+ }
if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } {
if { $orig_path_saved } {
setenv PATH "$ld_library_path:$orig_path"
@@ -179,6 +193,7 @@ proc set_ld_library_path_env_vars { } {
}
}
+ verbose -log "set paths"
verbose -log "LD_LIBRARY_PATH=[getenv LD_LIBRARY_PATH]"
verbose -log "LD_RUN_PATH=[getenv LD_RUN_PATH]"
verbose -log "SHLIB_PATH=[getenv SHLIB_PATH]"
diff --git a/libatomic/testsuite/lib/libatomic.exp b/libatomic/testsuite/lib/libatomic.exp
index 10f38475bc8..c6d645e9ae3 100644
--- a/libatomic/testsuite/lib/libatomic.exp
+++ b/libatomic/testsuite/lib/libatomic.exp
@@ -148,11 +148,15 @@ proc libatomic_init { args } {
if { $blddir != "" } {
lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/"
lappend ALWAYS_CFLAGS "additional_flags=-I${blddir}"
- lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs"
+ if [istarget *-*-darwin*] {
+ lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/.libs"
+ } else {
+ lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs"
+ }
}
lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/.."
- if [istarget *-*-darwin*] {
+ if [istarget *-*-darwin\[89\]*] {
lappend ALWAYS_CFLAGS "additional_flags=-shared-libgcc"
}
diff --git a/libffi/testsuite/lib/libffi.exp b/libffi/testsuite/lib/libffi.exp
index 15d3d5ebd73..611f5177c7a 100644
--- a/libffi/testsuite/lib/libffi.exp
+++ b/libffi/testsuite/lib/libffi.exp
@@ -337,8 +337,13 @@ proc libffi-init { args } {
verbose "libffi_dir $libffi_dir"
if { $libffi_dir != "" } {
set libffi_dir [file dirname ${libffi_dir}]
- set libffi_link_flags "-L${libffi_dir}/.libs"
- lappend libffi_link_flags "-L${blddircxx}/src/.libs"
+ if [istarget *-*-darwin*] {
+ set libffi_link_flags "-B${libffi_dir}/.libs"
+ lappend libffi_link_flags "-B${blddircxx}/src/.libs"
+ } else {
+ set libffi_link_flags "-L${libffi_dir}/.libs"
+ lappend libffi_link_flags "-L${blddircxx}/src/.libs"
+ }
}
set_ld_library_path_env_vars
@@ -382,7 +387,7 @@ proc libffi_target_compile { source dest type options } {
# Darwin needs a stack execution allowed flag.
if { [istarget "*-*-darwin9*"] || [istarget "*-*-darwin1*"]
- || [istarget "*-*-darwin2*"] } {
+ || [istarget "x86_64-*-darwin2*"] } {
lappend options "additional_flags=-Wl,-allow_stack_execute"
lappend options "additional_flags=-Wl,-search_paths_first"
}
diff --git a/libitm/testsuite/lib/libitm.exp b/libitm/testsuite/lib/libitm.exp
index da918d1ee8d..61bbfa0c923 100644
--- a/libitm/testsuite/lib/libitm.exp
+++ b/libitm/testsuite/lib/libitm.exp
@@ -159,6 +159,7 @@ proc libitm_init { args } {
}
if [istarget *-*-darwin*] {
+ lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/.libs"
lappend ALWAYS_CFLAGS "additional_flags=-shared-libgcc"
}
diff --git a/libitm/testsuite/libitm.c++/c++.exp b/libitm/testsuite/libitm.c++/c++.exp
index de45e7e5480..1b0ead05fee 100644
--- a/libitm/testsuite/libitm.c++/c++.exp
+++ b/libitm/testsuite/libitm.c++/c++.exp
@@ -56,8 +56,10 @@ if { $lang_test_file_found } {
# Gather a list of all tests.
set tests [lsort [glob -nocomplain $srcdir/$subdir/*.C]]
+ set stdcxxadder ""
if { $blddir != "" } {
set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
+ set stdcxxadder "-B ${blddir}/${lang_library_path}"
} else {
set ld_library_path "$always_ld_library_path"
}
@@ -72,7 +74,7 @@ if { $lang_test_file_found } {
}
# Main loop.
- dg-runtest $tests "" $libstdcxx_includes
+ dg-runtest $tests $stdcxxadder $libstdcxx_includes
}
# All done.
--
2.39.2 (Apple Git-143)
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-08-15 16:58 Darwin: Replace environment runpath with embedded [PR88590] FX Coudert
@ 2023-08-18 20:17 ` Joseph Myers
2023-08-18 22:31 ` Iain Sandoe
2023-08-25 7:50 ` FX Coudert
2023-10-30 16:17 ` Martin Jambor
` (2 subsequent siblings)
3 siblings, 2 replies; 39+ messages in thread
From: Joseph Myers @ 2023-08-18 20:17 UTC (permalink / raw)
To: FX Coudert; +Cc: gcc-patches, Iain Sandoe
On Tue, 15 Aug 2023, FX Coudert via Gcc-patches wrote:
> I am currently retesting the patches on various archs (Linux and Darwin)
> after a final rebase, but various previous versions were
> regression-tested, and have been shipped for a long time in Homebrew.
>
> OK to commit?
The driver changes are OK.
I think the new configure options and the new -nodefaultrpaths compiler
option need documenting (I suppose there might be a case for the configure
option defined in libtool code being documented somewhere in libtool, if
there's somewhere appropriate, but I don't see that in the libtool patch
submission).
The help text for --enable-darwin-at-rpath refers to it as
--enable-darwin-at-path.
Somewhere the documentation ought to discuss the considerations around
embedding such paths in binaries, and what's appropriate for building a
binary on the system where it's going to be used, versus using the
compiler to build redistributed binaries that will be run on a system that
doesn't have the compiler installed (and so shouldn't have hardcoded paths
that were only applicable on the system with the compiler, but will need
to be able to find shared libraries - probably shipped with the binary -
somehow).
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-08-18 20:17 ` Joseph Myers
@ 2023-08-18 22:31 ` Iain Sandoe
2023-08-18 22:59 ` Joseph Myers
2023-08-25 7:50 ` FX Coudert
1 sibling, 1 reply; 39+ messages in thread
From: Iain Sandoe @ 2023-08-18 22:31 UTC (permalink / raw)
To: Joseph Myers; +Cc: FX Coudert, GCC Patches
Hi Joseph,
> On 18 Aug 2023, at 21:17, Joseph Myers <joseph@codesourcery.com> wrote:
>
> On Tue, 15 Aug 2023, FX Coudert via Gcc-patches wrote:
>
>> I am currently retesting the patches on various archs (Linux and Darwin)
>> after a final rebase, but various previous versions were
>> regression-tested, and have been shipped for a long time in Homebrew.
>>
>> OK to commit?
>
> The driver changes are OK.
>
> I think the new configure options and the new -nodefaultrpaths compiler
> option need documenting (I suppose there might be a case for the configure
> option defined in libtool code being documented somewhere in libtool, if
> there's somewhere appropriate, but I don't see that in the libtool patch
> submission).
>
> The help text for --enable-darwin-at-rpath refers to it as
> --enable-darwin-at-path.
OK, we need to fix those things.
> Somewhere the documentation ought to discuss the considerations around
> embedding such paths in binaries, and what's appropriate for building a
> binary on the system where it's going to be used, versus using the
> compiler to build redistributed binaries that will be run on a system that
> doesn't have the compiler installed (and so shouldn't have hardcoded paths
> that were only applicable on the system with the compiler, but will need
> to be able to find shared libraries - probably shipped with the binary -
> somehow).
Actually, the changes are not so dramatic as they seem (for Darwin) since we
already have less flexibility than other unix-like systems.
The status quo is that installed libraries embed their runpath e.g:
/path/to/compiler/install/lib/libgfortran.dylib
When executables are built, they embed the full library names for dependent
libraries (this "two-level" namespacing has some useful and not-so-useful
sides to it).
However, Darwin compiler installations are not relocatable without re-writing the
library names and, because of the vendor’s decision to neuter
DYLD_LIBRARY_PATH, (the Darwin equivalent of LD_LIBRARY_PATH) it makes
it quite involved to do such a move.
===
After the change:
libraries are identified as @rpath/libgfortran.dylib (for example)
and any executable built by the compiler has a runpath /path/to/compiler/install/lib.
Actually, after this change the compiler is initially relocatable (that is you can choose to
install it anywhere) but once installed, if you move it, that would break executables already
built because they embed the path to the installation.
So, in practice, for the “out of the tin” self-use of GCC, there is no practical difference between
the existing fixed installation and a “placed once” installation.
[however, the change means that we can correctly configure the compiler, since the runpaths
at build time can be made to point to the uninstalled libraries, which is the underlying problem
we are solving].
— on the topic of building applications for distribution:
The expectation for Darwin platforms is that dependent libraries are shipped along with
applications (it is not desirable to require that end users have to have elevated privs to
install them in some Well Known Place, and [other than OSS distributions like macports
and homebrew] there is no common place to expect to find OSS libraries).
There is quite extensive Apple Developer documentation on delivering packages with
co-installed libraries using @rpath (that is the intended mechanism for delivery since it
allows drag-and-drop installation and moving of built applications).
The revised compiler has libraries already built in a suitable manner for that distribution
model.
I would not propose that we repeated such information - but we could refer to it?
Generally, I’d prefer we suggested searching for such documentation, rather than linking
to it, since links can expire - does that seem reasonable?
thanks for the reviews
Iain
> --
> Joseph S. Myers
> joseph@codesourcery.com
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-08-18 22:31 ` Iain Sandoe
@ 2023-08-18 22:59 ` Joseph Myers
2023-08-18 23:05 ` Iain Sandoe
0 siblings, 1 reply; 39+ messages in thread
From: Joseph Myers @ 2023-08-18 22:59 UTC (permalink / raw)
To: Iain Sandoe; +Cc: FX Coudert, GCC Patches
[-- Attachment #1: Type: text/plain, Size: 952 bytes --]
On Fri, 18 Aug 2023, Iain Sandoe via Gcc-patches wrote:
> There is quite extensive Apple Developer documentation on delivering
> packages with co-installed libraries using @rpath (that is the intended
> mechanism for delivery since it allows drag-and-drop installation and
> moving of built applications).
>
> The revised compiler has libraries already built in a suitable manner
> for that distribution model.
>
> I would not propose that we repeated such information - but we could
> refer to it?
>
> Generally, I’d prefer we suggested searching for such documentation,
> rather than linking to it, since links can expire - does that seem
> reasonable?
I suppose the key thing is to note that, if building a program for
distribution, you shouldn't build it to embed
/path/to/compiler/install/lib, but instead should do <something else,
possibly referring to relevant Apple documentation>.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-08-18 22:59 ` Joseph Myers
@ 2023-08-18 23:05 ` Iain Sandoe
0 siblings, 0 replies; 39+ messages in thread
From: Iain Sandoe @ 2023-08-18 23:05 UTC (permalink / raw)
To: Joseph Myers; +Cc: FX Coudert, GCC Patches
> On 18 Aug 2023, at 23:59, Joseph Myers <joseph@codesourcery.com> wrote:
>
> On Fri, 18 Aug 2023, Iain Sandoe via Gcc-patches wrote:
>
>> There is quite extensive Apple Developer documentation on delivering
>> packages with co-installed libraries using @rpath (that is the intended
>> mechanism for delivery since it allows drag-and-drop installation and
>> moving of built applications).
>>
>> The revised compiler has libraries already built in a suitable manner
>> for that distribution model.
>>
>> I would not propose that we repeated such information - but we could
>> refer to it?
>>
>> Generally, I’d prefer we suggested searching for such documentation,
>> rather than linking to it, since links can expire - does that seem
>> reasonable?
>
> I suppose the key thing is to note that, if building a program for
> distribution, you shouldn't build it to embed
> /path/to/compiler/install/lib, but instead should do <something else,
> possibly referring to relevant Apple documentation>.
right, exactly - there are special runpath roots like @executable_path and
@loader_path that provide for packages that are fully relocatable (we
actually use some of this to allow GCC runtimes to find their dependent
runtimes without needing an absolute runpath).
OK. We just need to find a suitable place to put this - perhaps in documenting
-nodefaultrpaths (since that’s usually used together with specifying something
different).
thanks,
Iain
>
> --
> Joseph S. Myers
> joseph@codesourcery.com
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-08-18 20:17 ` Joseph Myers
2023-08-18 22:31 ` Iain Sandoe
@ 2023-08-25 7:50 ` FX Coudert
2023-08-25 16:28 ` Joseph Myers
1 sibling, 1 reply; 39+ messages in thread
From: FX Coudert @ 2023-08-25 7:50 UTC (permalink / raw)
To: Joseph Myers; +Cc: GCC Patches, Iain Sandoe
[-- Attachment #1: Type: text/plain, Size: 969 bytes --]
Hi,
Thanks Joseph for the review.
> The driver changes are OK.
>
> I think the new configure options and the new -nodefaultrpaths compiler
> option need documenting
Doc patch was added, and okay’ed by Iain.
> (I suppose there might be a case for the configure
> option defined in libtool code being documented somewhere in libtool, if
> there's somewhere appropriate, but I don't see that in the libtool patch
> submission).
I will follow up with that when I ping upstream libtool, in a couple of weeks.
> The help text for --enable-darwin-at-rpath refers to it as
> --enable-darwin-at-path.
Fixed, and everything regenerated. Also, I removed a bit of historical dead-code (inside #ifdef RPATH_SETS_NODEFAULT, where RPATH_SETS_NODEFAULT was not defined anymore in the last version of the patch).
Attached is the final patchset. Joseph, is your previous OK good for pushing, or does it need further review?
Thanks,
FX
[-- Attachment #2: 0001-Driver-Provide-a-spec-to-insert-rpaths-for-compiler-.patch --]
[-- Type: application/octet-stream, Size: 3936 bytes --]
From 9478bc5bd8a16411000a1d2933fae3ff8a8b6af1 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Thu, 20 Dec 2018 09:00:38 +0000
Subject: [PATCH 1/5] Driver: Provide a spec to insert rpaths for compiler lib
dirs.
This provides a spec to insert "-rpath DDD" for each DDD corresponding
to a compiler startfile directory. This allows a target to use @rpath
as the install path for libraries, and have the compiler provide the
necessary rpath to handle this.
Embed real paths, not relative ones.
We embed a runpath for every path in which libraries might be found. This
change ensures that we embed the actual real path and not a relative one from
the compiler's version-specific directory.
e.g.
/opt/distro/gcc-11-3Dr0/lib
instead of:
/opt/distro/gcc-11-3Dr0/lib/gcc/x86_64-apple-darwin19/11.3.0/../../..
This ensures that if we install, for example, 11.4.0 (and delete the 11.3.0
installation) exes built by 11.3 would continue to function (providing, of course
that 11.4 does not bump any SO names).
gcc/ChangeLog:
* gcc.cc (RUNPATH_OPTION): New.
(do_spec_1): Provide '%P' as a spec to insert rpaths for
each compiler startfile path.
---
gcc/gcc.cc | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index fdfac0b4fe4..7c6e4879a31 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -579,6 +579,7 @@ or with constant text in a single argument.
%l process LINK_SPEC as a spec.
%L process LIB_SPEC as a spec.
%M Output multilib_os_dir.
+ %P Output a RUNPATH_OPTION for each directory in startfile_prefixes.
%G process LIBGCC_SPEC as a spec.
%R Output the concatenation of target_system_root and
target_sysroot_suffix.
@@ -1182,6 +1183,10 @@ proper position among the other output files. */
# define SYSROOT_HEADERS_SUFFIX_SPEC ""
#endif
+#ifndef RUNPATH_OPTION
+# define RUNPATH_OPTION "-rpath"
+#endif
+
static const char *asm_debug = ASM_DEBUG_SPEC;
static const char *asm_debug_option = ASM_DEBUG_OPTION_SPEC;
static const char *cpp_spec = CPP_SPEC;
@@ -5925,6 +5930,7 @@ struct spec_path_info {
size_t append_len;
bool omit_relative;
bool separate_options;
+ bool realpaths;
};
static void *
@@ -5934,6 +5940,16 @@ spec_path (char *path, void *data)
size_t len = 0;
char save = 0;
+ /* The path must exist; we want to resolve it to the realpath so that this
+ can be embedded as a runpath. */
+ if (info->realpaths)
+ path = lrealpath (path);
+
+ /* However, if we failed to resolve it - perhaps because there was a bogus
+ -B option on the command line, then punt on this entry. */
+ if (!path)
+ return NULL;
+
if (info->omit_relative && !IS_ABSOLUTE_PATH (path))
return NULL;
@@ -6165,6 +6181,22 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
info.omit_relative = false;
#endif
info.separate_options = false;
+ info.realpaths = false;
+
+ for_each_path (&startfile_prefixes, true, 0, spec_path, &info);
+ }
+ break;
+
+ case 'P':
+ {
+ struct spec_path_info info;
+
+ info.option = RUNPATH_OPTION;
+ info.append_len = 0;
+ info.omit_relative = false;
+ info.separate_options = true;
+ /* We want to embed the actual paths that have the libraries. */
+ info.realpaths = true;
for_each_path (&startfile_prefixes, true, 0, spec_path, &info);
}
@@ -6491,6 +6523,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
info.append_len = strlen (info.append);
info.omit_relative = false;
info.separate_options = true;
+ info.realpaths = false;
for_each_path (&include_prefixes, false, info.append_len,
spec_path, &info);
--
2.34.1
[-- Attachment #3: 0002-Darwin-Allow-for-configuring-Darwin-to-use-embedded-.patch --]
[-- Type: application/octet-stream, Size: 279667 bytes --]
From ed388176f33336d2875611be18c02be44c60324c Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Sun, 28 Mar 2021 14:48:17 +0100
Subject: [PATCH 2/5] Darwin: Allow for configuring Darwin to use embedded
runpath.
Recent Darwin versions place contraints on the use of run paths
specified in environment variables. This breaks some assumptions
in the GCC build.
This change allows the user to configure a Darwin build to use
'@rpath/libraryname.dylib' in library names and then to add an
embedded runpath to executables (and libraries with dependents).
The embedded runpath is added by default unless the user adds
'-nodefaultrpaths' to the link line.
For an installed compiler, it means that any executable built with
that compiler will reference the runtimes installed with the
compiler (equivalent to hard-coding the library path into the name
of the library).
During build-time configurations any "-B" entries will be added to
the runpath thus the newly-built libraries will be found by exes.
Since the install name is set in libtool, that decision needs to be
available here (but might also cause dependent ones in Makefiles,
so we need to export a conditional).
This facility is not available for Darwin 8 or earlier, however the
existing environment variable runpath does work there.
We default this on for systems where the external DYLD_LIBRARY_PATH
does not work and off for Darwin 8 or earlier. For systems that can
use either method, if the value is unset, we use the default (which
is currently DYLD_LIBRARY_PATH).
ChangeLog:
* configure: Regenerate.
* configure.ac: Do not add default runpaths to GCC exes
when we are building -static-libstdc++/-static-libgcc (the
default).
* libtool.m4: Add 'enable-darwin-at-runpath'. Act on the
enable flag to alter Darwin libraries to use @rpath names.
gcc/ChangeLog:
* aclocal.m4: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
* config/darwin.h: Handle Darwin rpaths.
* config/darwin.opt: Handle Darwin rpaths.
* Makefile.in: Handle Darwin rpaths.
gcc/ada/ChangeLog:
* gcc-interface/Makefile.in: Handle Darwin rpaths.
gcc/jit/ChangeLog:
* Make-lang.in: Handle Darwin rpaths.
libatomic/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libbacktrace/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libcc1/ChangeLog:
* configure: Regenerate.
libffi/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
libgcc/ChangeLog:
* config/t-slibgcc-darwin: Generate libgcc_s
with an @rpath name.
* config.host: Handle Darwin rpaths.
libgfortran/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths
libgm2/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* aclocal.m4: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
* libm2cor/Makefile.am: Handle Darwin rpaths.
* libm2cor/Makefile.in: Regenerate.
* libm2iso/Makefile.am: Handle Darwin rpaths.
* libm2iso/Makefile.in: Regenerate.
* libm2log/Makefile.am: Handle Darwin rpaths.
* libm2log/Makefile.in: Regenerate.
* libm2min/Makefile.am: Handle Darwin rpaths.
* libm2min/Makefile.in: Regenerate.
* libm2pim/Makefile.am: Handle Darwin rpaths.
* libm2pim/Makefile.in: Regenerate.
libgomp/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths
libitm/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libobjc/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libphobos/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
* libdruntime/Makefile.am: Handle Darwin rpaths.
* libdruntime/Makefile.in: Regenerate.
* src/Makefile.am: Handle Darwin rpaths.
* src/Makefile.in: Regenerate.
libquadmath/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libsanitizer/ChangeLog:
* asan/Makefile.am: Handle Darwin rpaths.
* asan/Makefile.in: Regenerate.
* configure: Regenerate.
* hwasan/Makefile.am: Handle Darwin rpaths.
* hwasan/Makefile.in: Regenerate.
* lsan/Makefile.am: Handle Darwin rpaths.
* lsan/Makefile.in: Regenerate.
* tsan/Makefile.am: Handle Darwin rpaths.
* tsan/Makefile.in: Regenerate.
* ubsan/Makefile.am: Handle Darwin rpaths.
* ubsan/Makefile.in: Regenerate.
libssp/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libstdc++-v3/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
* src/Makefile.am: Handle Darwin rpaths.
* src/Makefile.in: Regenerate.
libvtv/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
lto-plugin/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
zlib/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
---
configure | 14 ++
configure.ac | 14 ++
gcc/Makefile.in | 11 +-
gcc/aclocal.m4 | 50 +++++++
gcc/ada/gcc-interface/Makefile.in | 5 +-
gcc/config/darwin.h | 32 ++++-
gcc/config/darwin.opt | 4 +
gcc/configure | 133 ++++++++++++++++--
gcc/configure.ac | 2 +
gcc/jit/Make-lang.in | 2 +-
libatomic/Makefile.am | 7 +-
libatomic/Makefile.in | 7 +-
libatomic/configure | 76 ++++++++++-
libatomic/configure.ac | 2 +
libbacktrace/configure | 76 ++++++++++-
libbacktrace/configure.ac | 2 +
libcc1/configure | 118 ++++++++++++++--
libffi/Makefile.am | 7 +-
libffi/Makefile.in | 6 +-
libffi/configure | 132 ++++++++++++++++--
libffi/configure.ac | 1 +
libffi/doc/version.texi | 4 +-
libgcc/config.host | 23 +++-
libgcc/config/t-darwin-rpath | 2 +
libgcc/config/t-slibgcc-darwin | 28 ++--
libgfortran/Makefile.am | 7 +-
libgfortran/Makefile.in | 28 ++--
libgfortran/configure | 131 ++++++++++++++++--
libgfortran/configure.ac | 6 +-
libgm2/Makefile.am | 9 +-
libgm2/Makefile.in | 15 +-
libgm2/aclocal.m4 | 10 +-
libgm2/configure | 145 ++++++++++++++++++--
libgm2/configure.ac | 6 +-
libgm2/libm2cor/Makefile.am | 4 +
libgm2/libm2cor/Makefile.in | 17 ++-
libgm2/libm2iso/Makefile.am | 4 +
libgm2/libm2iso/Makefile.in | 17 ++-
libgm2/libm2log/Makefile.am | 3 +
libgm2/libm2log/Makefile.in | 17 ++-
libgm2/libm2min/Makefile.am | 3 +
libgm2/libm2min/Makefile.in | 17 ++-
libgm2/libm2pim/Makefile.am | 3 +
libgm2/libm2pim/Makefile.in | 17 ++-
libgo/configure | 18 ++-
libgo/configure.ac | 1 +
libgomp/Makefile.am | 7 +-
libgomp/Makefile.in | 5 +-
libgomp/configure | 126 ++++++++++++++++-
libgomp/configure.ac | 1 +
libitm/Makefile.am | 7 +-
libitm/Makefile.in | 7 +-
libitm/configure | 132 ++++++++++++++++--
libitm/configure.ac | 1 +
libobjc/configure | 112 ++++++++++++---
libobjc/configure.ac | 36 +++--
libphobos/configure | 126 ++++++++++++++++-
libphobos/configure.ac | 1 +
libphobos/libdruntime/Makefile.am | 5 +-
libphobos/libdruntime/Makefile.in | 3 +-
libphobos/src/Makefile.am | 5 +-
libphobos/src/Makefile.in | 3 +-
libquadmath/Makefile.am | 7 +-
libquadmath/Makefile.in | 5 +-
libquadmath/configure | 218 +++++++++++++++++++++++++++++-
libquadmath/configure.ac | 3 +
libsanitizer/asan/Makefile.am | 7 +-
libsanitizer/asan/Makefile.in | 7 +-
libsanitizer/configure | 133 ++++++++++++++++--
libsanitizer/configure.ac | 2 +
libsanitizer/hwasan/Makefile.am | 6 +-
libsanitizer/hwasan/Makefile.in | 5 +-
libsanitizer/lsan/Makefile.am | 8 +-
libsanitizer/lsan/Makefile.in | 8 +-
libsanitizer/tsan/Makefile.am | 6 +-
libsanitizer/tsan/Makefile.in | 5 +-
libsanitizer/ubsan/Makefile.am | 7 +-
libsanitizer/ubsan/Makefile.in | 7 +-
libssp/Makefile.am | 6 +-
libssp/Makefile.in | 5 +-
libssp/configure | 76 ++++++++++-
libssp/configure.ac | 2 +
libstdc++-v3/configure | 144 ++++++++++++++++++--
libstdc++-v3/configure.ac | 1 +
libstdc++-v3/src/Makefile.am | 7 +-
libstdc++-v3/src/Makefile.in | 5 +-
libtool.m4 | 57 +++++++-
libvtv/configure | 132 ++++++++++++++++--
libvtv/configure.ac | 1 +
lto-plugin/configure | 75 +++++++++-
lto-plugin/configure.ac | 1 +
zlib/configure | 75 +++++++++-
zlib/configure.ac | 1 +
94 files changed, 2557 insertions(+), 280 deletions(-)
create mode 100644 libgcc/config/t-darwin-rpath
diff --git a/configure b/configure
index 28f0913bdd4..28e25bf7162 100755
--- a/configure
+++ b/configure
@@ -8492,6 +8492,20 @@ else
fi
fi
+case $target in
+ *-darwin2* | *-darwin1[56789]*)
+ # For these versions, we default to using embedded rpaths.
+ if test "x$enable_darwin_at_rpath" != "xno"; then
+ poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths"
+ fi
+ ;;
+ *-darwin*)
+ # For these versions, we only use embedded rpaths on demand.
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths"
+ fi
+ ;;
+esac
# GCC GRAPHITE dependency isl.
diff --git a/configure.ac b/configure.ac
index 5d25dc864c3..49c237bb8b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1855,6 +1855,20 @@ AC_ARG_WITH(boot-ldflags,
if test "$poststage1_libs" = ""; then
poststage1_ldflags="-static-libstdc++ -static-libgcc"
fi])
+case $target in
+ *-darwin2* | *-darwin1[[56789]]*)
+ # For these versions, we default to using embedded rpaths.
+ if test "x$enable_darwin_at_rpath" != "xno"; then
+ poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths"
+ fi
+ ;;
+ *-darwin*)
+ # For these versions, we only use embedded rpaths on demand.
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths"
+ fi
+ ;;
+esac
AC_SUBST(poststage1_ldflags)
# GCC GRAPHITE dependency isl.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 78779546459..60ba2916457 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1193,6 +1193,8 @@ LANG_MAKEFRAGS = @all_lang_makefrags@
# Used by gcc/jit/Make-lang.in
LD_VERSION_SCRIPT_OPTION = @ld_version_script_option@
LD_SONAME_OPTION = @ld_soname_option@
+@ENABLE_DARWIN_AT_RPATH_TRUE@DARWIN_RPATH = @rpath
+@ENABLE_DARWIN_AT_RPATH_FALSE@DARWIN_RPATH = ${libdir}
# Flags to pass to recursive makes.
# CC is set by configure.
@@ -2014,9 +2016,12 @@ cs-tconfig.h: Makefile
$(SHELL) $(srcdir)/mkconfig.sh tconfig.h
cs-tm.h: Makefile
- TARGET_CPU_DEFAULT="$(target_cpu_default)" \
- HEADERS="$(tm_include_list)" DEFINES="$(tm_defines)" \
- $(SHELL) $(srcdir)/mkconfig.sh tm.h
+@ENABLE_DARWIN_AT_RPATH_FALSE@ TARGET_CPU_DEFAULT="$(target_cpu_default)" \
+@ENABLE_DARWIN_AT_RPATH_FALSE@ HEADERS="$(tm_include_list)" DEFINES="$(tm_defines)" \
+@ENABLE_DARWIN_AT_RPATH_FALSE@ $(SHELL) $(srcdir)/mkconfig.sh tm.h
+@ENABLE_DARWIN_AT_RPATH_TRUE@ TARGET_CPU_DEFAULT="$(target_cpu_default)" \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ HEADERS="$(tm_include_list)" DEFINES="$(tm_defines) DARWIN_AT_RPATH=1" \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ $(SHELL) $(srcdir)/mkconfig.sh tm.h
cs-tm_p.h: Makefile
TARGET_CPU_DEFAULT="" \
diff --git a/gcc/aclocal.m4 b/gcc/aclocal.m4
index 6be36df5190..126e09bbcd1 100644
--- a/gcc/aclocal.m4
+++ b/gcc/aclocal.m4
@@ -12,6 +12,56 @@
# PARTICULAR PURPOSE.
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ([2.52])dnl
+ m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 2006-2017 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# --------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
m4_include([../libtool.m4])
m4_include([../ltoptions.m4])
m4_include([../ltsugar.m4])
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index b5243a24a8f..ad7cf5072e5 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -794,12 +794,15 @@ gnatlib-shared-darwin:
$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
$(SO_OPTS) \
-Wl,-install_name,@rpath/libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
- $(MISCLIB)
+ -nodefaultrpaths -Wl,-rpath,@loader_path/,-rpath,@loader_path/.. \
+ -Wl,-rpath,@loader_path/../../../../ $(MISCLIB)
cd $(RTSDIR); $(GCC_FOR_ADA_RTS) -dynamiclib $(PICFLAG_FOR_TARGET) \
-o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
$(GNATRTL_TASKING_OBJS) \
$(SO_OPTS) \
-Wl,-install_name,@rpath/libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ -nodefaultrpaths -Wl,-rpath,@loader_path/,-rpath,@loader_path/.. \
+ -Wl,-rpath,@loader_path/../../../../ \
$(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
cd $(RTSDIR); $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
libgnat$(soext)
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index e0e8672a455..44c92db6214 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -309,6 +309,18 @@ extern GTY(()) int darwin_ms_struct;
#define DARWIN_CC1_SPEC \
"%<dynamic %<dynamiclib %<force_cpusubtype_ALL %<multiply_defined* "
+/* When we are using embedded runpaths DARWIN_AT_RPATH is set. */
+#if DARWIN_AT_RPATH
+# define DARWIN_RPATH_LINK \
+"%{!r:%{!nostdlib:%{!nodefaultrpaths:%(darwin_rpaths)}}}"
+# define DARWIN_SHARED_LIBGCC "-lgcc_s.1.1"
+#else
+# define DARWIN_RPATH_LINK ""
+# define DARWIN_SHARED_LIBGCC \
+"%:version-compare(!> 10.11 mmacosx-version-min= -lgcc_s.1.1) \
+ %:version-compare(>= 10.11 mmacosx-version-min= -lemutls_w) "
+#endif
+
#define SUBSUBTARGET_OVERRIDE_OPTIONS \
do { \
darwin_override_options (); \
@@ -403,7 +415,8 @@ extern GTY(()) int darwin_ms_struct;
DARWIN_NOPIE_SPEC \
DARWIN_RDYNAMIC \
DARWIN_NOCOMPACT_UNWIND \
- "}}}}}}} %<pie %<no-pie %<rdynamic %<X %<rpath "
+ DARWIN_RPATH_LINK \
+ "}}}}}}} %<pie %<no-pie %<rdynamic %<X %<rpath %<nodefaultrpaths "
/* Spec that controls whether the debug linker is run automatically for
a link step. This needs to be done if there is a source file on the
@@ -518,8 +531,7 @@ extern GTY(()) int darwin_ms_struct;
%:version-compare(!> 10.6 mmacosx-version-min= -lgcc_eh) \
%:version-compare(>= 10.6 mmacosx-version-min= -lemutls_w); \
shared-libgcc|fexceptions|fobjc-exceptions|fgnu-runtime: \
- %:version-compare(!> 10.11 mmacosx-version-min= -lgcc_s.1.1) \
- %:version-compare(>= 10.11 mmacosx-version-min= -lemutls_w) \
+ " DARWIN_SHARED_LIBGCC " \
%:version-compare(!> 10.3.9 mmacosx-version-min= -lgcc_eh) \
%:version-compare(>< 10.3.9 10.5 mmacosx-version-min= -lgcc_s.10.4) \
%:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5); \
@@ -554,7 +566,8 @@ extern GTY(()) int darwin_ms_struct;
{ "darwin_crt2", DARWIN_CRT2_SPEC }, \
{ "darwin_crt3", DARWIN_CRT3_SPEC }, \
{ "darwin_dylib1", DARWIN_DYLIB1_SPEC }, \
- { "darwin_bundle1", DARWIN_BUNDLE1_SPEC },
+ { "darwin_bundle1", DARWIN_BUNDLE1_SPEC }, \
+ { "darwin_rpaths", DARWIN_RPATH_SPEC },
#define DARWIN_CRT1_SPEC \
"%:version-compare(!> 10.5 mmacosx-version-min= -lcrt1.o) \
@@ -580,6 +593,17 @@ extern GTY(()) int darwin_ms_struct;
"%{!static:%:version-compare(< 10.6 mmacosx-version-min= -lbundle1.o) \
%{fgnu-tm: -lcrttms.o}}"
+#if DARWIN_AT_RPATH
+/* A default rpath, that picks up dependent libraries installed in the same
+ director as one being loaded. */
+#define DARWIN_RPATH_SPEC \
+ "%:version-compare(>= 10.5 mmacosx-version-min= -rpath) \
+ %:version-compare(>= 10.5 mmacosx-version-min= @loader_path) \
+ %P "
+#else
+#define DARWIN_RPATH_SPEC ""
+#endif
+
#ifdef HAVE_AS_MMACOSX_VERSION_MIN_OPTION
/* Emit macosx version (but only major). */
#define ASM_MMACOSX_VERSION_MIN_SPEC \
diff --git a/gcc/config/darwin.opt b/gcc/config/darwin.opt
index d655aaef2fb..ff624ffd82a 100644
--- a/gcc/config/darwin.opt
+++ b/gcc/config/darwin.opt
@@ -241,6 +241,10 @@ nodefaultexport
Driver RejectNegative
Do not add a default symbol exports to modules or dynamic libraries.
+nodefaultrpaths
+Driver RejectNegative
+Do not add default run paths (for the compiler library directories) to executables, modules or dynamic libraries.
+
nofixprebinding
Driver RejectNegative
(Obsolete after 10.3.9) Set MH_NOPREFIXBINDING, in an executable.
diff --git a/gcc/configure b/gcc/configure
index 07e8a64afbb..eaa1a189583 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -741,6 +741,8 @@ ORIGINAL_PLUGIN_LD_FOR_TARGET
gcc_cv_ld
ORIGINAL_AS_FOR_TARGET
gcc_cv_as
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_fast_install
objdir
OTOOL64
@@ -1006,6 +1008,7 @@ enable_static
with_pic
enable_fast_install
enable_libtool_lock
+enable_darwin_at_rpath
enable_ld
enable_gold
with_plugin_ld
@@ -1741,6 +1744,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-ld[=ARG] build ld [ARG={default,yes,no}]
--enable-gold[=ARG] build gold [ARG={default,yes,no}]
--enable-gnu-indirect-function
@@ -16356,7 +16362,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -18061,6 +18067,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -18078,9 +18127,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -19886,7 +19939,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19889 "configure"
+#line 19942 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -19992,7 +20045,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19995 "configure"
+#line 20048 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -20868,6 +20921,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -20885,12 +20981,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -23261,6 +23365,15 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# Identify the assembler which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the assembler
# which will be driven by the driver program.
@@ -32851,6 +32964,10 @@ LTLIBOBJS=$ac_ltlibobjs
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 62c31d8e02d..80e31229408 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2599,6 +2599,8 @@ AC_PROG_LIBTOOL
AC_SUBST(objdir)
AC_SUBST(enable_fast_install)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
# Identify the assembler which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the assembler
# which will be driven by the driver program.
diff --git a/gcc/jit/Make-lang.in b/gcc/jit/Make-lang.in
index a65f13853ae..3fd564a5932 100644
--- a/gcc/jit/Make-lang.in
+++ b/gcc/jit/Make-lang.in
@@ -59,7 +59,7 @@ LIBGCCJIT_AGE = 1
LIBGCCJIT_BASENAME = libgccjit
LIBGCCJIT_SONAME = \
- ${libdir}/$(LIBGCCJIT_BASENAME).$(LIBGCCJIT_VERSION_NUM).dylib
+ $(DARWIN_RPATH)/$(LIBGCCJIT_BASENAME).$(LIBGCCJIT_VERSION_NUM).dylib
LIBGCCJIT_FILENAME = $(LIBGCCJIT_BASENAME).$(LIBGCCJIT_VERSION_NUM).dylib
LIBGCCJIT_LINKER_NAME = $(LIBGCCJIT_BASENAME).dylib
diff --git a/libatomic/Makefile.am b/libatomic/Makefile.am
index c6c8d81c56a..d18738cd7e6 100644
--- a/libatomic/Makefile.am
+++ b/libatomic/Makefile.am
@@ -65,8 +65,13 @@ libatomic_version_script =
libatomic_version_dep =
endif
libatomic_version_info = -version-info $(libtool_VERSION)
+if ENABLE_DARWIN_AT_RPATH
+libatomic_darwin_rpath = -Wc,-nodefaultrpaths
+libatomic_darwin_rpath += -Wl,-rpath,@loader_path
+endif
-libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) $(lt_host_flags)
+libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) \
+ $(lt_host_flags) $(libatomic_darwin_rpath)
libatomic_la_SOURCES = gload.c gstore.c gcas.c gexch.c glfree.c lock.c init.c \
fenv.c fence.c flag.c
diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in
index 83efe7d2694..47425efae01 100644
--- a/libatomic/Makefile.in
+++ b/libatomic/Makefile.in
@@ -416,7 +416,12 @@ noinst_LTLIBRARIES = libatomic_convenience.la
@LIBAT_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@libatomic_version_dep = $(top_srcdir)/libatomic.map
@LIBAT_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@libatomic_version_dep = libatomic.map-sun
libatomic_version_info = -version-info $(libtool_VERSION)
-libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) $(lt_host_flags)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libatomic_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) \
+ $(lt_host_flags) $(libatomic_darwin_rpath)
+
libatomic_la_SOURCES = gload.c gstore.c gcas.c gexch.c glfree.c lock.c \
init.c fenv.c fence.c flag.c $(am__append_2)
SIZEOBJS = load store cas exch fadd fsub fand fior fxor fnand tas
diff --git a/libatomic/configure b/libatomic/configure
index 57f320753e1..dc5f4bca65e 100755
--- a/libatomic/configure
+++ b/libatomic/configure
@@ -658,6 +658,8 @@ OPT_LDFLAGS
SECTION_LDFLAGS
enable_aarch64_lse
libtool_VERSION
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
@@ -802,6 +804,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
enable_symvers
enable_werror
@@ -1451,6 +1454,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -7604,7 +7610,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9577,6 +9583,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9594,9 +9643,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11402,7 +11455,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11405 "configure"
+#line 11458 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11508,7 +11561,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11511 "configure"
+#line 11564 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11793,6 +11846,15 @@ fi
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=3:0:2
@@ -15920,6 +15982,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${LIBAT_BUILD_VERSIONED_SHLIB_TRUE}" && test -z "${LIBAT_BUILD_VERSIONED_SHLIB_FALSE}"; then
as_fn_error $? "conditional \"LIBAT_BUILD_VERSIONED_SHLIB\" was never defined.
diff --git a/libatomic/configure.ac b/libatomic/configure.ac
index 318b605a1d7..6919d212ae5 100644
--- a/libatomic/configure.ac
+++ b/libatomic/configure.ac
@@ -155,6 +155,8 @@ AC_SUBST(enable_shared)
AC_SUBST(enable_static)
AM_MAINTAINER_MODE
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=3:0:2
AC_SUBST(libtool_VERSION)
diff --git a/libbacktrace/configure b/libbacktrace/configure
index c3e7b884e36..0ccc060901d 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -681,6 +681,8 @@ PIC_FLAG
WARN_FLAGS
EXTRA_FLAGS
BACKTRACE_FILE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
OTOOL64
OTOOL
LIPO
@@ -805,6 +807,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_largefile
enable_cet
enable_werror
@@ -1453,6 +1456,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--disable-largefile omit support for large files
--enable-cet enable Intel CET in target libraries [default=auto]
--disable-werror disable building with -Werror
@@ -8048,7 +8054,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9754,6 +9760,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9771,9 +9820,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11579,7 +11632,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11582 "configure"
+#line 11635 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11685,7 +11738,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11688 "configure"
+#line 11741 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11924,6 +11977,15 @@ CC="$lt_save_CC"
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# Check whether --enable-largefile was given.
if test "${enable_largefile+set}" = set; then :
enableval=$enable_largefile;
@@ -14486,6 +14548,10 @@ if test -z "${HAVE_DWZ_TRUE}" && test -z "${HAVE_DWZ_FALSE}"; then
as_fn_error $? "conditional \"HAVE_DWZ\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${HAVE_ELF_TRUE}" && test -z "${HAVE_ELF_FALSE}"; then
as_fn_error $? "conditional \"HAVE_ELF\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac
index 72ff2b30053..71cd50f8cdf 100644
--- a/libbacktrace/configure.ac
+++ b/libbacktrace/configure.ac
@@ -84,6 +84,8 @@ AM_CONDITIONAL(HAVE_DWZ, test "$DWZ" != "")
LT_INIT
AM_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
AC_SYS_LARGEFILE
backtrace_supported=yes
diff --git a/libcc1/configure b/libcc1/configure
index 2a914a0bfc8..ea689a353c8 100755
--- a/libcc1/configure
+++ b/libcc1/configure
@@ -787,6 +787,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_cet
with_gcc_major_version_only
enable_werror_always
@@ -1439,6 +1440,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-cet enable Intel CET in host libraries [default=auto]
--enable-werror-always enable -Werror despite compiler version
--enable-plugin enable plugin support
@@ -7309,7 +7313,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9014,6 +9018,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9031,9 +9078,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -10839,7 +10890,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10842 "configure"
+#line 10893 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10945,7 +10996,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10948 "configure"
+#line 10999 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12227,6 +12278,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -12244,12 +12338,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
diff --git a/libffi/Makefile.am b/libffi/Makefile.am
index 2259ddb75f9..2c5b74df9ee 100644
--- a/libffi/Makefile.am
+++ b/libffi/Makefile.am
@@ -214,7 +214,12 @@ libffi.map: $(top_srcdir)/libffi.map.in
$(COMPILE) -D$(TARGET) -DGENERATE_LIBFFI_MAP \
-E -x assembler-with-cpp -o $@ $(top_srcdir)/libffi.map.in
-libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS)
+if ENABLE_DARWIN_AT_RPATH
+libffi_darwin_rpath = -Wl,-rpath,@loader_path
+endif
+libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) \
+ $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS) \
+ $(libffi_darwin_rpath)
libffi_la_DEPENDENCIES = $(libffi_la_LIBADD) $(libffi_version_dep)
AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
diff --git a/libffi/Makefile.in b/libffi/Makefile.in
index 1d936b5c8a5..71469f7d632 100644
--- a/libffi/Makefile.in
+++ b/libffi/Makefile.in
@@ -597,7 +597,11 @@ AM_CFLAGS = -Wall -g -fexceptions $(CET_FLAGS) $(am__append_2)
@LIBFFI_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBFFI_BUILD_VERSIONED_SHLIB_TRUE@libffi_version_dep = libffi.map
@LIBFFI_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBFFI_BUILD_VERSIONED_SHLIB_TRUE@libffi_version_dep = libffi.map-sun
libffi_version_info = -version-info `grep -v '^\#' $(srcdir)/libtool-version`
-libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libffi_darwin_rpath = -Wl,-rpath,@loader_path
+libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) \
+ $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS) \
+ $(libffi_darwin_rpath)
+
libffi_la_DEPENDENCIES = $(libffi_la_LIBADD) $(libffi_version_dep)
AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
AM_CCASFLAGS = $(AM_CPPFLAGS) $(CET_FLAGS)
diff --git a/libffi/configure b/libffi/configure
index 9eac9c907bf..29054551f7e 100755
--- a/libffi/configure
+++ b/libffi/configure
@@ -667,6 +667,8 @@ MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
READELF
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
CXXCPP
CPP
OTOOL64
@@ -810,6 +812,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
enable_pax_emutramp
enable_debug
@@ -1465,6 +1468,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -7835,7 +7841,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9809,6 +9815,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9826,9 +9875,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11634,7 +11687,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11637 "configure"
+#line 11690 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11740,7 +11793,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11743 "configure"
+#line 11796 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12616,6 +12669,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -12633,12 +12729,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15008,6 +15112,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# Only expand once:
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}readelf", so it can be a program name with args.
@@ -17153,6 +17265,10 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libffi/configure.ac b/libffi/configure.ac
index 014d89d0423..716f20ae313 100644
--- a/libffi/configure.ac
+++ b/libffi/configure.ac
@@ -55,6 +55,7 @@ AC_SUBST(CET_FLAGS)
AM_PROG_AS
AM_PROG_CC_C_O
AC_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
AC_CHECK_TOOL(READELF, readelf)
diff --git a/libffi/doc/version.texi b/libffi/doc/version.texi
index f2b741e87e4..6261b21fec9 100644
--- a/libffi/doc/version.texi
+++ b/libffi/doc/version.texi
@@ -1,4 +1,4 @@
-@set UPDATED 27 June 2021
-@set UPDATED-MONTH June 2021
+@set UPDATED 31 August 2022
+@set UPDATED-MONTH August 2022
@set EDITION 3.4.2
@set VERSION 3.4.2
diff --git a/libgcc/config.host b/libgcc/config.host
index c94d69d84b7..d40cf55acb6 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -233,7 +233,6 @@ case ${host} in
;;
esac
tmake_file="$tmake_file t-slibgcc-darwin"
- # newer toolsets produce warnings when building for unsupported versions.
case ${host} in
*-*-darwin1[89]* | *-*-darwin2* )
tmake_file="t-darwin-min-8 $tmake_file"
@@ -251,6 +250,28 @@ case ${host} in
echo "Warning: libgcc configured to support macOS 10.5" 1>&2
;;
esac
+ # We are not using libtool to build the libs here, so we need to replicate
+ # a little of the logic around setting Darwin rpaths. Setting an explicit
+ # yes or no is honoured, otherwise we choose a suitable default.
+ # Sadly, this has to be kept in line with the rules in libtool.m4.
+ # This make fragment will override the setting in t-slibgcc-darwin so it
+ # must appear after it.
+ if test "x$enable_darwin_at_rpath" = "x"; then
+ echo "enable_darwin_at_rpath is unset" 1>&2
+ case ${host} in
+ *-darwin[45678]*) ;;
+ *-darwin9* | *-darwin1[01234]*) ;; # We might default these on later.
+ *-darwin*)
+ echo "but is needed after macOS 10.11 (setting it on)" 1>&2
+ enable_darwin_at_rpath=yes
+ ;;
+ esac
+ else
+ echo "enable_darwin_at_rpath is '$enable_darwin_at_rpath'" 1>&2
+ fi
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ tmake_file="$tmake_file t-darwin-rpath "
+ fi
extra_parts="crt3.o libd10-uwfef.a crttms.o crttme.o libemutls_w.a"
;;
*-*-dragonfly*)
diff --git a/libgcc/config/t-darwin-rpath b/libgcc/config/t-darwin-rpath
new file mode 100644
index 00000000000..e73d7f378b0
--- /dev/null
+++ b/libgcc/config/t-darwin-rpath
@@ -0,0 +1,2 @@
+# Use @rpath and add a search path to exes and dylibs that depend on this.
+SHLIB_RPATH = @rpath
diff --git a/libgcc/config/t-slibgcc-darwin b/libgcc/config/t-slibgcc-darwin
index cb0cbbdb1c5..da4886848e8 100644
--- a/libgcc/config/t-slibgcc-darwin
+++ b/libgcc/config/t-slibgcc-darwin
@@ -1,4 +1,4 @@
-# Build a shared libgcc library with the darwin linker.
+# Build a shared libgcc library able to use embedded runpaths.
SHLIB_SOVERSION = 1.1
SHLIB_SO_MINVERSION = 1
@@ -6,7 +6,6 @@ SHLIB_VERSTRING = -compatibility_version $(SHLIB_SO_MINVERSION) \
-current_version $(SHLIB_SOVERSION)
SHLIB_EXT = .dylib
SHLIB_LC = -lSystem
-SHLIB_INSTALL_DIR = $(slibdir)
SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
SHLIB_MKMAP_OPTS = -v leading_underscore=1
@@ -23,11 +22,16 @@ SHLIB_SONAME = @shlib_base_name@$(SHLIB_EXT)
# subdir. The code under MULTIBUILDTOP combines these into a single FAT
# library, that is what we eventually install.
+# When enable_darwin_at_rpath is true, use @rpath instead of $(slibdir) for
+# this and dylibs that depend on this. So this def must come first and be
+# overridden in a make fragment that depends on the rpath setting.
+SHLIB_RPATH = $(slibdir)
+
SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) $(LDFLAGS) -dynamiclib -nodefaultlibs \
- -install_name $(SHLIB_INSTALL_DIR)/$(SHLIB_INSTALL_NAME) \
+ -install_name $(SHLIB_RPATH)/$(SHLIB_INSTALL_NAME) \
-single_module -o $(SHLIB_DIR)/$(SHLIB_SONAME) \
-Wl,-exported_symbols_list,$(SHLIB_MAP) \
- $(SHLIB_VERSTRING) \
+ $(SHLIB_VERSTRING) -nodefaultrpaths \
@multilib_flags@ @shlib_objs@ $(SHLIB_LC)
# we do our own thing
@@ -63,9 +67,9 @@ EHS_INSTNAME = libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT)
libgcc_ehs$(SHLIB_EXT): $(LIBEHSOBJS) $(extra-parts)
mkdir -p $(MULTIDIR)
$(CC) $(LIBGCC2_CFLAGS) $(LDFLAGS) -dynamiclib -nodefaultlibs \
- -install_name $(SHLIB_INSTALL_DIR)/$(EHS_INSTNAME) \
+ -install_name $(SHLIB_RPATH)/$(EHS_INSTNAME) \
-o $(MULTIDIR)/libgcc_ehs$(SHLIB_EXT) $(SHLIB_VERSTRING) \
- $(LIBEHSOBJS) $(SHLIB_LC)
+ -nodefaultrpaths $(LIBEHSOBJS) $(SHLIB_LC)
all: libgcc_ehs$(SHLIB_EXT)
@@ -122,12 +126,12 @@ libgcc_s.1.dylib: all-multi libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT) \
cp ../$${mlib}/libgcc/$${mlib}/libgcc_ehs$(SHLIB_EXT) \
./libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} || exit 1 ; \
arch=`$(LIPO) -info libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} | sed -e 's/.*:\ //'` ; \
- $(CC) -arch $${arch} -nodefaultlibs -dynamiclib \
+ $(CC) -arch $${arch} -nodefaultlibs -dynamiclib -nodefaultrpaths \
-o libgcc_s.1$(SHLIB_EXT)_T_$${mlib} \
-Wl,-reexport_library,libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} \
-Wl,-reexport_library,libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} \
- -install_name $(SHLIB_INSTALL_DIR)/libgcc_s.1.dylib \
- -compatibility_version 1 -current_version 1 ; \
+ -install_name $(SHLIB_RPATH)/libgcc_s.1.dylib \
+ -compatibility_version 1 -current_version 1.1 ; \
done
$(LIPO) -output libgcc_s.1$(SHLIB_EXT) -create libgcc_s.1$(SHLIB_EXT)_T*
rm libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T*
@@ -141,13 +145,13 @@ libgcc_s.1.dylib: all-multi libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)
cp ../$${mlib}/libgcc/$${mlib}/libgcc_s$(SHLIB_EXT) \
./libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} || exit 1 ; \
arch=`$(LIPO) -info libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} | sed -e 's/.*:\ //'` ; \
- $(CC) -arch $${arch} -nodefaultlibs -dynamiclib \
+ $(CC) -arch $${arch} -nodefaultlibs -dynamiclib -nodefaultrpaths \
-o libgcc_s.1$(SHLIB_EXT)_T_$${mlib} \
-Wl,-reexport_library,libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} \
-lSystem \
-Wl,-reexported_symbols_list,$(srcdir)/config/darwin-unwind.ver \
- -install_name $(SHLIB_INSTALL_DIR)/libgcc_s.1.dylib \
- -compatibility_version 1 -current_version 1 ; \
+ -install_name $(SHLIB_RPATH)/libgcc_s.1.dylib \
+ -compatibility_version 1 -current_version 1.1 ; \
done
$(LIPO) -output libgcc_s.1$(SHLIB_EXT) -create libgcc_s.1$(SHLIB_EXT)_T*
rm libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T*
diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am
index 9fab07c9a50..0a4ae4fca4f 100644
--- a/libgfortran/Makefile.am
+++ b/libgfortran/Makefile.am
@@ -37,6 +37,11 @@ else
version_arg =
version_dep =
endif
+extra_darwin_ldflags_libgfortran = @extra_ldflags_libgfortran@
+if ENABLE_DARWIN_AT_RPATH
+extra_darwin_ldflags_libgfortran += -Wc,-nodefaultrpaths
+extra_darwin_ldflags_libgfortran += -Wl,-rpath,@loader_path
+endif
gfor_c_HEADERS = ISO_Fortran_binding.h
gfor_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
@@ -50,7 +55,7 @@ libgfortran_la_LINK = $(LINK) $(libgfortran_la_LDFLAGS)
libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
$(LTLDFLAGS) $(LIBQUADLIB) ../libbacktrace/libbacktrace.la \
$(HWCAP_LDFLAGS) \
- $(LIBM) $(extra_ldflags_libgfortran) \
+ $(LIBM) $(extra_darwin_ldflags_libgfortran) \
$(version_arg) -Wc,-shared-libgcc
libgfortran_la_DEPENDENCIES = $(version_dep) libgfortran.spec $(LIBQUADLIB_DEP)
diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in
index e8627f9a4bc..30d1dc56da7 100644
--- a/libgfortran/Makefile.in
+++ b/libgfortran/Makefile.in
@@ -91,8 +91,10 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-@LIBGFOR_MINIMAL_TRUE@am__append_1 = -DLIBGFOR_MINIMAL
-@LIBGFOR_MINIMAL_FALSE@am__append_2 = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+@LIBGFOR_MINIMAL_TRUE@am__append_2 = -DLIBGFOR_MINIMAL
+@LIBGFOR_MINIMAL_FALSE@am__append_3 = \
@LIBGFOR_MINIMAL_FALSE@io/close.c \
@LIBGFOR_MINIMAL_FALSE@io/file_pos.c \
@LIBGFOR_MINIMAL_FALSE@io/format.c \
@@ -110,7 +112,7 @@ target_triplet = @target@
@LIBGFOR_MINIMAL_FALSE@io/fbuf.c \
@LIBGFOR_MINIMAL_FALSE@io/async.c
-@LIBGFOR_MINIMAL_FALSE@am__append_3 = \
+@LIBGFOR_MINIMAL_FALSE@am__append_4 = \
@LIBGFOR_MINIMAL_FALSE@intrinsics/access.c \
@LIBGFOR_MINIMAL_FALSE@intrinsics/c99_functions.c \
@LIBGFOR_MINIMAL_FALSE@intrinsics/chdir.c \
@@ -143,9 +145,9 @@ target_triplet = @target@
@LIBGFOR_MINIMAL_FALSE@intrinsics/umask.c \
@LIBGFOR_MINIMAL_FALSE@intrinsics/unlink.c
-@IEEE_SUPPORT_TRUE@am__append_4 = ieee/ieee_helper.c
-@LIBGFOR_MINIMAL_TRUE@am__append_5 = runtime/minimal.c
-@LIBGFOR_MINIMAL_FALSE@am__append_6 = \
+@IEEE_SUPPORT_TRUE@am__append_5 = ieee/ieee_helper.c
+@LIBGFOR_MINIMAL_TRUE@am__append_6 = runtime/minimal.c
+@LIBGFOR_MINIMAL_FALSE@am__append_7 = \
@LIBGFOR_MINIMAL_FALSE@runtime/backtrace.c \
@LIBGFOR_MINIMAL_FALSE@runtime/convert_char.c \
@LIBGFOR_MINIMAL_FALSE@runtime/environ.c \
@@ -584,7 +586,7 @@ AMTAR = @AMTAR@
# Some targets require additional compiler options for IEEE compatibility.
AM_CFLAGS = @AM_CFLAGS@ -fcx-fortran-rules $(SECTION_FLAGS) \
- $(IEEE_FLAGS) $(am__append_1)
+ $(IEEE_FLAGS) $(am__append_2)
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ $(IEEE_FLAGS)
AR = @AR@
@@ -743,6 +745,8 @@ gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
@LIBGFOR_USE_SYMVER_FALSE@version_dep =
@LIBGFOR_USE_SYMVER_GNU_TRUE@@LIBGFOR_USE_SYMVER_TRUE@version_dep = gfortran.ver
@LIBGFOR_USE_SYMVER_SUN_TRUE@@LIBGFOR_USE_SYMVER_TRUE@version_dep = gfortran.ver-sun gfortran.ver
+extra_darwin_ldflags_libgfortran = @extra_ldflags_libgfortran@ \
+ $(am__append_1)
gfor_c_HEADERS = ISO_Fortran_binding.h
gfor_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) \
@@ -754,7 +758,7 @@ libgfortran_la_LINK = $(LINK) $(libgfortran_la_LDFLAGS)
libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
$(LTLDFLAGS) $(LIBQUADLIB) ../libbacktrace/libbacktrace.la \
$(HWCAP_LDFLAGS) \
- $(LIBM) $(extra_ldflags_libgfortran) \
+ $(LIBM) $(extra_darwin_ldflags_libgfortran) \
$(version_arg) -Wc,-shared-libgcc
libgfortran_la_DEPENDENCIES = $(version_dep) libgfortran.spec $(LIBQUADLIB_DEP)
@@ -775,7 +779,7 @@ AM_CPPFLAGS = -iquote$(srcdir)/io -I$(srcdir)/$(MULTISRCTOP)../gcc \
-I$(MULTIBUILDTOP)../libbacktrace \
-I../libbacktrace
-gfor_io_src = io/size_from_kind.c $(am__append_2)
+gfor_io_src = io/size_from_kind.c $(am__append_3)
gfor_io_headers = \
io/io.h \
io/fbuf.h \
@@ -797,7 +801,7 @@ gfor_helper_src = intrinsics/associated.c intrinsics/abort.c \
intrinsics/selected_int_kind.f90 \
intrinsics/selected_real_kind.f90 intrinsics/trigd.c \
intrinsics/unpack_generic.c runtime/in_pack_generic.c \
- runtime/in_unpack_generic.c $(am__append_3) $(am__append_4)
+ runtime/in_unpack_generic.c $(am__append_4) $(am__append_5)
@IEEE_SUPPORT_TRUE@gfor_ieee_helper_src = ieee/ieee_helper.c
@IEEE_SUPPORT_FALSE@gfor_ieee_src =
@IEEE_SUPPORT_TRUE@gfor_ieee_src = \
@@ -806,8 +810,8 @@ gfor_helper_src = intrinsics/associated.c intrinsics/abort.c \
@IEEE_SUPPORT_TRUE@ieee/ieee_features.F90
gfor_src = runtime/bounds.c runtime/compile_options.c runtime/memory.c \
- runtime/string.c runtime/select.c $(am__append_5) \
- $(am__append_6)
+ runtime/string.c runtime/select.c $(am__append_6) \
+ $(am__append_7)
i_all_c = \
$(srcdir)/generated/all_l1.c \
$(srcdir)/generated/all_l2.c \
diff --git a/libgfortran/configure b/libgfortran/configure
index cd176b04a14..774dd52fc95 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -654,6 +654,8 @@ extra_ldflags_libgfortran
ac_ct_FC
FCFLAGS
FC
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -819,6 +821,7 @@ enable_static
with_pic
enable_fast_install
enable_libtool_lock
+enable_darwin_at_rpath
enable_largefile
enable_libquadmath_support
with_gcc_major_version_only
@@ -1473,6 +1476,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--disable-largefile omit support for large files
--disable-libquadmath-support
disable libquadmath support for Fortran
@@ -9243,7 +9249,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10953,6 +10959,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10970,9 +11019,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12799,7 +12852,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12802 "configure"
+#line 12855 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12905,7 +12958,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12908 "configure"
+#line 12961 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13307,6 +13360,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
#AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10
# We need gfortran to compile parts of the library
@@ -14950,6 +15011,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_FC=no
hardcode_direct_FC=no
hardcode_automatic_FC=yes
@@ -14967,9 +15071,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_FC="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_FC="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -16242,9 +16350,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# extra LD Flags which are required for targets
+extra_ldflags_libgfortran=
case "${host}" in
- *-darwin*)
- # Darwin needs -single_module when linking libgfortran
+ *-*-darwin[4567]*)
+ # Earlier Darwin needs -single_module when linking libgfortran
extra_ldflags_libgfortran=-Wl,-single_module
;;
esac
@@ -31601,6 +31710,10 @@ if test -z "${HAVE_HWCAP_TRUE}" && test -z "${HAVE_HWCAP_FALSE}"; then
as_fn_error $? "conditional \"HAVE_HWCAP\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${IEEE_SUPPORT_TRUE}" && test -z "${IEEE_SUPPORT_FALSE}"; then
as_fn_error $? "conditional \"IEEE_SUPPORT\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index 8bd2af966c8..46585a3ee14 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -269,6 +269,7 @@ LT_LIB_M
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
#AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10
# We need gfortran to compile parts of the library
@@ -277,9 +278,10 @@ FC="$GFORTRAN"
AC_PROG_FC(gfortran)
# extra LD Flags which are required for targets
+extra_ldflags_libgfortran=
case "${host}" in
- *-darwin*)
- # Darwin needs -single_module when linking libgfortran
+ *-*-darwin[[4567]]*)
+ # Earlier Darwin needs -single_module when linking libgfortran
extra_ldflags_libgfortran=-Wl,-single_module
;;
esac
diff --git a/libgm2/Makefile.am b/libgm2/Makefile.am
index 95df3ed7a30..aa35e747c9a 100644
--- a/libgm2/Makefile.am
+++ b/libgm2/Makefile.am
@@ -46,6 +46,12 @@ SUBDIRS = libm2min libm2log libm2cor libm2iso libm2pim
GM2_BUILDDIR := $(shell pwd)
gm2_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
+if ENABLE_DARWIN_AT_RPATH
+DARWIN_AT_RPATH=yes
+else
+DARWIN_AT_RPATH=yes
+endif
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
# friends when we are called from the top level Makefile.
@@ -91,7 +97,8 @@ AM_MAKEFLAGS = \
"WERROR=$(WERROR)" \
"TARGET_LIB_PATH=$(TARGET_LIB_PATH)" \
"TARGET_LIB_PATH_libgm2=$(TARGET_LIB_PATH_libgm2)" \
- "LIBTOOL=$(GM2_BUILDDIR)/libtool"
+ "LIBTOOL=$(GM2_BUILDDIR)/libtool" \
+ "DARWIN_AT_RPATH=$(DARWIN_AT_RPATH)"
# Subdir rules rely on $(FLAGS_TO_PASS)
FLAGS_TO_PASS = $(AM_MAKEFLAGS)
diff --git a/libgm2/Makefile.in b/libgm2/Makefile.in
index c0396791f48..e8fa4aa52dc 100644
--- a/libgm2/Makefile.in
+++ b/libgm2/Makefile.in
@@ -90,15 +90,15 @@ host_triplet = @host@
target_triplet = @target@
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
@@ -343,6 +343,8 @@ GM2_SRC = $(GCC_DIR)/m2
SUBDIRS = libm2min libm2log libm2cor libm2iso libm2pim
GM2_BUILDDIR := $(shell pwd)
gm2_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
+@ENABLE_DARWIN_AT_RPATH_FALSE@DARWIN_AT_RPATH = yes
+@ENABLE_DARWIN_AT_RPATH_TRUE@DARWIN_AT_RPATH = yes
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
@@ -389,7 +391,8 @@ AM_MAKEFLAGS = \
"WERROR=$(WERROR)" \
"TARGET_LIB_PATH=$(TARGET_LIB_PATH)" \
"TARGET_LIB_PATH_libgm2=$(TARGET_LIB_PATH_libgm2)" \
- "LIBTOOL=$(GM2_BUILDDIR)/libtool"
+ "LIBTOOL=$(GM2_BUILDDIR)/libtool" \
+ "DARWIN_AT_RPATH=$(DARWIN_AT_RPATH)"
# Subdir rules rely on $(FLAGS_TO_PASS)
diff --git a/libgm2/aclocal.m4 b/libgm2/aclocal.m4
index c352303012d..832065fbb9b 100644
--- a/libgm2/aclocal.m4
+++ b/libgm2/aclocal.m4
@@ -1187,14 +1187,14 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
-m4_include([../libtool.m4])
-m4_include([../ltoptions.m4])
-m4_include([../ltsugar.m4])
-m4_include([../ltversion.m4])
-m4_include([../lt~obsolete.m4])
m4_include([../config/acx.m4])
m4_include([../config/depstand.m4])
m4_include([../config/lead-dot.m4])
m4_include([../config/multi.m4])
m4_include([../config/no-executables.m4])
m4_include([../config/override.m4])
+m4_include([../libtool.m4])
+m4_include([../ltoptions.m4])
+m4_include([../ltsugar.m4])
+m4_include([../ltversion.m4])
+m4_include([../lt~obsolete.m4])
diff --git a/libgm2/configure b/libgm2/configure
index 072d584544e..d55a7f4a74b 100755
--- a/libgm2/configure
+++ b/libgm2/configure
@@ -649,6 +649,8 @@ GM2_FOR_TARGET
CC_FOR_BUILD
enable_static
enable_shared
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
CXXCPP
OTOOL64
OTOOL
@@ -805,6 +807,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
with_gcc_major_version_only
'
ac_precious_vars='build_alias
@@ -1455,6 +1458,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -6569,10 +6575,6 @@ fi
-enable_dlopen=yes
-
-
-
case `pwd` in
*\ * | *\ *)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
@@ -9181,7 +9183,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9229,6 +9231,8 @@ done
+ enable_dlopen=no
+
enable_win32_dll=no
@@ -10892,6 +10896,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10909,9 +10956,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12738,7 +12789,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12741 "configure"
+#line 12792 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12844,7 +12895,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12847 "configure"
+#line 12898 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13726,6 +13777,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13743,12 +13837,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -16122,6 +16224,21 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+enable_dlopen=yes
+
+
+
+
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
+
if test "${multilib}" = "yes"; then
@@ -20310,6 +20427,10 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${BUILD_PIMLIB_TRUE}" && test -z "${BUILD_PIMLIB_FALSE}"; then
as_fn_error $? "conditional \"BUILD_PIMLIB\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgm2/configure.ac b/libgm2/configure.ac
index 92e76c9346c..5701b95878b 100644
--- a/libgm2/configure.ac
+++ b/libgm2/configure.ac
@@ -212,8 +212,12 @@ AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
AC_PROG_MAKE_SET
AC_PROG_INSTALL
-AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
+LT_INIT
+AC_LIBTOOL_DLOPEN
+
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
diff --git a/libgm2/libm2cor/Makefile.am b/libgm2/libm2cor/Makefile.am
index 48de40c22dd..e50c7a2ef55 100644
--- a/libgm2/libm2cor/Makefile.am
+++ b/libgm2/libm2cor/Makefile.am
@@ -123,6 +123,10 @@ libm2cor_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2cor_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2cor_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
+
libm2cor_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2cor_la_link_flags)
BUILT_SOURCES = SYSTEM.def
CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2cor/Makefile.in b/libgm2/libm2cor/Makefile.in
index 3b0b40fea60..cc8a3fa73ed 100644
--- a/libgm2/libm2cor/Makefile.in
+++ b/libgm2/libm2cor/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@BUILD_CORLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2cor
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -468,8 +469,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_CORLIB_TRUE@ -fm2-pathname=m2iso -I$(GM2_SRC)/gm2-libs-iso \
@BUILD_CORLIB_TRUE@ -fm2-g -g -Wreturn-type -fcase -fm2-prefix=m2cor
-@BUILD_CORLIB_TRUE@@TARGET_DARWIN_FALSE@libm2cor_la_link_flags =
-@BUILD_CORLIB_TRUE@@TARGET_DARWIN_TRUE@libm2cor_la_link_flags = -Wl,-undefined,dynamic_lookup
+@BUILD_CORLIB_TRUE@@TARGET_DARWIN_FALSE@libm2cor_la_link_flags = \
+@BUILD_CORLIB_TRUE@@TARGET_DARWIN_FALSE@ $(am__append_1)
+@BUILD_CORLIB_TRUE@@TARGET_DARWIN_TRUE@libm2cor_la_link_flags = -Wl,-undefined,dynamic_lookup \
+@BUILD_CORLIB_TRUE@@TARGET_DARWIN_TRUE@ $(am__append_1)
@BUILD_CORLIB_TRUE@libm2cor_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2cor_la_link_flags)
@BUILD_CORLIB_TRUE@BUILT_SOURCES = SYSTEM.def
@BUILD_CORLIB_TRUE@CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2iso/Makefile.am b/libgm2/libm2iso/Makefile.am
index 1386f156cab..4d8e897266f 100644
--- a/libgm2/libm2iso/Makefile.am
+++ b/libgm2/libm2iso/Makefile.am
@@ -197,6 +197,10 @@ libm2iso_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2iso_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2iso_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
+
libm2iso_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2iso_la_link_flags)
CLEANFILES = SYSTEM.def
BUILT_SOURCES = SYSTEM.def
diff --git a/libgm2/libm2iso/Makefile.in b/libgm2/libm2iso/Makefile.in
index b939581b7c1..08563adfe78 100644
--- a/libgm2/libm2iso/Makefile.in
+++ b/libgm2/libm2iso/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@BUILD_ISOLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2iso
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -569,8 +570,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_ISOLIB_TRUE@ -fm2-pathname=m2pim -I$(GM2_SRC)/gm2-libs \
@BUILD_ISOLIB_TRUE@ -fiso -fextended-opaque -fm2-g -g -Wreturn-type -fcase -fm2-prefix=m2iso
-@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_FALSE@libm2iso_la_link_flags =
-@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_TRUE@libm2iso_la_link_flags = -Wl,-undefined,dynamic_lookup
+@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_FALSE@libm2iso_la_link_flags = \
+@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_FALSE@ $(am__append_1)
+@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_TRUE@libm2iso_la_link_flags = -Wl,-undefined,dynamic_lookup \
+@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_TRUE@ $(am__append_1)
@BUILD_ISOLIB_TRUE@libm2iso_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2iso_la_link_flags)
@BUILD_ISOLIB_TRUE@CLEANFILES = SYSTEM.def
@BUILD_ISOLIB_TRUE@BUILT_SOURCES = SYSTEM.def
diff --git a/libgm2/libm2log/Makefile.am b/libgm2/libm2log/Makefile.am
index a15747fd245..3b7609ee5c1 100644
--- a/libgm2/libm2log/Makefile.am
+++ b/libgm2/libm2log/Makefile.am
@@ -142,6 +142,9 @@ libm2log_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2log_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2log_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
libm2log_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2log_la_link_flags)
BUILT_SOURCES = ../libm2pim/SYSTEM.def
diff --git a/libgm2/libm2log/Makefile.in b/libgm2/libm2log/Makefile.in
index ba34a6b445a..fa12a386c55 100644
--- a/libgm2/libm2log/Makefile.in
+++ b/libgm2/libm2log/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@BUILD_LOGLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2log
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -477,8 +478,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_LOGLIB_TRUE@ -fm2-pathname=m2iso -I$(GM2_SRC)/gm2-libs-iso \
@BUILD_LOGLIB_TRUE@ -Wreturn-type -fcase -fm2-prefix=m2log
-@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_FALSE@libm2log_la_link_flags =
-@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_TRUE@libm2log_la_link_flags = -Wl,-undefined,dynamic_lookup
+@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_FALSE@libm2log_la_link_flags = \
+@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_FALSE@ $(am__append_1)
+@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_TRUE@libm2log_la_link_flags = -Wl,-undefined,dynamic_lookup \
+@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_TRUE@ $(am__append_1)
@BUILD_LOGLIB_TRUE@libm2log_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2log_la_link_flags)
@BUILD_LOGLIB_TRUE@BUILT_SOURCES = ../libm2pim/SYSTEM.def
@BUILD_LOGLIB_TRUE@M2LIBDIR = /m2/m2log/
diff --git a/libgm2/libm2min/Makefile.am b/libgm2/libm2min/Makefile.am
index 1ff160028f6..21411769505 100644
--- a/libgm2/libm2min/Makefile.am
+++ b/libgm2/libm2min/Makefile.am
@@ -113,6 +113,9 @@ libm2min_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2min_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2min_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
libm2min_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2min_la_link_flags)
BUILT_SOURCES = SYSTEM.def
CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2min/Makefile.in b/libgm2/libm2min/Makefile.in
index 9ead8397fd0..73af6568b88 100644
--- a/libgm2/libm2min/Makefile.in
+++ b/libgm2/libm2min/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2min
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -441,8 +442,10 @@ libm2min_la_M2FLAGS = \
-fm2-pathname=m2pim -I$(GM2_SRC)/gm2-libs -fno-exceptions \
-fno-m2-plugin -fno-scaffold-dynamic -fno-scaffold-main -fm2-prefix=m2min
-@TARGET_DARWIN_FALSE@libm2min_la_link_flags =
-@TARGET_DARWIN_TRUE@libm2min_la_link_flags = -Wl,-undefined,dynamic_lookup
+@TARGET_DARWIN_FALSE@libm2min_la_link_flags = $(am__append_1)
+@TARGET_DARWIN_TRUE@libm2min_la_link_flags = \
+@TARGET_DARWIN_TRUE@ -Wl,-undefined,dynamic_lookup \
+@TARGET_DARWIN_TRUE@ $(am__append_1)
libm2min_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2min_la_link_flags)
BUILT_SOURCES = SYSTEM.def
CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2pim/Makefile.am b/libgm2/libm2pim/Makefile.am
index ebfeba1ac1d..e777a60c077 100644
--- a/libgm2/libm2pim/Makefile.am
+++ b/libgm2/libm2pim/Makefile.am
@@ -175,6 +175,9 @@ libm2pim_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2pim_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2pim_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
libm2pim_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2pim_la_link_flags)
BUILT_SOURCES = SYSTEM.def
CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2pim/Makefile.in b/libgm2/libm2pim/Makefile.in
index 660488f9692..54414058bc5 100644
--- a/libgm2/libm2pim/Makefile.in
+++ b/libgm2/libm2pim/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@BUILD_PIMLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2pim
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -538,8 +539,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_PIMLIB_TRUE@ -fm2-pathname=m2iso -I$(GM2_SRC)/gm2-libs-iso \
@BUILD_PIMLIB_TRUE@ -fm2-g -g -Wreturn-type -fcase -fm2-prefix=m2pim
-@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_FALSE@libm2pim_la_link_flags =
-@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_TRUE@libm2pim_la_link_flags = -Wl,-undefined,dynamic_lookup
+@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_FALSE@libm2pim_la_link_flags = \
+@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_FALSE@ $(am__append_1)
+@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_TRUE@libm2pim_la_link_flags = -Wl,-undefined,dynamic_lookup \
+@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_TRUE@ $(am__append_1)
@BUILD_PIMLIB_TRUE@libm2pim_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2pim_la_link_flags)
@BUILD_PIMLIB_TRUE@BUILT_SOURCES = SYSTEM.def
@BUILD_PIMLIB_TRUE@CLEANFILES = SYSTEM.def
diff --git a/libgo/configure b/libgo/configure
index a607dbff68e..72d46c3eec3 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -708,6 +708,8 @@ glibgo_toolexecdir
WERROR
WARN_FLAGS
CC_FOR_BUILD
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
CPP
@@ -11544,7 +11546,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11547 "configure"
+#line 11549 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11650,7 +11652,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11653 "configure"
+#line 11655 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13779,6 +13781,14 @@ CC="$lt_save_CC"
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
CC_FOR_BUILD=${CC_FOR_BUILD:-gcc}
@@ -16386,6 +16396,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${USE_LIBFFI_TRUE}" && test -z "${USE_LIBFFI_FALSE}"; then
as_fn_error $? "conditional \"USE_LIBFFI\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgo/configure.ac b/libgo/configure.ac
index a59aa091d1d..6f1ac32660b 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -53,6 +53,7 @@ AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
CC_FOR_BUILD=${CC_FOR_BUILD:-gcc}
AC_SUBST(CC_FOR_BUILD)
diff --git a/libgomp/Makefile.am b/libgomp/Makefile.am
index 428f7a9dab5..ceb8c910abd 100644
--- a/libgomp/Makefile.am
+++ b/libgomp/Makefile.am
@@ -53,9 +53,14 @@ else
libgomp_version_script =
libgomp_version_dep =
endif
+
libgomp_version_info = -version-info $(libtool_VERSION)
+if ENABLE_DARWIN_AT_RPATH
+libgomp_darwin_rpath = -Wc,-nodefaultrpaths
+libgomp_darwin_rpath += -Wl,-rpath,@loader_path
+endif
libgomp_la_LDFLAGS = $(libgomp_version_info) $(libgomp_version_script) \
- $(lt_host_flags)
+ $(lt_host_flags) $(libgomp_darwin_rpath)
libgomp_la_LIBADD =
libgomp_la_DEPENDENCIES = $(libgomp_version_dep)
libgomp_la_LINK = $(LINK) $(libgomp_la_LDFLAGS)
diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
index 3ef05e6a3cb..2467250215e 100644
--- a/libgomp/Makefile.in
+++ b/libgomp/Makefile.in
@@ -535,8 +535,11 @@ nodist_toolexeclib_HEADERS = libgomp.spec
@LIBGOMP_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgomp_version_dep = libgomp.ver
@LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgomp_version_dep = libgomp.ver-sun
libgomp_version_info = -version-info $(libtool_VERSION)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libgomp_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
libgomp_la_LDFLAGS = $(libgomp_version_info) $(libgomp_version_script) \
- $(lt_host_flags)
+ $(lt_host_flags) $(libgomp_darwin_rpath)
libgomp_la_LIBADD = $(DL_LIBS)
libgomp_la_DEPENDENCIES = $(libgomp_version_dep)
diff --git a/libgomp/configure b/libgomp/configure
index a12b30f1b0f..7c103cf37f1 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -683,6 +683,8 @@ CXX
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -822,6 +824,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
enable_linux_futex
enable_tls
@@ -1477,6 +1480,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -7618,7 +7624,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9591,6 +9597,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9608,9 +9657,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11416,7 +11469,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11419 "configure"
+#line 11472 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11522,7 +11575,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11525 "configure"
+#line 11578 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11783,6 +11836,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
@@ -13469,6 +13530,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_FC=no
hardcode_direct_FC=no
hardcode_automatic_FC=yes
@@ -13486,9 +13590,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_FC="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_FC="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -17130,6 +17238,10 @@ if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then
as_fn_error $? "conditional \"BUILD_INFO\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index 1aad83a79da..8c941cddd2f 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -148,6 +148,7 @@ AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
AM_MAINTAINER_MODE
diff --git a/libitm/Makefile.am b/libitm/Makefile.am
index 3f31ad30556..a25317b07fe 100644
--- a/libitm/Makefile.am
+++ b/libitm/Makefile.am
@@ -54,7 +54,12 @@ libitm_version_info = -version-info $(libtool_VERSION)
# want or need libstdc++.
libitm_la_DEPENDENCIES = $(libitm_version_dep)
libitm_la_LINK = $(LINK) $(libitm_la_LDFLAGS)
-libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script)
+if ENABLE_DARWIN_AT_RPATH
+libitm_darwin_rpath = -Wc,-nodefaultrpaths
+libitm_darwin_rpath += -Wl,-rpath,@loader_path
+endif
+libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script) \
+ $(libitm_darwin_rpath)
libitm_la_SOURCES = \
aatree.cc alloc.cc alloc_c.cc alloc_cpp.cc barrier.cc beginend.cc \
diff --git a/libitm/Makefile.in b/libitm/Makefile.in
index 7c51fe02511..9f0691018a9 100644
--- a/libitm/Makefile.in
+++ b/libitm/Makefile.in
@@ -480,7 +480,12 @@ libitm_version_info = -version-info $(libtool_VERSION)
# want or need libstdc++.
libitm_la_DEPENDENCIES = $(libitm_version_dep)
libitm_la_LINK = $(LINK) $(libitm_la_LDFLAGS)
-libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libitm_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script) \
+ $(libitm_darwin_rpath)
+
libitm_la_SOURCES = aatree.cc alloc.cc alloc_c.cc alloc_cpp.cc \
barrier.cc beginend.cc clone.cc eh_cpp.cc local.cc query.cc \
retry.cc rwlock.cc useraction.cc util.cc sjlj.S tls.cc \
diff --git a/libitm/configure b/libitm/configure
index 02e8de7896b..9ba7fb03a57 100755
--- a/libitm/configure
+++ b/libitm/configure
@@ -660,6 +660,8 @@ libtool_VERSION
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
CXXCPP
@@ -809,6 +811,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
enable_linux_futex
enable_tls
@@ -1461,6 +1464,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -8279,7 +8285,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10253,6 +10259,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10270,9 +10319,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12078,7 +12131,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12081 "configure"
+#line 12134 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12184,7 +12237,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12187 "configure"
+#line 12240 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13060,6 +13113,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13077,12 +13173,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15454,6 +15558,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
@@ -18212,6 +18324,10 @@ if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then
as_fn_error $? "conditional \"BUILD_INFO\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libitm/configure.ac b/libitm/configure.ac
index 892a24caa85..dded4d387be 100644
--- a/libitm/configure.ac
+++ b/libitm/configure.ac
@@ -156,6 +156,7 @@ AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes")
AM_PROG_LIBTOOL
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
AM_MAINTAINER_MODE
diff --git a/libobjc/configure b/libobjc/configure
index 752f6fdfebd..68172549137 100755
--- a/libobjc/configure
+++ b/libobjc/configure
@@ -636,6 +636,9 @@ OBJC_BOEHM_GC_LIBS
OBJC_BOEHM_GC_INCLUDES
OBJC_BOEHM_GC
OBJC_GCFLAGS
+extra_ldflags_libobjc
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
SET_MAKE
CPP
OTOOL64
@@ -667,7 +670,6 @@ RANLIB
AR
AS
XCFLAGS
-extra_ldflags_libobjc
lt_host_flags
OBJEXT
EXEEXT
@@ -755,6 +757,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_tls
enable_objc_gc
with_target_bdw_gc
@@ -1392,6 +1395,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-tls Use thread-local storage [default=yes]
--enable-objc-gc enable use of Boehm's garbage collector with the GNU
Objective-C runtime
@@ -3431,17 +3437,6 @@ esac
-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
-
# Add CET specific flags if CET is enabled
@@ -7011,7 +7006,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -8988,6 +8983,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9005,9 +9043,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -10834,7 +10876,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10837 "configure"
+#line 10879 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10940,7 +10982,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10943 "configure"
+#line 10985 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11212,6 +11254,38 @@ $as_echo "no" >&6; }
fi
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
+# 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
+
+
# -------
# Headers
# -------
@@ -11953,6 +12027,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/libobjc/configure.ac b/libobjc/configure.ac
index 9bd7d59d597..cb21ebbfcc7 100644
--- a/libobjc/configure.ac
+++ b/libobjc/configure.ac
@@ -148,17 +148,6 @@ m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
# 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)
@@ -183,6 +172,31 @@ AM_PROG_CC_C_O
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
# -------
diff --git a/libphobos/configure b/libphobos/configure
index b7276d95010..25b13bdd93e 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -707,6 +707,8 @@ get_gcc_base_ver
phobos_compiler_shared_flag
phobos_compiler_pic_flag
phobos_lt_pic_flag
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
OTOOL64
@@ -838,6 +840,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
with_gcc_major_version_only
enable_werror
with_libatomic
@@ -1490,6 +1493,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-werror turns on -Werror [default=no]
--enable-version-specific-runtime-libs
Specify that runtime libraries should be installed
@@ -8282,7 +8288,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9987,6 +9993,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10004,9 +10053,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11812,7 +11865,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11815 "configure"
+#line 11868 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11918,7 +11971,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11921 "configure"
+#line 11974 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13443,6 +13496,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_D=no
hardcode_direct_D=no
hardcode_automatic_D=yes
@@ -13460,9 +13556,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_D="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_D="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_D="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_D="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_D="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_D="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -14064,6 +14164,14 @@ CFLAGS=$lt_save_CFLAGS
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
# libtool variables for Phobos shared and position-independent compiles.
#
@@ -15877,6 +15985,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${DRUNTIME_CPU_AARCH64_TRUE}" && test -z "${DRUNTIME_CPU_AARCH64_FALSE}"; then
as_fn_error $? "conditional \"DRUNTIME_CPU_AARCH64\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libphobos/configure.ac b/libphobos/configure.ac
index 3b2e6df5d5c..bb669675ce0 100644
--- a/libphobos/configure.ac
+++ b/libphobos/configure.ac
@@ -93,6 +93,7 @@ AM_PROG_LIBTOOL
WITH_LOCAL_DRUNTIME([LT_LANG([D])], [])
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
# libtool variables for Phobos shared and position-independent compiles.
#
diff --git a/libphobos/libdruntime/Makefile.am b/libphobos/libdruntime/Makefile.am
index 832a0524ab3..b78bcdd203f 100644
--- a/libphobos/libdruntime/Makefile.am
+++ b/libphobos/libdruntime/Makefile.am
@@ -128,8 +128,11 @@ ALL_DRUNTIME_SOURCES = $(DRUNTIME_DSOURCES) $(DRUNTIME_CSOURCES) \
toolexeclib_LTLIBRARIES = libgdruntime.la
libgdruntime_la_SOURCES = $(ALL_DRUNTIME_SOURCES)
libgdruntime_la_LIBTOOLFLAGS =
+if ENABLE_DARWIN_AT_RPATH
+libgdruntime_darwin_rpath = -Wl,-rpath,@loader_path
+endif
libgdruntime_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../src,-Bgcc \
- -version-info $(libtool_VERSION)
+ -version-info $(libtool_VERSION) $(libgdruntime_darwin_rpath)
libgdruntime_la_LIBADD = $(LIBATOMIC) $(LIBBACKTRACE)
libgdruntime_la_DEPENDENCIES = $(DRTSTUFF)
# Also override library link commands: This is not strictly
diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in
index 61a2a770888..4d62985349b 100644
--- a/libphobos/libdruntime/Makefile.in
+++ b/libphobos/libdruntime/Makefile.in
@@ -813,8 +813,9 @@ ALL_DRUNTIME_SOURCES = $(DRUNTIME_DSOURCES) $(DRUNTIME_CSOURCES) \
toolexeclib_LTLIBRARIES = libgdruntime.la
libgdruntime_la_SOURCES = $(ALL_DRUNTIME_SOURCES)
libgdruntime_la_LIBTOOLFLAGS =
+@ENABLE_DARWIN_AT_RPATH_TRUE@libgdruntime_darwin_rpath = -Wl,-rpath,@loader_path
libgdruntime_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../src,-Bgcc \
- -version-info $(libtool_VERSION)
+ -version-info $(libtool_VERSION) $(libgdruntime_darwin_rpath)
libgdruntime_la_LIBADD = $(LIBATOMIC) $(LIBBACKTRACE)
libgdruntime_la_DEPENDENCIES = $(DRTSTUFF)
diff --git a/libphobos/src/Makefile.am b/libphobos/src/Makefile.am
index 6474fca5eb5..f6521ed5860 100644
--- a/libphobos/src/Makefile.am
+++ b/libphobos/src/Makefile.am
@@ -44,8 +44,11 @@ toolexeclib_DATA = libgphobos.spec
toolexeclib_LTLIBRARIES = libgphobos.la
libgphobos_la_SOURCES = $(ALL_PHOBOS_SOURCES)
libgphobos_la_LIBTOOLFLAGS =
+if ENABLE_DARWIN_AT_RPATH
+libgphobos_darwin_rpath = -Wl,-rpath,@loader_path
+endif
libgphobos_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../libdruntime/gcc \
- -version-info $(libtool_VERSION)
+ -version-info $(libtool_VERSION) $(libgphobos_darwin_rpath)
if ENABLE_LIBDRUNTIME_ONLY
libgphobos_la_LIBADD = ../libdruntime/libgdruntime_convenience.la
else
diff --git a/libphobos/src/Makefile.in b/libphobos/src/Makefile.in
index a6229587e7b..cc3358b437e 100644
--- a/libphobos/src/Makefile.in
+++ b/libphobos/src/Makefile.in
@@ -529,8 +529,9 @@ toolexeclib_DATA = libgphobos.spec
toolexeclib_LTLIBRARIES = libgphobos.la
libgphobos_la_SOURCES = $(ALL_PHOBOS_SOURCES)
libgphobos_la_LIBTOOLFLAGS =
+@ENABLE_DARWIN_AT_RPATH_TRUE@libgphobos_darwin_rpath = -Wl,-rpath,@loader_path
libgphobos_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../libdruntime/gcc \
- -version-info $(libtool_VERSION)
+ -version-info $(libtool_VERSION) $(libgphobos_darwin_rpath)
@ENABLE_LIBDRUNTIME_ONLY_FALSE@libgphobos_la_LIBADD = \
@ENABLE_LIBDRUNTIME_ONLY_FALSE@ ../libdruntime/libgdruntime_convenience.la $(LIBZ)
diff --git a/libquadmath/Makefile.am b/libquadmath/Makefile.am
index 35dffb46f6e..0d02c95e738 100644
--- a/libquadmath/Makefile.am
+++ b/libquadmath/Makefile.am
@@ -36,8 +36,13 @@ endif
toolexeclib_LTLIBRARIES = libquadmath.la
libquadmath_la_LIBADD =
+
+if ENABLE_DARWIN_AT_RPATH
+libquadmath_darwin_rpath = -Wc,-nodefaultrpaths
+libquadmath_darwin_rpath += -Wl,-rpath,@loader_path
+endif
libquadmath_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
- $(version_arg) $(lt_host_flags) -lm
+ $(version_arg) $(lt_host_flags) $(LIBM) $(libquadmath_darwin_rpath)
libquadmath_la_DEPENDENCIES = $(version_dep) $(libquadmath_la_LIBADD)
nodist_libsubinclude_HEADERS = quadmath.h quadmath_weak.h
diff --git a/libquadmath/Makefile.in b/libquadmath/Makefile.in
index 8c011212258..068af559457 100644
--- a/libquadmath/Makefile.in
+++ b/libquadmath/Makefile.in
@@ -355,6 +355,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
+LIBM = @LIBM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
@@ -463,8 +464,10 @@ AUTOMAKE_OPTIONS = foreign info-in-builddir
@BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_SUN_TRUE@@LIBQUAD_USE_SYMVER_TRUE@version_dep = quadmath.map-sun
@BUILD_LIBQUADMATH_TRUE@toolexeclib_LTLIBRARIES = libquadmath.la
@BUILD_LIBQUADMATH_TRUE@libquadmath_la_LIBADD =
+@BUILD_LIBQUADMATH_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@libquadmath_darwin_rpath = -Wc,-nodefaultrpaths \
+@BUILD_LIBQUADMATH_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
@BUILD_LIBQUADMATH_TRUE@libquadmath_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
-@BUILD_LIBQUADMATH_TRUE@ $(version_arg) $(lt_host_flags) -lm
+@BUILD_LIBQUADMATH_TRUE@ $(version_arg) $(lt_host_flags) $(LIBM) $(libquadmath_darwin_rpath)
@BUILD_LIBQUADMATH_TRUE@libquadmath_la_DEPENDENCIES = $(version_dep) $(libquadmath_la_LIBADD)
@BUILD_LIBQUADMATH_TRUE@nodist_libsubinclude_HEADERS = quadmath.h quadmath_weak.h
diff --git a/libquadmath/configure b/libquadmath/configure
index 0b145a644c3..5bd9a070fdc 100755
--- a/libquadmath/configure
+++ b/libquadmath/configure
@@ -644,11 +644,14 @@ LIBQUAD_USE_SYMVER_GNU_FALSE
LIBQUAD_USE_SYMVER_GNU_TRUE
LIBQUAD_USE_SYMVER_FALSE
LIBQUAD_USE_SYMVER_TRUE
+LIBM
toolexeclibdir
toolexecdir
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -785,6 +788,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
with_toolexeclibdir
enable_symvers
@@ -1435,6 +1439,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -7310,7 +7317,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9022,6 +9029,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9039,9 +9089,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -10868,7 +10922,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10871 "configure"
+#line 10925 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10974,7 +11028,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10977 "configure"
+#line 11031 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11235,6 +11289,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
@@ -12199,6 +12261,148 @@ esac
+LIBM=
+case $host in
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+ # These system don't have libm, or don't need it
+ ;;
+*-ncr-sysv4.3*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mwvalidcheckl in -lmw" >&5
+$as_echo_n "checking for _mwvalidcheckl in -lmw... " >&6; }
+if ${ac_cv_lib_mw__mwvalidcheckl+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lmw $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char _mwvalidcheckl ();
+int
+main ()
+{
+return _mwvalidcheckl ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_mw__mwvalidcheckl=yes
+else
+ ac_cv_lib_mw__mwvalidcheckl=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mw__mwvalidcheckl" >&5
+$as_echo "$ac_cv_lib_mw__mwvalidcheckl" >&6; }
+if test "x$ac_cv_lib_mw__mwvalidcheckl" = xyes; then :
+ LIBM="-lmw"
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
+$as_echo_n "checking for cos in -lm... " >&6; }
+if ${ac_cv_lib_m_cos+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char cos ();
+int
+main ()
+{
+return cos ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_cos=yes
+else
+ ac_cv_lib_m_cos=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
+$as_echo "$ac_cv_lib_m_cos" >&6; }
+if test "x$ac_cv_lib_m_cos" = xyes; then :
+ LIBM="$LIBM -lm"
+fi
+
+ ;;
+*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
+$as_echo_n "checking for cos in -lm... " >&6; }
+if ${ac_cv_lib_m_cos+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char cos ();
+int
+main ()
+{
+return cos ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_cos=yes
+else
+ ac_cv_lib_m_cos=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
+$as_echo "$ac_cv_lib_m_cos" >&6; }
+if test "x$ac_cv_lib_m_cos" = xyes; then :
+ LIBM="-lm"
+fi
+
+ ;;
+esac
+
+
+
for ac_header in fenv.h langinfo.h locale.h wchar.h wctype.h limits.h ctype.h printf.h errno.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
@@ -13459,6 +13663,10 @@ if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then
as_fn_error $? "conditional \"BUILD_INFO\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libquadmath/configure.ac b/libquadmath/configure.ac
index eec4084a45f..94a3f2179e9 100644
--- a/libquadmath/configure.ac
+++ b/libquadmath/configure.ac
@@ -59,6 +59,7 @@ AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
AM_MAINTAINER_MODE
@@ -121,6 +122,8 @@ esac
AC_SUBST(toolexecdir)
AC_SUBST(toolexeclibdir)
+AC_CHECK_LIBM
+
AC_CHECK_HEADERS(fenv.h langinfo.h locale.h wchar.h wctype.h limits.h ctype.h printf.h errno.h)
LIBQUAD_CHECK_MATH_H_SIGNGAM
diff --git a/libsanitizer/asan/Makefile.am b/libsanitizer/asan/Makefile.am
index 4f802f723d6..223d3e07816 100644
--- a/libsanitizer/asan/Makefile.am
+++ b/libsanitizer/asan/Makefile.am
@@ -60,7 +60,12 @@ libasan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
libasan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libasan)
+if ENABLE_DARWIN_AT_RPATH
+libasan_darwin_rpath = -Wc,-nodefaultrpaths
+libasan_darwin_rpath += -Wl,-rpath,@loader_path
+endif
+libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libasan) $(libasan_darwin_rpath)
libasan_preinit.o: asan_preinit.o
cp $< $@
diff --git a/libsanitizer/asan/Makefile.in b/libsanitizer/asan/Makefile.in
index 7833a9a4c3f..e88e5e0b0a7 100644
--- a/libsanitizer/asan/Makefile.in
+++ b/libsanitizer/asan/Makefile.in
@@ -465,7 +465,12 @@ libasan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(top_builddir)/lsan/libsanitizer_lsan.la $(am__append_2) \
$(am__append_3) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libasan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libasan_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libasan) $(libasan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
diff --git a/libsanitizer/configure b/libsanitizer/configure
index 0805d254fe5..2edd5c37ce7 100755
--- a/libsanitizer/configure
+++ b/libsanitizer/configure
@@ -666,6 +666,8 @@ LSAN_SUPPORTED_FALSE
LSAN_SUPPORTED_TRUE
TSAN_SUPPORTED_FALSE
TSAN_SUPPORTED_TRUE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
CXXCPP
@@ -817,6 +819,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_werror
with_gcc_major_version_only
enable_cet
@@ -1471,6 +1474,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--disable-werror disable building with -Werror
--enable-cet enable Intel CET in target libraries [default=auto]
@@ -8891,7 +8897,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10596,6 +10602,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10613,9 +10662,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12421,7 +12474,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12424 "configure"
+#line 12477 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12527,7 +12580,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12530 "configure"
+#line 12583 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13403,6 +13456,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13420,12 +13516,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15845,6 +15949,15 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
@@ -17243,6 +17356,10 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${TSAN_SUPPORTED_TRUE}" && test -z "${TSAN_SUPPORTED_FALSE}"; then
as_fn_error $? "conditional \"TSAN_SUPPORTED\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libsanitizer/configure.ac b/libsanitizer/configure.ac
index 04cd8910ed6..5906c8d4887 100644
--- a/libsanitizer/configure.ac
+++ b/libsanitizer/configure.ac
@@ -85,6 +85,8 @@ esac
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
AC_CHECK_SIZEOF([void *])
if test "${multilib}" = "yes"; then
diff --git a/libsanitizer/hwasan/Makefile.am b/libsanitizer/hwasan/Makefile.am
index bb7f8fa0b7b..653fc8c4720 100644
--- a/libsanitizer/hwasan/Makefile.am
+++ b/libsanitizer/hwasan/Makefile.am
@@ -47,7 +47,11 @@ libhwasan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
libhwasan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libhwasan)
+if ENABLE_DARWIN_AT_RPATH
+libhwasan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
+libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libhwasan) $(libhwasan_darwin_rpath)
libhwasan_preinit.o: hwasan_preinit.o
cp $< $@
diff --git a/libsanitizer/hwasan/Makefile.in b/libsanitizer/hwasan/Makefile.in
index 58bc26b44b9..87971fd3374 100644
--- a/libsanitizer/hwasan/Makefile.in
+++ b/libsanitizer/hwasan/Makefile.in
@@ -447,7 +447,10 @@ libhwasan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(top_builddir)/lsan/libsanitizer_lsan.la $(am__append_1) \
$(am__append_2) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libhwasan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libhwasan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/
+libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libhwasan) $(libhwasan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
diff --git a/libsanitizer/lsan/Makefile.am b/libsanitizer/lsan/Makefile.am
index 6ff28ff5eea..7701b0e18cf 100644
--- a/libsanitizer/lsan/Makefile.am
+++ b/libsanitizer/lsan/Makefile.am
@@ -41,8 +41,12 @@ if LIBBACKTRACE_SUPPORTED
liblsan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
liblsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_liblsan)
-
+if ENABLE_DARWIN_AT_RPATH
+liblsan_darwin_rpath = -Wc,-nodefaultrpaths
+liblsan_darwin_rpath += -Wl,-rpath,@loader_path
+endif
+liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_liblsan) $(liblsan_darwin_rpath)
liblsan_preinit.o: lsan_preinit.o
cp $< $@
diff --git a/libsanitizer/lsan/Makefile.in b/libsanitizer/lsan/Makefile.in
index d8fd4ee9557..078edf01fda 100644
--- a/libsanitizer/lsan/Makefile.in
+++ b/libsanitizer/lsan/Makefile.in
@@ -413,7 +413,12 @@ liblsan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(top_builddir)/interception/libinterception.la \
$(am__append_1) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_liblsan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@liblsan_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_liblsan) $(liblsan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
@@ -788,7 +793,6 @@ uninstall-am: uninstall-nodist_toolexeclibHEADERS \
.PRECIOUS: Makefile
-
liblsan_preinit.o: lsan_preinit.o
cp $< $@
diff --git a/libsanitizer/tsan/Makefile.am b/libsanitizer/tsan/Makefile.am
index da80743da9d..01290b0313d 100644
--- a/libsanitizer/tsan/Makefile.am
+++ b/libsanitizer/tsan/Makefile.am
@@ -57,7 +57,11 @@ libtsan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
libtsan_la_DEPENDENCIES +=$(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
libtsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libtsan)
+if ENABLE_DARWIN_AT_RPATH
+libtsan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
+libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libtsan) $(libtsan_darwin_rpath)
libtsan_preinit.o: tsan_preinit.o
cp $< $@
diff --git a/libsanitizer/tsan/Makefile.in b/libsanitizer/tsan/Makefile.in
index 36498832bb8..95011584bcb 100644
--- a/libsanitizer/tsan/Makefile.in
+++ b/libsanitizer/tsan/Makefile.in
@@ -464,7 +464,10 @@ libtsan_la_DEPENDENCIES = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(top_builddir)/interception/libinterception.la \
$(TSAN_TARGET_DEPENDENT_OBJECTS) $(am__append_2)
-libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libtsan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libtsan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/
+libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libtsan) $(libtsan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
diff --git a/libsanitizer/ubsan/Makefile.am b/libsanitizer/ubsan/Makefile.am
index d480f26adc0..7769b3437e4 100644
--- a/libsanitizer/ubsan/Makefile.am
+++ b/libsanitizer/ubsan/Makefile.am
@@ -36,7 +36,12 @@ if LIBBACKTRACE_SUPPORTED
libubsan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
libubsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libubsan)
+if ENABLE_DARWIN_AT_RPATH
+libubsan_darwin_rpath = -Wc,-nodefaultrpaths
+libubsan_darwin_rpath += -Wl,-rpath,@loader_path
+endif
+libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libubsan) $(libubsan_darwin_rpath)
# Use special rules for files that require RTTI support.
ubsan_handlers_cxx.% ubsan_type_hash.% ubsan_type_hash_itanium.% : AM_CXXFLAGS += -frtti
diff --git a/libsanitizer/ubsan/Makefile.in b/libsanitizer/ubsan/Makefile.in
index 92a8e387fd7..7e51480e970 100644
--- a/libsanitizer/ubsan/Makefile.in
+++ b/libsanitizer/ubsan/Makefile.in
@@ -400,7 +400,12 @@ libubsan_la_SOURCES = $(ubsan_files)
libubsan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(am__append_1) $(am__append_2) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libubsan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libubsan_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libubsan) $(libubsan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
diff --git a/libssp/Makefile.am b/libssp/Makefile.am
index 1636e43b369..f7ed2aa6043 100644
--- a/libssp/Makefile.am
+++ b/libssp/Makefile.am
@@ -49,8 +49,12 @@ libssp_la_SOURCES = \
vsnprintf-chk.c vsprintf-chk.c
libssp_la_LIBADD =
libssp_la_DEPENDENCIES = $(version_dep) $(libssp_la_LIBADD)
+if ENABLE_DARWIN_AT_RPATH
+libssp_darwin_rpath = -Wc,-nodefaultrpaths
+libssp_darwin_rpath += -Wl,-rpath,@loader_path
+endif
libssp_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
- $(version_arg) $(lt_host_flags)
+ $(version_arg) $(lt_host_flags) $(libssp_darwin_rpath)
libssp_nonshared_la_SOURCES = \
ssp-local.c
diff --git a/libssp/Makefile.in b/libssp/Makefile.in
index bc8a0dc2b28..1cf86361b96 100644
--- a/libssp/Makefile.in
+++ b/libssp/Makefile.in
@@ -376,8 +376,11 @@ libssp_la_SOURCES = \
libssp_la_LIBADD =
libssp_la_DEPENDENCIES = $(version_dep) $(libssp_la_LIBADD)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libssp_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
libssp_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
- $(version_arg) $(lt_host_flags)
+ $(version_arg) $(lt_host_flags) $(libssp_darwin_rpath)
libssp_nonshared_la_SOURCES = \
ssp-local.c
diff --git a/libssp/configure b/libssp/configure
index 7f8b8fdf99d..a31b69f306e 100755
--- a/libssp/configure
+++ b/libssp/configure
@@ -636,6 +636,8 @@ LIBOBJS
get_gcc_base_ver
toolexeclibdir
toolexecdir
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -781,6 +783,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
with_toolexeclibdir
with_gcc_major_version_only
'
@@ -1426,6 +1429,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -7496,7 +7502,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9208,6 +9214,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9225,9 +9274,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11054,7 +11107,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11057 "configure"
+#line 11110 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11160,7 +11213,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11163 "configure"
+#line 11216 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11438,6 +11491,15 @@ fi
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# Calculate toolexeclibdir
# Also toolexecdir, though it's only used in toolexeclibdir
case ${version_specific_libs} in
@@ -11647,6 +11709,10 @@ if test -z "${LIBSSP_USE_SYMVER_SUN_TRUE}" && test -z "${LIBSSP_USE_SYMVER_SUN_F
as_fn_error $? "conditional \"LIBSSP_USE_SYMVER_SUN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/libssp/configure.ac b/libssp/configure.ac
index f30f81c54f6..90778e2355d 100644
--- a/libssp/configure.ac
+++ b/libssp/configure.ac
@@ -165,6 +165,8 @@ AC_SUBST(enable_static)
GCC_WITH_TOOLEXECLIBDIR
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
# Calculate toolexeclibdir
# Also toolexecdir, though it's only used in toolexeclibdir
case ${version_specific_libs} in
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index c4da56c3042..b2b121a0936 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -789,6 +789,8 @@ GLIBCXX_HOSTED_TRUE
glibcxx_compiler_shared_flag
glibcxx_compiler_pic_flag
glibcxx_lt_pic_flag
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -924,6 +926,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_hosted_libstdcxx
enable_libstdcxx_hosted
enable_libstdcxx_verbose
@@ -1615,6 +1618,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--disable-hosted-libstdcxx
only build freestanding C++ runtime support
--disable-libstdcxx-hosted
@@ -8539,7 +8545,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10379,6 +10385,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10396,9 +10445,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12225,7 +12278,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12228 "configure"
+#line 12281 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12331,7 +12384,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12334 "configure"
+#line 12387 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13213,6 +13266,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13230,12 +13326,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15632,6 +15736,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
if test "$enable_vtable_verify" = yes; then
predep_objects_CXX="${predep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_start.o"
@@ -16055,7 +16167,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; }
# Fake what AC_TRY_COMPILE does.
cat > conftest.$ac_ext << EOF
-#line 16058 "configure"
+#line 16170 "configure"
int main()
{
typedef bool atomic_type;
@@ -16090,7 +16202,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16093 "configure"
+#line 16205 "configure"
int main()
{
typedef short atomic_type;
@@ -16125,7 +16237,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16128 "configure"
+#line 16240 "configure"
int main()
{
// NB: _Atomic_word not necessarily int.
@@ -16161,7 +16273,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16164 "configure"
+#line 16276 "configure"
int main()
{
typedef long long atomic_type;
@@ -16317,7 +16429,7 @@ $as_echo "mutex" >&6; }
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 16320 "configure"
+#line 16432 "configure"
int main()
{
_Decimal32 d1;
@@ -16359,7 +16471,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 16362 "configure"
+#line 16474 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
@@ -74906,6 +75018,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${GLIBCXX_HOSTED_TRUE}" && test -z "${GLIBCXX_HOSTED_FALSE}"; then
as_fn_error $? "conditional \"GLIBCXX_HOSTED\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index fc0f2522027..80e573e690f 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -108,6 +108,7 @@ AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
if test "$enable_vtable_verify" = yes; then
predep_objects_CXX="${predep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_start.o"
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index 5b9af41cdb9..925137c2ccc 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -152,8 +152,13 @@ libstdc___la_DEPENDENCIES = \
$(top_builddir)/src/c++17/libc++17convenience.la \
$(top_builddir)/src/c++20/libc++20convenience.la
+if ENABLE_DARWIN_AT_RPATH
+libstdc___darwin_rpath = -Wc,-nodefaultrpaths
+libstdc___darwin_rpath += -Wl,-rpath,@loader_path
+endif
+
libstdc___la_LDFLAGS = \
- -version-info $(libtool_VERSION) ${version_arg} -lm
+ -version-info $(libtool_VERSION) ${version_arg} -lm $(libstdc___darwin_rpath)
libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) $(lt_host_flags)
diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
index f42d957af36..0ce75f30708 100644
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -560,8 +560,11 @@ libstdc___la_DEPENDENCIES = \
$(top_builddir)/src/c++17/libc++17convenience.la \
$(top_builddir)/src/c++20/libc++20convenience.la
+@ENABLE_DARWIN_AT_RPATH_TRUE@libstdc___darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
libstdc___la_LDFLAGS = \
- -version-info $(libtool_VERSION) ${version_arg} -lm
+ -version-info $(libtool_VERSION) ${version_arg} -lm $(libstdc___darwin_rpath)
libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) $(lt_host_flags)
@GLIBCXX_LDBL_ALT128_COMPAT_FALSE@@GLIBCXX_LDBL_COMPAT_TRUE@LTCXXCOMPILE64 = $(LTCXXCOMPILE)
diff --git a/libtool.m4 b/libtool.m4
index e36fdd3c0e2..7f8ae26db62 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -1005,7 +1005,7 @@ _LT_EOF
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[[89]]*|UNSET,*-darwin[[12]][[0123456789]]*)
+ UNSET,*-darwin[[89]]*|UNSET,*-darwin[[12]][[0-9]]*)
;;
10.[[012]][[,.]]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -1039,6 +1039,45 @@ _LT_EOF
m4_defun([_LT_DARWIN_LINKER_FEATURES],
[
m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ AC_ARG_ENABLE([darwin-at-rpath],
+ AS_HELP_STRING([--enable-darwin-at-rpath],
+ [install libraries with @rpath/library-name, requires rpaths to be added to executables]),
+ [if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[[4-8]]*|UNSET,rhapsody*|10.[[0-4]][[,.]]*)
+ AC_MSG_WARN([Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)])
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi],
+ [case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[[4-8]]*|UNSET,rhapsody*|10.[[0-4]][[,.]]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[[5-9]]*|UNSET,darwin2*|10.1[[1-9]][[,.]]*|1[[1-9]].*[[,.]]* )
+ AC_MSG_NOTICE([@rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)])
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+ ])
+
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_automatic, $1)=yes
@@ -1056,13 +1095,21 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
_LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
_LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
m4_if([$1], [CXX],
[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
_LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
],[])
@@ -4265,6 +4312,7 @@ _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
[Compiler flag to prevent dynamic linking])
])# _LT_COMPILER_PIC
+_LT_TAGVAR(enable_darwin_at_rpath, $1)=no
# _LT_LINKER_SHLIBS([TAGNAME])
# ----------------------------
@@ -6504,7 +6552,6 @@ fi # test "$_lt_caught_CXX_error" != yes
AC_LANG_POP
])# _LT_LANG_CXX_CONFIG
-
# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
# ---------------------------------
# Figure out "hidden" library dependencies from verbose
diff --git a/libvtv/configure b/libvtv/configure
index 917557103e9..a7889161c50 100755
--- a/libvtv/configure
+++ b/libvtv/configure
@@ -640,6 +640,8 @@ VTV_CYGMIN_FALSE
VTV_CYGMIN_TRUE
XCFLAGS
libtool_VERSION
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -797,6 +799,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_cet
with_gcc_major_version_only
'
@@ -1446,6 +1449,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-cet enable Intel CET in target libraries [default=auto]
Optional Packages:
@@ -8786,7 +8792,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10491,6 +10497,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10508,9 +10557,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12316,7 +12369,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12319 "configure"
+#line 12372 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12422,7 +12475,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12425 "configure"
+#line 12478 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13298,6 +13351,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13315,12 +13411,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15714,6 +15818,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=1:0:0
@@ -16059,6 +16171,10 @@ if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${VTV_CYGMIN_TRUE}" && test -z "${VTV_CYGMIN_FALSE}"; then
as_fn_error $? "conditional \"VTV_CYGMIN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libvtv/configure.ac b/libvtv/configure.ac
index f3b937e4b10..50aaadbb3a3 100644
--- a/libvtv/configure.ac
+++ b/libvtv/configure.ac
@@ -153,6 +153,7 @@ AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=1:0:0
diff --git a/lto-plugin/configure b/lto-plugin/configure
index 37c44d04a0d..28f5dd79cd7 100755
--- a/lto-plugin/configure
+++ b/lto-plugin/configure
@@ -634,6 +634,8 @@ LTLIBOBJS
LIBOBJS
target_noncanonical
lt_host_flags
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
OTOOL64
OTOOL
LIPO
@@ -788,6 +790,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
'
ac_precious_vars='build_alias
host_alias
@@ -1434,6 +1437,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -8657,7 +8663,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10363,6 +10369,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10380,9 +10429,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12188,7 +12241,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12191 "configure"
+#line 12244 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12294,7 +12347,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12297 "configure"
+#line 12350 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12531,6 +12584,14 @@ CC="$lt_save_CC"
# Only expand once:
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
@@ -12777,6 +12838,10 @@ if test -z "${LTO_PLUGIN_USE_SYMVER_SUN_TRUE}" && test -z "${LTO_PLUGIN_USE_SYMV
as_fn_error $? "conditional \"LTO_PLUGIN_USE_SYMVER_SUN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/lto-plugin/configure.ac b/lto-plugin/configure.ac
index 84f2a60b480..c051b8c6283 100644
--- a/lto-plugin/configure.ac
+++ b/lto-plugin/configure.ac
@@ -121,6 +121,7 @@ fi
AC_SUBST(ac_lto_plugin_extra_ldflags)
AM_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
ACX_LT_HOST_FLAGS
AC_SUBST(target_noncanonical)
AC_TYPE_INT64_T
diff --git a/zlib/configure b/zlib/configure
index 273ac36647d..92c462d04c6 100755
--- a/zlib/configure
+++ b/zlib/configure
@@ -641,6 +641,8 @@ TARGET_LIBRARY_FALSE
TARGET_LIBRARY_TRUE
toolexeclibdir
toolexecdir
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
CPP
OTOOL64
OTOOL
@@ -778,6 +780,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
with_toolexeclibdir
enable_host_shared
enable_host_pie
@@ -1422,6 +1425,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-host-shared build host code as shared libraries
--enable-host-pie build host code as PIE
@@ -6976,7 +6982,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -8955,6 +8961,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -8972,9 +9021,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -10801,7 +10854,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10804 "configure"
+#line 10857 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10907,7 +10960,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10910 "configure"
+#line 10963 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11144,6 +11197,14 @@ CC="$lt_save_CC"
# Only expand once:
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
# Find CPP now so that any conditional tests below won't do it and
# thereby make the resulting definitions conditional.
@@ -11790,6 +11851,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${TARGET_LIBRARY_TRUE}" && test -z "${TARGET_LIBRARY_FALSE}"; then
as_fn_error $? "conditional \"TARGET_LIBRARY\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/zlib/configure.ac b/zlib/configure.ac
index adf7aad4e51..9501cdfea85 100644
--- a/zlib/configure.ac
+++ b/zlib/configure.ac
@@ -64,6 +64,7 @@ GCC_CET_FLAGS(CET_FLAGS)
AC_SUBST(CET_FLAGS)
AC_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
# Find CPP now so that any conditional tests below won't do it and
# thereby make the resulting definitions conditional.
--
2.34.1
[-- Attachment #4: 0003-Darwin-rpaths-Add-with-darwin-extra-rpath.patch --]
[-- Type: application/octet-stream, Size: 6077 bytes --]
From a9a9261701d0e65422229d4cca63e5ea045d1474 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Sat, 28 May 2022 10:16:27 +0100
Subject: [PATCH 3/5] Darwin, rpaths: Add --with-darwin-extra-rpath.
This is provided to allow distributions to add a single additional
runpath to allow for cases where the installed GCC library directories
are then symlinked to a common dirctory outside of any of the GCC
installations.
For example:
/opt/distro/lib:
libgfortran.dylib -> /opt/distro/lib/gcc-11.3/lib/libgfortran.dylib
So that libraries which are designed to be found in the runpath we would then
add --with-darwin-add-rpath=/opt/distro/lib to the configure line.
This patch makes the configuration a little more forgiving of using
--disable-darwin-at-rpath (although for platform versions >= 10.11 this will
result in misconfigured target libraries).
gcc/ChangeLog:
* configure.ac: Add --with-darwin-extra-rpath option.
* config/darwin.h: Handle DARWIN_EXTRA_RPATH.
* config.in: Regenerate.
* configure: Regenerate.
---
gcc/config.in | 13 +++++++++++++
gcc/config/darwin.h | 14 ++++++++++++++
gcc/configure | 28 ++++++++++++++++++++++++++--
gcc/configure.ac | 13 +++++++++++++
4 files changed, 66 insertions(+), 2 deletions(-)
diff --git a/gcc/config.in b/gcc/config.in
index 5cf51bc1b01..9bda18ab64b 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -49,6 +49,19 @@
#endif
+/* Specify a runpath directory, additional to those provided by the compiler
+ */
+#ifndef USED_FOR_TARGET
+#undef DARWIN_ADD_RPATH
+#endif
+
+
+/* Should add an extra runpath directory */
+#ifndef USED_FOR_TARGET
+#undef DARWIN_DO_EXTRA_RPATH
+#endif
+
+
/* Define to enable the use of a default assembler. */
#ifndef USED_FOR_TARGET
#undef DEFAULT_ASSEMBLER
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 44c92db6214..d1bf7b670a7 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -321,6 +321,19 @@ extern GTY(()) int darwin_ms_struct;
%:version-compare(>= 10.11 mmacosx-version-min= -lemutls_w) "
#endif
+/* We might elect to add a path even when this compiler does not use embedded
+ run paths, so that we can use libraries from an alternate compiler that is
+ using embedded runpaths. */
+#if DARWIN_DO_EXTRA_RPATH
+# define DARWIN_EXTRA_RPATH \
+"%{!r:%{!nostdlib:%{!nodefaultrpaths:\
+ %:version-compare(>= 10.5 mmacosx-version-min= -rpath) \
+ %:version-compare(>= 10.5 mmacosx-version-min= " DARWIN_ADD_RPATH ") \
+ }}}"
+#else
+# define DARWIN_EXTRA_RPATH ""
+#endif
+
#define SUBSUBTARGET_OVERRIDE_OPTIONS \
do { \
darwin_override_options (); \
@@ -415,6 +428,7 @@ extern GTY(()) int darwin_ms_struct;
DARWIN_NOPIE_SPEC \
DARWIN_RDYNAMIC \
DARWIN_NOCOMPACT_UNWIND \
+ DARWIN_EXTRA_RPATH \
DARWIN_RPATH_LINK \
"}}}}}}} %<pie %<no-pie %<rdynamic %<X %<rpath %<nodefaultrpaths "
diff --git a/gcc/configure b/gcc/configure
index eaa1a189583..13472fcfc3c 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1009,6 +1009,7 @@ with_pic
enable_fast_install
enable_libtool_lock
enable_darwin_at_rpath
+with_darwin_extra_rpath
enable_ld
enable_gold
with_plugin_ld
@@ -1870,6 +1871,9 @@ Optional Packages:
--with-pic try to use only PIC/non-PIC objects [default=use
both]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
+ --with-darwin-extra-rpath=[ARG]
+ Specify a runpath directory, additional to those
+ provided by the compiler
--with-plugin-ld=[ARG] specify the plugin linker
--with-glibc-version=M.N
assume GCC used with glibc version M.N or later
@@ -19939,7 +19943,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19942 "configure"
+#line 19946 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -20045,7 +20049,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 20048 "configure"
+#line 20052 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -23373,6 +23377,26 @@ else
ENABLE_DARWIN_AT_RPATH_FALSE=
fi
+DARWIN_DO_EXTRA_RPATH=0
+
+# Check whether --with-darwin-extra-rpath was given.
+if test "${with_darwin_extra_rpath+set}" = set; then :
+ withval=$with_darwin_extra_rpath; if test x"$withval" != x; then
+ DARWIN_ADD_RPATH="$withval"
+ DARWIN_DO_EXTRA_RPATH=1
+ fi
+fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define DARWIN_DO_EXTRA_RPATH $DARWIN_DO_EXTRA_RPATH
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define DARWIN_ADD_RPATH "$DARWIN_ADD_RPATH"
+_ACEOF
+
# Identify the assembler which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the assembler
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 80e31229408..84175a5d7ce 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2600,6 +2600,19 @@ AC_SUBST(objdir)
AC_SUBST(enable_fast_install)
AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+DARWIN_DO_EXTRA_RPATH=0
+AC_ARG_WITH(darwin-extra-rpath,
+[AS_HELP_STRING(
+ [[--with-darwin-extra-rpath=[ARG]]],
+ [Specify a runpath directory, additional to those provided by the compiler])],
+[if test x"$withval" != x; then
+ DARWIN_ADD_RPATH="$withval"
+ DARWIN_DO_EXTRA_RPATH=1
+ fi])
+AC_DEFINE_UNQUOTED(DARWIN_DO_EXTRA_RPATH, $DARWIN_DO_EXTRA_RPATH,
+ [Should add an extra runpath directory])
+AC_DEFINE_UNQUOTED(DARWIN_ADD_RPATH, "$DARWIN_ADD_RPATH",
+ [Specify a runpath directory, additional to those provided by the compiler])
# Identify the assembler which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the assembler
--
2.34.1
[-- Attachment #5: 0004-Testsuite-allow-non-installed-testing-on-darwin.patch --]
[-- Type: application/octet-stream, Size: 12797 bytes --]
From 5def92789b13e4cf277096b580b2fc8017a6af1f Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Fri, 16 Apr 2021 20:01:40 +0100
Subject: [PATCH 4/5] Testsuite: allow non-installed testing on darwin
DYLD_LIBRARY_PATH is now removed from the environment for all system
tools, including the shell. Adapt the testsuite and pass the right
options to allow testing, even when the compiler and libraries have not
been installed.
gcc/ChangeLog:
* Makefile.in: set ENABLE_DARWIN_AT_RPATH in site.tmp.
gcc/testsuite/ChangeLog:
* gfortran.dg/coarray/caf.exp: Correctly set
libatomic flags.
* gfortran.dg/dg.exp: Likewise.
* lib/asan-dg.exp: Set correct -B flags.
* lib/atomic-dg.exp: Likewise.
* lib/target-libpath.exp: Handle ENABLE_DARWIN_AT_RPATH.
libatomic/ChangeLog:
* testsuite/lib/libatomic.exp: Pass correct flags on darwin.
libffi/ChangeLog:
* testsuite/lib/libffi.exp: Likewise.
libitm/ChangeLog:
* testsuite/lib/libitm.exp: Likewise.
* testsuite/libitm.c++/c++.exp: Likewise.
---
gcc/Makefile.in | 3 +++
gcc/testsuite/gfortran.dg/coarray/caf.exp | 16 +++++++++---
gcc/testsuite/gfortran.dg/dg.exp | 32 ++++++++++++++++++++---
gcc/testsuite/lib/asan-dg.exp | 2 +-
gcc/testsuite/lib/atomic-dg.exp | 2 +-
gcc/testsuite/lib/target-libpath.exp | 23 +++++++++++++---
libatomic/testsuite/lib/libatomic.exp | 8 ++++--
libffi/testsuite/lib/libffi.exp | 11 +++++---
libitm/testsuite/lib/libitm.exp | 1 +
libitm/testsuite/libitm.c++/c++.exp | 4 ++-
10 files changed, 84 insertions(+), 18 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 60ba2916457..023dba2159c 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -4209,6 +4209,9 @@ site.exp: ./config.status Makefile
echo "set COMPAT_OPTIONS \"$(COMPAT_OPTIONS)\"" >> ./site.tmp; \
else true; \
fi
+ @if test "x@enable_darwin_at_rpath@" = "xyes" ; then \
+ echo "set ENABLE_DARWIN_AT_RPATH 1" >> ./site.tmp; \
+ fi
@echo "## All variables above are generated by configure. Do Not Edit ##" >> ./site.tmp
@cat ./site.tmp > site.exp
@cat site.bak | sed \
diff --git a/gcc/testsuite/gfortran.dg/coarray/caf.exp b/gcc/testsuite/gfortran.dg/coarray/caf.exp
index d232be2fa90..1c94743a977 100644
--- a/gcc/testsuite/gfortran.dg/coarray/caf.exp
+++ b/gcc/testsuite/gfortran.dg/coarray/caf.exp
@@ -28,6 +28,7 @@
# Load procedures from common libraries.
load_lib gfortran-dg.exp
+load_lib atomic-dg.exp
# If a testcase doesn't have special options, use these.
global DEFAULT_FFLAGS
@@ -47,6 +48,7 @@ global gfortran_test_path
global gfortran_aux_module_flags
set gfortran_test_path $srcdir/$subdir
set gfortran_aux_module_flags $DEFAULT_FFLAGS
+
proc dg-compile-aux-modules { args } {
global gfortran_test_path
global gfortran_aux_module_flags
@@ -71,7 +73,15 @@ proc dg-compile-aux-modules { args } {
# Add -latomic only where supported. Assume built-in support elsewhere.
set maybe_atomic_lib ""
if [check_effective_target_libatomic_available] {
- set maybe_atomic_lib "-latomic"
+ if ![is_remote host] {
+ if [info exists TOOL_OPTIONS] {
+ set maybe_atomic_lib "[atomic_link_flags [get_multilibs ${TOOL_OPTIONS}]]"
+ } else {
+ set maybe_atomic_lib "[atomic_link_flags [get_multilibs]]"
+ }
+ }
+ set t [get_multilibs]
+ puts "maybe al $maybe_atomic_lib ml $t"
}
# Main loop.
@@ -97,14 +107,14 @@ foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ]]
foreach flags $option_list {
verbose "Testing $nshort (single), $flags" 1
set gfortran_aux_module_flags "-fcoarray=single $flags"
- dg-test $test "-fcoarray=single $flags $maybe_atomic_lib" ""
+ dg-test $test "-fcoarray=single $flags" $maybe_atomic_lib
cleanup-modules ""
}
foreach flags $option_list {
verbose "Testing $nshort (libcaf_single), $flags" 1
set gfortran_aux_module_flags "-fcoarray=lib $flags -lcaf_single"
- dg-test $test "-fcoarray=lib $flags -lcaf_single $maybe_atomic_lib" ""
+ dg-test $test "-fcoarray=lib $flags -lcaf_single" $maybe_atomic_lib
cleanup-modules ""
}
}
diff --git a/gcc/testsuite/gfortran.dg/dg.exp b/gcc/testsuite/gfortran.dg/dg.exp
index ee2760327dc..73541ea7301 100644
--- a/gcc/testsuite/gfortran.dg/dg.exp
+++ b/gcc/testsuite/gfortran.dg/dg.exp
@@ -18,6 +18,7 @@
# Load support procs.
load_lib gfortran-dg.exp
+load_lib atomic-dg.exp
# If a testcase doesn't have special options, use these.
global DEFAULT_FFLAGS
@@ -53,13 +54,38 @@ proc dg-compile-aux-modules { args } {
}
}
+# coarray tests might need libatomic. Assume that it is either not needed or
+# provided by builtins if it's not available.
+set maybe_atomic_lib ""
+if [check_effective_target_libatomic_available] {
+ if ![is_remote host] {
+ if [info exists TOOL_OPTIONS] {
+ set maybe_atomic_lib "[atomic_link_flags [get_multilibs ${TOOL_OPTIONS}]]"
+ } else {
+ set maybe_atomic_lib "[atomic_link_flags [get_multilibs]]"
+ }
+ } else {
+ set maybe_atomic_lib ""
+ }
+ set t [get_multilibs]
+ puts "dg set al $maybe_atomic_lib ml $t"
+}
+
+set all_flags $DEFAULT_FFLAGS
+if { $maybe_atomic_lib != "" } {
+ foreach f $maybe_atomic_lib {
+ lappend all_flags $f
+ }
+}
+
+puts "revised FFLAGS $all_flags"
+
# Main loop.
gfortran-dg-runtest [lsort \
- [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ] ] "" $DEFAULT_FFLAGS
+ [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ] ] "" $all_flags
gfortran-dg-runtest [lsort \
- [glob -nocomplain $srcdir/$subdir/g77/*.\[fF\] ] ] "" $DEFAULT_FFLAGS
-
+ [glob -nocomplain $srcdir/$subdir/g77/*.\[fF\] ] ] "" $all_flags
# All done.
dg-finish
diff --git a/gcc/testsuite/lib/asan-dg.exp b/gcc/testsuite/lib/asan-dg.exp
index 35e60eaaed5..157b60908d6 100644
--- a/gcc/testsuite/lib/asan-dg.exp
+++ b/gcc/testsuite/lib/asan-dg.exp
@@ -78,7 +78,7 @@ proc asan_link_flags_1 { paths lib } {
|| [file exists "${gccpath}/libsanitizer/${lib}/.libs/lib${lib}.${shlib_ext}"] } {
append flags " -B${gccpath}/libsanitizer/ "
append flags " -B${gccpath}/libsanitizer/${lib}/ "
- append flags " -L${gccpath}/libsanitizer/${lib}/.libs "
+ append flags " -B${gccpath}/libsanitizer/${lib}/.libs "
append ld_library_path ":${gccpath}/libsanitizer/${lib}/.libs"
}
} else {
diff --git a/gcc/testsuite/lib/atomic-dg.exp b/gcc/testsuite/lib/atomic-dg.exp
index 1589acd8eaf..ce1799cef2d 100644
--- a/gcc/testsuite/lib/atomic-dg.exp
+++ b/gcc/testsuite/lib/atomic-dg.exp
@@ -33,7 +33,7 @@ proc atomic_link_flags { paths } {
if { [file exists "${gccpath}/libatomic/.libs/libatomic.a"]
|| [file exists "${gccpath}/libatomic/.libs/libatomic.${shlib_ext}"] } {
append flags " -B${gccpath}/libatomic/ "
- append flags " -L${gccpath}/libatomic/.libs"
+ append flags " -B${gccpath}/libatomic/.libs"
append ld_library_path ":${gccpath}/libatomic/.libs"
}
} else {
diff --git a/gcc/testsuite/lib/target-libpath.exp b/gcc/testsuite/lib/target-libpath.exp
index 6d530fb4af6..5de039b4fc2 100644
--- a/gcc/testsuite/lib/target-libpath.exp
+++ b/gcc/testsuite/lib/target-libpath.exp
@@ -67,6 +67,7 @@ proc set_ld_library_path_env_vars { } {
global orig_dyld_library_path
global orig_path
global orig_gcc_exec_prefix
+ global ENABLE_DARWIN_AT_RPATH
global env
# Save the original GCC_EXEC_PREFIX.
@@ -133,6 +134,7 @@ proc set_ld_library_path_env_vars { } {
#
# Doing this is somewhat of a hack as ld_library_path gets repeated in
# SHLIB_PATH and LD_LIBRARY_PATH when unix_load sets these variables.
+ if { ![istarget *-*-darwin*] } {
if { $orig_ld_library_path_saved } {
setenv LD_LIBRARY_PATH "$ld_library_path:$orig_ld_library_path"
} else {
@@ -166,11 +168,23 @@ proc set_ld_library_path_env_vars { } {
} else {
setenv LD_LIBRARY_PATH_64 "$ld_library_path"
}
- if { $orig_dyld_library_path_saved } {
- setenv DYLD_LIBRARY_PATH "$ld_library_path:$orig_dyld_library_path"
- } else {
- setenv DYLD_LIBRARY_PATH "$ld_library_path"
}
+ if { [istarget *-*-darwin*] } {
+ if { [info exists ENABLE_DARWIN_AT_RPATH] || [istarget *-*-darwin1\[5-9\]*]
+ || [istarget *-*-darwin20*] } {
+ # Either we are not using DYLD_LIBRARY_PATH or we're on a version of the
+ # OS for which it is not passed through system exes.
+ if [info exists env(DYLD_LIBRARY_PATH)] {
+ unsetenv DYLD_LIBRARY_PATH
+ }
+ } else {
+ if { $orig_dyld_library_path_saved } {
+ setenv DYLD_LIBRARY_PATH "$ld_library_path:$orig_dyld_library_path"
+ } else {
+ setenv DYLD_LIBRARY_PATH "$ld_library_path"
+ }
+ }
+ }
if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } {
if { $orig_path_saved } {
setenv PATH "$ld_library_path:$orig_path"
@@ -179,6 +193,7 @@ proc set_ld_library_path_env_vars { } {
}
}
+ verbose -log "set paths"
verbose -log "LD_LIBRARY_PATH=[getenv LD_LIBRARY_PATH]"
verbose -log "LD_RUN_PATH=[getenv LD_RUN_PATH]"
verbose -log "SHLIB_PATH=[getenv SHLIB_PATH]"
diff --git a/libatomic/testsuite/lib/libatomic.exp b/libatomic/testsuite/lib/libatomic.exp
index 10f38475bc8..c6d645e9ae3 100644
--- a/libatomic/testsuite/lib/libatomic.exp
+++ b/libatomic/testsuite/lib/libatomic.exp
@@ -148,11 +148,15 @@ proc libatomic_init { args } {
if { $blddir != "" } {
lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/"
lappend ALWAYS_CFLAGS "additional_flags=-I${blddir}"
- lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs"
+ if [istarget *-*-darwin*] {
+ lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/.libs"
+ } else {
+ lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs"
+ }
}
lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/.."
- if [istarget *-*-darwin*] {
+ if [istarget *-*-darwin\[89\]*] {
lappend ALWAYS_CFLAGS "additional_flags=-shared-libgcc"
}
diff --git a/libffi/testsuite/lib/libffi.exp b/libffi/testsuite/lib/libffi.exp
index 15d3d5ebd73..611f5177c7a 100644
--- a/libffi/testsuite/lib/libffi.exp
+++ b/libffi/testsuite/lib/libffi.exp
@@ -337,8 +337,13 @@ proc libffi-init { args } {
verbose "libffi_dir $libffi_dir"
if { $libffi_dir != "" } {
set libffi_dir [file dirname ${libffi_dir}]
- set libffi_link_flags "-L${libffi_dir}/.libs"
- lappend libffi_link_flags "-L${blddircxx}/src/.libs"
+ if [istarget *-*-darwin*] {
+ set libffi_link_flags "-B${libffi_dir}/.libs"
+ lappend libffi_link_flags "-B${blddircxx}/src/.libs"
+ } else {
+ set libffi_link_flags "-L${libffi_dir}/.libs"
+ lappend libffi_link_flags "-L${blddircxx}/src/.libs"
+ }
}
set_ld_library_path_env_vars
@@ -382,7 +387,7 @@ proc libffi_target_compile { source dest type options } {
# Darwin needs a stack execution allowed flag.
if { [istarget "*-*-darwin9*"] || [istarget "*-*-darwin1*"]
- || [istarget "*-*-darwin2*"] } {
+ || [istarget "x86_64-*-darwin2*"] } {
lappend options "additional_flags=-Wl,-allow_stack_execute"
lappend options "additional_flags=-Wl,-search_paths_first"
}
diff --git a/libitm/testsuite/lib/libitm.exp b/libitm/testsuite/lib/libitm.exp
index da918d1ee8d..61bbfa0c923 100644
--- a/libitm/testsuite/lib/libitm.exp
+++ b/libitm/testsuite/lib/libitm.exp
@@ -159,6 +159,7 @@ proc libitm_init { args } {
}
if [istarget *-*-darwin*] {
+ lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/.libs"
lappend ALWAYS_CFLAGS "additional_flags=-shared-libgcc"
}
diff --git a/libitm/testsuite/libitm.c++/c++.exp b/libitm/testsuite/libitm.c++/c++.exp
index de45e7e5480..1b0ead05fee 100644
--- a/libitm/testsuite/libitm.c++/c++.exp
+++ b/libitm/testsuite/libitm.c++/c++.exp
@@ -56,8 +56,10 @@ if { $lang_test_file_found } {
# Gather a list of all tests.
set tests [lsort [glob -nocomplain $srcdir/$subdir/*.C]]
+ set stdcxxadder ""
if { $blddir != "" } {
set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
+ set stdcxxadder "-B ${blddir}/${lang_library_path}"
} else {
set ld_library_path "$always_ld_library_path"
}
@@ -72,7 +74,7 @@ if { $lang_test_file_found } {
}
# Main loop.
- dg-runtest $tests "" $libstdcxx_includes
+ dg-runtest $tests $stdcxxadder $libstdcxx_includes
}
# All done.
--
2.34.1
[-- Attachment #6: 0005-Doc-document-the-nodefaultrpaths-option.patch --]
[-- Type: application/octet-stream, Size: 1780 bytes --]
From f456e22825a1e2f24b6f8a910b2f3e0f32edcc11 Mon Sep 17 00:00:00 2001
From: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Date: Thu, 24 Aug 2023 13:22:28 +0200
Subject: [PATCH 5/5] Doc: document the -nodefaultrpaths option
gcc/ChangeLog:
* doc/invoke.texi: Document the new -nodefaultrpaths option.
---
gcc/doc/invoke.texi | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index ef3f4098986..9890c8e9572 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -920,7 +920,7 @@ Objective-C and Objective-C++ Dialects}.
-iframework
-image_base -init -install_name -keep_private_externs
-multi_module -multiply_defined -multiply_defined_unused
--noall_load -no_dead_strip_inits_and_terms
+-noall_load -no_dead_strip_inits_and_terms -nodefaultrpaths
-nofixprebinding -nomultidefs -noprebind -noseglinkedit
-pagezero_size -prebind -prebind_all_twolevel_modules
-private_bundle -read_only_relocs -sectalign
@@ -24269,6 +24269,14 @@ an executable when linking, using the Darwin @file{libtool} command.
This causes GCC's output file to have the @samp{ALL} subtype, instead of
one controlled by the @option{-mcpu} or @option{-march} option.
+@opindex nodefaultrpaths
+@item -nodefaultrpaths
+Do not add default run paths for the compiler library directories to
+executables, modules or dynamic libraries. On macOS 10.5 and later,
+the embedded runpath is added by default unless the user adds
+@option{-nodefaultrpaths} to the link line. Run paths are needed
+(and therefore enforced) to build on macOS version 10.11 or later.
+
@item -allowable_client @var{client_name}
@itemx -client_name
@itemx -compatibility_version
--
2.34.1
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-08-25 7:50 ` FX Coudert
@ 2023-08-25 16:28 ` Joseph Myers
2023-08-29 16:06 ` FX Coudert
0 siblings, 1 reply; 39+ messages in thread
From: Joseph Myers @ 2023-08-25 16:28 UTC (permalink / raw)
To: FX Coudert; +Cc: GCC Patches, Iain Sandoe
[-- Attachment #1: Type: text/plain, Size: 743 bytes --]
On Fri, 25 Aug 2023, FX Coudert via Gcc-patches wrote:
> Hi,
>
> Thanks Joseph for the review.
>
> > The driver changes are OK.
> >
> > I think the new configure options and the new -nodefaultrpaths compiler
> > option need documenting
>
> Doc patch was added, and okay’ed by Iain.
I see documentation for -nodefaultrpaths; not for configure options, and
at least one of the configure options looks like it's being defined as a
GCC-specific configure option rather than a libtool one, so should
definitely be documented in install.texi.
> Attached is the final patchset. Joseph, is your previous OK good for
> pushing, or does it need further review?
The driver changes are still OK.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-08-25 16:28 ` Joseph Myers
@ 2023-08-29 16:06 ` FX Coudert
2023-08-29 19:55 ` Joseph Myers
0 siblings, 1 reply; 39+ messages in thread
From: FX Coudert @ 2023-08-29 16:06 UTC (permalink / raw)
To: Joseph Myers; +Cc: GCC Patches, Iain Sandoe
[-- Attachment #1: Type: text/plain, Size: 476 bytes --]
Hi,
> I see documentation for -nodefaultrpaths; not for configure options, and
> at least one of the configure options looks like it's being defined as a
> GCC-specific configure option rather than a libtool one, so should
> definitely be documented in install.texi.
Yep, missed that, sorry. It’s now done.
> The driver changes are still OK.
Just to be clear: apart from you and Iain, whose approval do I need (and for what parts)?
Thanks,
FX
[-- Attachment #2: 0001-Driver-Provide-a-spec-to-insert-rpaths-for-compiler-.patch --]
[-- Type: application/octet-stream, Size: 3952 bytes --]
From ff84f0b0d2971bc589a52c416d0ca6f292f75458 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Thu, 20 Dec 2018 09:00:38 +0000
Subject: [PATCH 1/5] Driver: Provide a spec to insert rpaths for compiler lib
dirs.
This provides a spec to insert "-rpath DDD" for each DDD corresponding
to a compiler startfile directory. This allows a target to use @rpath
as the install path for libraries, and have the compiler provide the
necessary rpath to handle this.
Embed real paths, not relative ones.
We embed a runpath for every path in which libraries might be found. This
change ensures that we embed the actual real path and not a relative one from
the compiler's version-specific directory.
e.g.
/opt/distro/gcc-11-3Dr0/lib
instead of:
/opt/distro/gcc-11-3Dr0/lib/gcc/x86_64-apple-darwin19/11.3.0/../../..
This ensures that if we install, for example, 11.4.0 (and delete the 11.3.0
installation) exes built by 11.3 would continue to function (providing, of course
that 11.4 does not bump any SO names).
gcc/ChangeLog:
* gcc.cc (RUNPATH_OPTION): New.
(do_spec_1): Provide '%P' as a spec to insert rpaths for
each compiler startfile path.
---
gcc/gcc.cc | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index fdfac0b4fe4..7c6e4879a31 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -579,6 +579,7 @@ or with constant text in a single argument.
%l process LINK_SPEC as a spec.
%L process LIB_SPEC as a spec.
%M Output multilib_os_dir.
+ %P Output a RUNPATH_OPTION for each directory in startfile_prefixes.
%G process LIBGCC_SPEC as a spec.
%R Output the concatenation of target_system_root and
target_sysroot_suffix.
@@ -1182,6 +1183,10 @@ proper position among the other output files. */
# define SYSROOT_HEADERS_SUFFIX_SPEC ""
#endif
+#ifndef RUNPATH_OPTION
+# define RUNPATH_OPTION "-rpath"
+#endif
+
static const char *asm_debug = ASM_DEBUG_SPEC;
static const char *asm_debug_option = ASM_DEBUG_OPTION_SPEC;
static const char *cpp_spec = CPP_SPEC;
@@ -5925,6 +5930,7 @@ struct spec_path_info {
size_t append_len;
bool omit_relative;
bool separate_options;
+ bool realpaths;
};
static void *
@@ -5934,6 +5940,16 @@ spec_path (char *path, void *data)
size_t len = 0;
char save = 0;
+ /* The path must exist; we want to resolve it to the realpath so that this
+ can be embedded as a runpath. */
+ if (info->realpaths)
+ path = lrealpath (path);
+
+ /* However, if we failed to resolve it - perhaps because there was a bogus
+ -B option on the command line, then punt on this entry. */
+ if (!path)
+ return NULL;
+
if (info->omit_relative && !IS_ABSOLUTE_PATH (path))
return NULL;
@@ -6165,6 +6181,22 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
info.omit_relative = false;
#endif
info.separate_options = false;
+ info.realpaths = false;
+
+ for_each_path (&startfile_prefixes, true, 0, spec_path, &info);
+ }
+ break;
+
+ case 'P':
+ {
+ struct spec_path_info info;
+
+ info.option = RUNPATH_OPTION;
+ info.append_len = 0;
+ info.omit_relative = false;
+ info.separate_options = true;
+ /* We want to embed the actual paths that have the libraries. */
+ info.realpaths = true;
for_each_path (&startfile_prefixes, true, 0, spec_path, &info);
}
@@ -6491,6 +6523,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
info.append_len = strlen (info.append);
info.omit_relative = false;
info.separate_options = true;
+ info.realpaths = false;
for_each_path (&include_prefixes, false, info.append_len,
spec_path, &info);
--
2.39.2 (Apple Git-143)
[-- Attachment #3: 0002-Darwin-Allow-for-configuring-Darwin-to-use-embedded-.patch --]
[-- Type: application/octet-stream, Size: 279683 bytes --]
From 5259260cf3bfc6cec7a3f0e5caeecfbc6bf00778 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Sun, 28 Mar 2021 14:48:17 +0100
Subject: [PATCH 2/5] Darwin: Allow for configuring Darwin to use embedded
runpath.
Recent Darwin versions place contraints on the use of run paths
specified in environment variables. This breaks some assumptions
in the GCC build.
This change allows the user to configure a Darwin build to use
'@rpath/libraryname.dylib' in library names and then to add an
embedded runpath to executables (and libraries with dependents).
The embedded runpath is added by default unless the user adds
'-nodefaultrpaths' to the link line.
For an installed compiler, it means that any executable built with
that compiler will reference the runtimes installed with the
compiler (equivalent to hard-coding the library path into the name
of the library).
During build-time configurations any "-B" entries will be added to
the runpath thus the newly-built libraries will be found by exes.
Since the install name is set in libtool, that decision needs to be
available here (but might also cause dependent ones in Makefiles,
so we need to export a conditional).
This facility is not available for Darwin 8 or earlier, however the
existing environment variable runpath does work there.
We default this on for systems where the external DYLD_LIBRARY_PATH
does not work and off for Darwin 8 or earlier. For systems that can
use either method, if the value is unset, we use the default (which
is currently DYLD_LIBRARY_PATH).
ChangeLog:
* configure: Regenerate.
* configure.ac: Do not add default runpaths to GCC exes
when we are building -static-libstdc++/-static-libgcc (the
default).
* libtool.m4: Add 'enable-darwin-at-runpath'. Act on the
enable flag to alter Darwin libraries to use @rpath names.
gcc/ChangeLog:
* aclocal.m4: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
* config/darwin.h: Handle Darwin rpaths.
* config/darwin.opt: Handle Darwin rpaths.
* Makefile.in: Handle Darwin rpaths.
gcc/ada/ChangeLog:
* gcc-interface/Makefile.in: Handle Darwin rpaths.
gcc/jit/ChangeLog:
* Make-lang.in: Handle Darwin rpaths.
libatomic/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libbacktrace/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libcc1/ChangeLog:
* configure: Regenerate.
libffi/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
libgcc/ChangeLog:
* config/t-slibgcc-darwin: Generate libgcc_s
with an @rpath name.
* config.host: Handle Darwin rpaths.
libgfortran/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths
libgm2/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* aclocal.m4: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
* libm2cor/Makefile.am: Handle Darwin rpaths.
* libm2cor/Makefile.in: Regenerate.
* libm2iso/Makefile.am: Handle Darwin rpaths.
* libm2iso/Makefile.in: Regenerate.
* libm2log/Makefile.am: Handle Darwin rpaths.
* libm2log/Makefile.in: Regenerate.
* libm2min/Makefile.am: Handle Darwin rpaths.
* libm2min/Makefile.in: Regenerate.
* libm2pim/Makefile.am: Handle Darwin rpaths.
* libm2pim/Makefile.in: Regenerate.
libgomp/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths
libitm/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libobjc/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libphobos/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
* libdruntime/Makefile.am: Handle Darwin rpaths.
* libdruntime/Makefile.in: Regenerate.
* src/Makefile.am: Handle Darwin rpaths.
* src/Makefile.in: Regenerate.
libquadmath/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libsanitizer/ChangeLog:
* asan/Makefile.am: Handle Darwin rpaths.
* asan/Makefile.in: Regenerate.
* configure: Regenerate.
* hwasan/Makefile.am: Handle Darwin rpaths.
* hwasan/Makefile.in: Regenerate.
* lsan/Makefile.am: Handle Darwin rpaths.
* lsan/Makefile.in: Regenerate.
* tsan/Makefile.am: Handle Darwin rpaths.
* tsan/Makefile.in: Regenerate.
* ubsan/Makefile.am: Handle Darwin rpaths.
* ubsan/Makefile.in: Regenerate.
libssp/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libstdc++-v3/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
* src/Makefile.am: Handle Darwin rpaths.
* src/Makefile.in: Regenerate.
libvtv/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
lto-plugin/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
zlib/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
---
configure | 14 ++
configure.ac | 14 ++
gcc/Makefile.in | 11 +-
gcc/aclocal.m4 | 50 +++++++
gcc/ada/gcc-interface/Makefile.in | 5 +-
gcc/config/darwin.h | 32 ++++-
gcc/config/darwin.opt | 4 +
gcc/configure | 133 ++++++++++++++++--
gcc/configure.ac | 2 +
gcc/jit/Make-lang.in | 2 +-
libatomic/Makefile.am | 7 +-
libatomic/Makefile.in | 7 +-
libatomic/configure | 76 ++++++++++-
libatomic/configure.ac | 2 +
libbacktrace/configure | 76 ++++++++++-
libbacktrace/configure.ac | 2 +
libcc1/configure | 118 ++++++++++++++--
libffi/Makefile.am | 7 +-
libffi/Makefile.in | 6 +-
libffi/configure | 132 ++++++++++++++++--
libffi/configure.ac | 1 +
libffi/doc/version.texi | 4 +-
libgcc/config.host | 23 +++-
libgcc/config/t-darwin-rpath | 2 +
libgcc/config/t-slibgcc-darwin | 28 ++--
libgfortran/Makefile.am | 7 +-
libgfortran/Makefile.in | 28 ++--
libgfortran/configure | 131 ++++++++++++++++--
libgfortran/configure.ac | 6 +-
libgm2/Makefile.am | 9 +-
libgm2/Makefile.in | 15 +-
libgm2/aclocal.m4 | 10 +-
libgm2/configure | 145 ++++++++++++++++++--
libgm2/configure.ac | 6 +-
libgm2/libm2cor/Makefile.am | 4 +
libgm2/libm2cor/Makefile.in | 17 ++-
libgm2/libm2iso/Makefile.am | 4 +
libgm2/libm2iso/Makefile.in | 17 ++-
libgm2/libm2log/Makefile.am | 3 +
libgm2/libm2log/Makefile.in | 17 ++-
libgm2/libm2min/Makefile.am | 3 +
libgm2/libm2min/Makefile.in | 17 ++-
libgm2/libm2pim/Makefile.am | 3 +
libgm2/libm2pim/Makefile.in | 17 ++-
libgo/configure | 18 ++-
libgo/configure.ac | 1 +
libgomp/Makefile.am | 7 +-
libgomp/Makefile.in | 5 +-
libgomp/configure | 126 ++++++++++++++++-
libgomp/configure.ac | 1 +
libitm/Makefile.am | 7 +-
libitm/Makefile.in | 7 +-
libitm/configure | 132 ++++++++++++++++--
libitm/configure.ac | 1 +
libobjc/configure | 112 ++++++++++++---
libobjc/configure.ac | 36 +++--
libphobos/configure | 126 ++++++++++++++++-
libphobos/configure.ac | 1 +
libphobos/libdruntime/Makefile.am | 5 +-
libphobos/libdruntime/Makefile.in | 3 +-
libphobos/src/Makefile.am | 5 +-
libphobos/src/Makefile.in | 3 +-
libquadmath/Makefile.am | 7 +-
libquadmath/Makefile.in | 5 +-
libquadmath/configure | 218 +++++++++++++++++++++++++++++-
libquadmath/configure.ac | 3 +
libsanitizer/asan/Makefile.am | 7 +-
libsanitizer/asan/Makefile.in | 7 +-
libsanitizer/configure | 133 ++++++++++++++++--
libsanitizer/configure.ac | 2 +
libsanitizer/hwasan/Makefile.am | 6 +-
libsanitizer/hwasan/Makefile.in | 5 +-
libsanitizer/lsan/Makefile.am | 8 +-
libsanitizer/lsan/Makefile.in | 8 +-
libsanitizer/tsan/Makefile.am | 6 +-
libsanitizer/tsan/Makefile.in | 5 +-
libsanitizer/ubsan/Makefile.am | 7 +-
libsanitizer/ubsan/Makefile.in | 7 +-
libssp/Makefile.am | 6 +-
libssp/Makefile.in | 5 +-
libssp/configure | 76 ++++++++++-
libssp/configure.ac | 2 +
libstdc++-v3/configure | 144 ++++++++++++++++++--
libstdc++-v3/configure.ac | 1 +
libstdc++-v3/src/Makefile.am | 7 +-
libstdc++-v3/src/Makefile.in | 5 +-
libtool.m4 | 57 +++++++-
libvtv/configure | 132 ++++++++++++++++--
libvtv/configure.ac | 1 +
lto-plugin/configure | 75 +++++++++-
lto-plugin/configure.ac | 1 +
zlib/configure | 75 +++++++++-
zlib/configure.ac | 1 +
93 files changed, 2556 insertions(+), 279 deletions(-)
create mode 100644 libgcc/config/t-darwin-rpath
diff --git a/configure b/configure
index 28f0913bdd4..28e25bf7162 100755
--- a/configure
+++ b/configure
@@ -8492,6 +8492,20 @@ else
fi
fi
+case $target in
+ *-darwin2* | *-darwin1[56789]*)
+ # For these versions, we default to using embedded rpaths.
+ if test "x$enable_darwin_at_rpath" != "xno"; then
+ poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths"
+ fi
+ ;;
+ *-darwin*)
+ # For these versions, we only use embedded rpaths on demand.
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths"
+ fi
+ ;;
+esac
# GCC GRAPHITE dependency isl.
diff --git a/configure.ac b/configure.ac
index 5d25dc864c3..49c237bb8b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1855,6 +1855,20 @@ AC_ARG_WITH(boot-ldflags,
if test "$poststage1_libs" = ""; then
poststage1_ldflags="-static-libstdc++ -static-libgcc"
fi])
+case $target in
+ *-darwin2* | *-darwin1[[56789]]*)
+ # For these versions, we default to using embedded rpaths.
+ if test "x$enable_darwin_at_rpath" != "xno"; then
+ poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths"
+ fi
+ ;;
+ *-darwin*)
+ # For these versions, we only use embedded rpaths on demand.
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths"
+ fi
+ ;;
+esac
AC_SUBST(poststage1_ldflags)
# GCC GRAPHITE dependency isl.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 78779546459..60ba2916457 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1193,6 +1193,8 @@ LANG_MAKEFRAGS = @all_lang_makefrags@
# Used by gcc/jit/Make-lang.in
LD_VERSION_SCRIPT_OPTION = @ld_version_script_option@
LD_SONAME_OPTION = @ld_soname_option@
+@ENABLE_DARWIN_AT_RPATH_TRUE@DARWIN_RPATH = @rpath
+@ENABLE_DARWIN_AT_RPATH_FALSE@DARWIN_RPATH = ${libdir}
# Flags to pass to recursive makes.
# CC is set by configure.
@@ -2014,9 +2016,12 @@ cs-tconfig.h: Makefile
$(SHELL) $(srcdir)/mkconfig.sh tconfig.h
cs-tm.h: Makefile
- TARGET_CPU_DEFAULT="$(target_cpu_default)" \
- HEADERS="$(tm_include_list)" DEFINES="$(tm_defines)" \
- $(SHELL) $(srcdir)/mkconfig.sh tm.h
+@ENABLE_DARWIN_AT_RPATH_FALSE@ TARGET_CPU_DEFAULT="$(target_cpu_default)" \
+@ENABLE_DARWIN_AT_RPATH_FALSE@ HEADERS="$(tm_include_list)" DEFINES="$(tm_defines)" \
+@ENABLE_DARWIN_AT_RPATH_FALSE@ $(SHELL) $(srcdir)/mkconfig.sh tm.h
+@ENABLE_DARWIN_AT_RPATH_TRUE@ TARGET_CPU_DEFAULT="$(target_cpu_default)" \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ HEADERS="$(tm_include_list)" DEFINES="$(tm_defines) DARWIN_AT_RPATH=1" \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ $(SHELL) $(srcdir)/mkconfig.sh tm.h
cs-tm_p.h: Makefile
TARGET_CPU_DEFAULT="" \
diff --git a/gcc/aclocal.m4 b/gcc/aclocal.m4
index 6be36df5190..126e09bbcd1 100644
--- a/gcc/aclocal.m4
+++ b/gcc/aclocal.m4
@@ -12,6 +12,56 @@
# PARTICULAR PURPOSE.
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ([2.52])dnl
+ m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 2006-2017 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# --------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
m4_include([../libtool.m4])
m4_include([../ltoptions.m4])
m4_include([../ltsugar.m4])
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index b5243a24a8f..ad7cf5072e5 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -794,12 +794,15 @@ gnatlib-shared-darwin:
$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
$(SO_OPTS) \
-Wl,-install_name,@rpath/libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
- $(MISCLIB)
+ -nodefaultrpaths -Wl,-rpath,@loader_path/,-rpath,@loader_path/.. \
+ -Wl,-rpath,@loader_path/../../../../ $(MISCLIB)
cd $(RTSDIR); $(GCC_FOR_ADA_RTS) -dynamiclib $(PICFLAG_FOR_TARGET) \
-o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
$(GNATRTL_TASKING_OBJS) \
$(SO_OPTS) \
-Wl,-install_name,@rpath/libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ -nodefaultrpaths -Wl,-rpath,@loader_path/,-rpath,@loader_path/.. \
+ -Wl,-rpath,@loader_path/../../../../ \
$(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
cd $(RTSDIR); $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
libgnat$(soext)
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index e0e8672a455..1b6920f4c92 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -309,6 +309,18 @@ extern GTY(()) int darwin_ms_struct;
#define DARWIN_CC1_SPEC \
"%<dynamic %<dynamiclib %<force_cpusubtype_ALL %<multiply_defined* "
+/* When we are using embedded runpaths DARWIN_AT_RPATH is set. */
+#if DARWIN_AT_RPATH
+# define DARWIN_RPATH_LINK \
+"%{!r:%{!nostdlib:%{!nodefaultrpaths:%(darwin_rpaths)}}}"
+# define DARWIN_SHARED_LIBGCC "-lgcc_s.1.1"
+#else
+# define DARWIN_RPATH_LINK ""
+# define DARWIN_SHARED_LIBGCC \
+"%:version-compare(!> 10.11 mmacosx-version-min= -lgcc_s.1.1) \
+ %:version-compare(>= 10.11 mmacosx-version-min= -lemutls_w) "
+#endif
+
#define SUBSUBTARGET_OVERRIDE_OPTIONS \
do { \
darwin_override_options (); \
@@ -403,7 +415,8 @@ extern GTY(()) int darwin_ms_struct;
DARWIN_NOPIE_SPEC \
DARWIN_RDYNAMIC \
DARWIN_NOCOMPACT_UNWIND \
- "}}}}}}} %<pie %<no-pie %<rdynamic %<X %<rpath "
+ DARWIN_RPATH_LINK \
+ "}}}}}}} %<pie %<no-pie %<rdynamic %<X %<rpath %<nodefaultrpaths "
/* Spec that controls whether the debug linker is run automatically for
a link step. This needs to be done if there is a source file on the
@@ -518,8 +531,7 @@ extern GTY(()) int darwin_ms_struct;
%:version-compare(!> 10.6 mmacosx-version-min= -lgcc_eh) \
%:version-compare(>= 10.6 mmacosx-version-min= -lemutls_w); \
shared-libgcc|fexceptions|fobjc-exceptions|fgnu-runtime: \
- %:version-compare(!> 10.11 mmacosx-version-min= -lgcc_s.1.1) \
- %:version-compare(>= 10.11 mmacosx-version-min= -lemutls_w) \
+ " DARWIN_SHARED_LIBGCC " \
%:version-compare(!> 10.3.9 mmacosx-version-min= -lgcc_eh) \
%:version-compare(>< 10.3.9 10.5 mmacosx-version-min= -lgcc_s.10.4) \
%:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5); \
@@ -554,7 +566,8 @@ extern GTY(()) int darwin_ms_struct;
{ "darwin_crt2", DARWIN_CRT2_SPEC }, \
{ "darwin_crt3", DARWIN_CRT3_SPEC }, \
{ "darwin_dylib1", DARWIN_DYLIB1_SPEC }, \
- { "darwin_bundle1", DARWIN_BUNDLE1_SPEC },
+ { "darwin_bundle1", DARWIN_BUNDLE1_SPEC }, \
+ { "darwin_rpaths", DARWIN_RPATH_SPEC },
#define DARWIN_CRT1_SPEC \
"%:version-compare(!> 10.5 mmacosx-version-min= -lcrt1.o) \
@@ -580,6 +593,17 @@ extern GTY(()) int darwin_ms_struct;
"%{!static:%:version-compare(< 10.6 mmacosx-version-min= -lbundle1.o) \
%{fgnu-tm: -lcrttms.o}}"
+#if DARWIN_AT_RPATH
+/* A default rpath, that picks up dependent libraries installed in the same
+ director as one being loaded. */
+#define DARWIN_RPATH_SPEC \
+ "%:version-compare(>= 10.5 mmacosx-version-min= -rpath) \
+ %:version-compare(>= 10.5 mmacosx-version-min= @loader_path) \
+ %P "
+#else
+#define DARWIN_RPATH_SPEC ""
+#endif
+
#ifdef HAVE_AS_MMACOSX_VERSION_MIN_OPTION
/* Emit macosx version (but only major). */
#define ASM_MMACOSX_VERSION_MIN_SPEC \
diff --git a/gcc/config/darwin.opt b/gcc/config/darwin.opt
index d655aaef2fb..ff624ffd82a 100644
--- a/gcc/config/darwin.opt
+++ b/gcc/config/darwin.opt
@@ -241,6 +241,10 @@ nodefaultexport
Driver RejectNegative
Do not add a default symbol exports to modules or dynamic libraries.
+nodefaultrpaths
+Driver RejectNegative
+Do not add default run paths (for the compiler library directories) to executables, modules or dynamic libraries.
+
nofixprebinding
Driver RejectNegative
(Obsolete after 10.3.9) Set MH_NOPREFIXBINDING, in an executable.
diff --git a/gcc/configure b/gcc/configure
index 07e8a64afbb..eaa1a189583 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -741,6 +741,8 @@ ORIGINAL_PLUGIN_LD_FOR_TARGET
gcc_cv_ld
ORIGINAL_AS_FOR_TARGET
gcc_cv_as
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_fast_install
objdir
OTOOL64
@@ -1006,6 +1008,7 @@ enable_static
with_pic
enable_fast_install
enable_libtool_lock
+enable_darwin_at_rpath
enable_ld
enable_gold
with_plugin_ld
@@ -1741,6 +1744,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-ld[=ARG] build ld [ARG={default,yes,no}]
--enable-gold[=ARG] build gold [ARG={default,yes,no}]
--enable-gnu-indirect-function
@@ -16356,7 +16362,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -18061,6 +18067,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -18078,9 +18127,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -19886,7 +19939,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19889 "configure"
+#line 19942 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -19992,7 +20045,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19995 "configure"
+#line 20048 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -20868,6 +20921,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -20885,12 +20981,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -23261,6 +23365,15 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# Identify the assembler which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the assembler
# which will be driven by the driver program.
@@ -32851,6 +32964,10 @@ LTLIBOBJS=$ac_ltlibobjs
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 62c31d8e02d..80e31229408 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2599,6 +2599,8 @@ AC_PROG_LIBTOOL
AC_SUBST(objdir)
AC_SUBST(enable_fast_install)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
# Identify the assembler which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the assembler
# which will be driven by the driver program.
diff --git a/gcc/jit/Make-lang.in b/gcc/jit/Make-lang.in
index a65f13853ae..3fd564a5932 100644
--- a/gcc/jit/Make-lang.in
+++ b/gcc/jit/Make-lang.in
@@ -59,7 +59,7 @@ LIBGCCJIT_AGE = 1
LIBGCCJIT_BASENAME = libgccjit
LIBGCCJIT_SONAME = \
- ${libdir}/$(LIBGCCJIT_BASENAME).$(LIBGCCJIT_VERSION_NUM).dylib
+ $(DARWIN_RPATH)/$(LIBGCCJIT_BASENAME).$(LIBGCCJIT_VERSION_NUM).dylib
LIBGCCJIT_FILENAME = $(LIBGCCJIT_BASENAME).$(LIBGCCJIT_VERSION_NUM).dylib
LIBGCCJIT_LINKER_NAME = $(LIBGCCJIT_BASENAME).dylib
diff --git a/libatomic/Makefile.am b/libatomic/Makefile.am
index c6c8d81c56a..3bb32f32ebf 100644
--- a/libatomic/Makefile.am
+++ b/libatomic/Makefile.am
@@ -65,8 +65,13 @@ libatomic_version_script =
libatomic_version_dep =
endif
libatomic_version_info = -version-info $(libtool_VERSION)
+if ENABLE_DARWIN_AT_RPATH
+libatomic_darwin_rpath = -Wc,-nodefaultrpaths
+libatomic_darwin_rpath += -Wl,-rpath,@loader_path
+endif
-libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) $(lt_host_flags)
+libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) \
+ $(lt_host_flags) $(libatomic_darwin_rpath)
libatomic_la_SOURCES = gload.c gstore.c gcas.c gexch.c glfree.c lock.c init.c \
fenv.c fence.c flag.c
diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in
index 83efe7d2694..4164199cf9d 100644
--- a/libatomic/Makefile.in
+++ b/libatomic/Makefile.in
@@ -416,7 +416,12 @@ noinst_LTLIBRARIES = libatomic_convenience.la
@LIBAT_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@libatomic_version_dep = $(top_srcdir)/libatomic.map
@LIBAT_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@libatomic_version_dep = libatomic.map-sun
libatomic_version_info = -version-info $(libtool_VERSION)
-libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) $(lt_host_flags)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libatomic_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) \
+ $(lt_host_flags) $(libatomic_darwin_rpath)
+
libatomic_la_SOURCES = gload.c gstore.c gcas.c gexch.c glfree.c lock.c \
init.c fenv.c fence.c flag.c $(am__append_2)
SIZEOBJS = load store cas exch fadd fsub fand fior fxor fnand tas
diff --git a/libatomic/configure b/libatomic/configure
index 57f320753e1..dc5f4bca65e 100755
--- a/libatomic/configure
+++ b/libatomic/configure
@@ -658,6 +658,8 @@ OPT_LDFLAGS
SECTION_LDFLAGS
enable_aarch64_lse
libtool_VERSION
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
@@ -802,6 +804,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
enable_symvers
enable_werror
@@ -1451,6 +1454,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -7604,7 +7610,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9577,6 +9583,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9594,9 +9643,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11402,7 +11455,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11405 "configure"
+#line 11458 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11508,7 +11561,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11511 "configure"
+#line 11564 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11793,6 +11846,15 @@ fi
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=3:0:2
@@ -15920,6 +15982,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${LIBAT_BUILD_VERSIONED_SHLIB_TRUE}" && test -z "${LIBAT_BUILD_VERSIONED_SHLIB_FALSE}"; then
as_fn_error $? "conditional \"LIBAT_BUILD_VERSIONED_SHLIB\" was never defined.
diff --git a/libatomic/configure.ac b/libatomic/configure.ac
index 318b605a1d7..6919d212ae5 100644
--- a/libatomic/configure.ac
+++ b/libatomic/configure.ac
@@ -155,6 +155,8 @@ AC_SUBST(enable_shared)
AC_SUBST(enable_static)
AM_MAINTAINER_MODE
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=3:0:2
AC_SUBST(libtool_VERSION)
diff --git a/libbacktrace/configure b/libbacktrace/configure
index c3e7b884e36..0ccc060901d 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -681,6 +681,8 @@ PIC_FLAG
WARN_FLAGS
EXTRA_FLAGS
BACKTRACE_FILE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
OTOOL64
OTOOL
LIPO
@@ -805,6 +807,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_largefile
enable_cet
enable_werror
@@ -1453,6 +1456,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--disable-largefile omit support for large files
--enable-cet enable Intel CET in target libraries [default=auto]
--disable-werror disable building with -Werror
@@ -8048,7 +8054,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9754,6 +9760,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9771,9 +9820,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11579,7 +11632,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11582 "configure"
+#line 11635 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11685,7 +11738,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11688 "configure"
+#line 11741 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11924,6 +11977,15 @@ CC="$lt_save_CC"
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# Check whether --enable-largefile was given.
if test "${enable_largefile+set}" = set; then :
enableval=$enable_largefile;
@@ -14486,6 +14548,10 @@ if test -z "${HAVE_DWZ_TRUE}" && test -z "${HAVE_DWZ_FALSE}"; then
as_fn_error $? "conditional \"HAVE_DWZ\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${HAVE_ELF_TRUE}" && test -z "${HAVE_ELF_FALSE}"; then
as_fn_error $? "conditional \"HAVE_ELF\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac
index 72ff2b30053..71cd50f8cdf 100644
--- a/libbacktrace/configure.ac
+++ b/libbacktrace/configure.ac
@@ -84,6 +84,8 @@ AM_CONDITIONAL(HAVE_DWZ, test "$DWZ" != "")
LT_INIT
AM_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
AC_SYS_LARGEFILE
backtrace_supported=yes
diff --git a/libcc1/configure b/libcc1/configure
index 2a914a0bfc8..ea689a353c8 100755
--- a/libcc1/configure
+++ b/libcc1/configure
@@ -787,6 +787,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_cet
with_gcc_major_version_only
enable_werror_always
@@ -1439,6 +1440,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-cet enable Intel CET in host libraries [default=auto]
--enable-werror-always enable -Werror despite compiler version
--enable-plugin enable plugin support
@@ -7309,7 +7313,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9014,6 +9018,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9031,9 +9078,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -10839,7 +10890,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10842 "configure"
+#line 10893 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10945,7 +10996,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10948 "configure"
+#line 10999 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12227,6 +12278,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -12244,12 +12338,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
diff --git a/libffi/Makefile.am b/libffi/Makefile.am
index 2259ddb75f9..2c5b74df9ee 100644
--- a/libffi/Makefile.am
+++ b/libffi/Makefile.am
@@ -214,7 +214,12 @@ libffi.map: $(top_srcdir)/libffi.map.in
$(COMPILE) -D$(TARGET) -DGENERATE_LIBFFI_MAP \
-E -x assembler-with-cpp -o $@ $(top_srcdir)/libffi.map.in
-libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS)
+if ENABLE_DARWIN_AT_RPATH
+libffi_darwin_rpath = -Wl,-rpath,@loader_path
+endif
+libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) \
+ $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS) \
+ $(libffi_darwin_rpath)
libffi_la_DEPENDENCIES = $(libffi_la_LIBADD) $(libffi_version_dep)
AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
diff --git a/libffi/Makefile.in b/libffi/Makefile.in
index 1d936b5c8a5..71469f7d632 100644
--- a/libffi/Makefile.in
+++ b/libffi/Makefile.in
@@ -597,7 +597,11 @@ AM_CFLAGS = -Wall -g -fexceptions $(CET_FLAGS) $(am__append_2)
@LIBFFI_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBFFI_BUILD_VERSIONED_SHLIB_TRUE@libffi_version_dep = libffi.map
@LIBFFI_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBFFI_BUILD_VERSIONED_SHLIB_TRUE@libffi_version_dep = libffi.map-sun
libffi_version_info = -version-info `grep -v '^\#' $(srcdir)/libtool-version`
-libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libffi_darwin_rpath = -Wl,-rpath,@loader_path
+libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) \
+ $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS) \
+ $(libffi_darwin_rpath)
+
libffi_la_DEPENDENCIES = $(libffi_la_LIBADD) $(libffi_version_dep)
AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
AM_CCASFLAGS = $(AM_CPPFLAGS) $(CET_FLAGS)
diff --git a/libffi/configure b/libffi/configure
index 9eac9c907bf..29054551f7e 100755
--- a/libffi/configure
+++ b/libffi/configure
@@ -667,6 +667,8 @@ MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
READELF
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
CXXCPP
CPP
OTOOL64
@@ -810,6 +812,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
enable_pax_emutramp
enable_debug
@@ -1465,6 +1468,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -7835,7 +7841,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9809,6 +9815,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9826,9 +9875,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11634,7 +11687,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11637 "configure"
+#line 11690 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11740,7 +11793,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11743 "configure"
+#line 11796 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12616,6 +12669,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -12633,12 +12729,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15008,6 +15112,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# Only expand once:
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}readelf", so it can be a program name with args.
@@ -17153,6 +17265,10 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libffi/configure.ac b/libffi/configure.ac
index 014d89d0423..716f20ae313 100644
--- a/libffi/configure.ac
+++ b/libffi/configure.ac
@@ -55,6 +55,7 @@ AC_SUBST(CET_FLAGS)
AM_PROG_AS
AM_PROG_CC_C_O
AC_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
AC_CHECK_TOOL(READELF, readelf)
diff --git a/libffi/doc/version.texi b/libffi/doc/version.texi
index f2b741e87e4..6261b21fec9 100644
--- a/libffi/doc/version.texi
+++ b/libffi/doc/version.texi
@@ -1,4 +1,4 @@
-@set UPDATED 27 June 2021
-@set UPDATED-MONTH June 2021
+@set UPDATED 31 August 2022
+@set UPDATED-MONTH August 2022
@set EDITION 3.4.2
@set VERSION 3.4.2
diff --git a/libgcc/config.host b/libgcc/config.host
index c94d69d84b7..d40cf55acb6 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -233,7 +233,6 @@ case ${host} in
;;
esac
tmake_file="$tmake_file t-slibgcc-darwin"
- # newer toolsets produce warnings when building for unsupported versions.
case ${host} in
*-*-darwin1[89]* | *-*-darwin2* )
tmake_file="t-darwin-min-8 $tmake_file"
@@ -251,6 +250,28 @@ case ${host} in
echo "Warning: libgcc configured to support macOS 10.5" 1>&2
;;
esac
+ # We are not using libtool to build the libs here, so we need to replicate
+ # a little of the logic around setting Darwin rpaths. Setting an explicit
+ # yes or no is honoured, otherwise we choose a suitable default.
+ # Sadly, this has to be kept in line with the rules in libtool.m4.
+ # This make fragment will override the setting in t-slibgcc-darwin so it
+ # must appear after it.
+ if test "x$enable_darwin_at_rpath" = "x"; then
+ echo "enable_darwin_at_rpath is unset" 1>&2
+ case ${host} in
+ *-darwin[45678]*) ;;
+ *-darwin9* | *-darwin1[01234]*) ;; # We might default these on later.
+ *-darwin*)
+ echo "but is needed after macOS 10.11 (setting it on)" 1>&2
+ enable_darwin_at_rpath=yes
+ ;;
+ esac
+ else
+ echo "enable_darwin_at_rpath is '$enable_darwin_at_rpath'" 1>&2
+ fi
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ tmake_file="$tmake_file t-darwin-rpath "
+ fi
extra_parts="crt3.o libd10-uwfef.a crttms.o crttme.o libemutls_w.a"
;;
*-*-dragonfly*)
diff --git a/libgcc/config/t-darwin-rpath b/libgcc/config/t-darwin-rpath
new file mode 100644
index 00000000000..e73d7f378b0
--- /dev/null
+++ b/libgcc/config/t-darwin-rpath
@@ -0,0 +1,2 @@
+# Use @rpath and add a search path to exes and dylibs that depend on this.
+SHLIB_RPATH = @rpath
diff --git a/libgcc/config/t-slibgcc-darwin b/libgcc/config/t-slibgcc-darwin
index cb0cbbdb1c5..da4886848e8 100644
--- a/libgcc/config/t-slibgcc-darwin
+++ b/libgcc/config/t-slibgcc-darwin
@@ -1,4 +1,4 @@
-# Build a shared libgcc library with the darwin linker.
+# Build a shared libgcc library able to use embedded runpaths.
SHLIB_SOVERSION = 1.1
SHLIB_SO_MINVERSION = 1
@@ -6,7 +6,6 @@ SHLIB_VERSTRING = -compatibility_version $(SHLIB_SO_MINVERSION) \
-current_version $(SHLIB_SOVERSION)
SHLIB_EXT = .dylib
SHLIB_LC = -lSystem
-SHLIB_INSTALL_DIR = $(slibdir)
SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
SHLIB_MKMAP_OPTS = -v leading_underscore=1
@@ -23,11 +22,16 @@ SHLIB_SONAME = @shlib_base_name@$(SHLIB_EXT)
# subdir. The code under MULTIBUILDTOP combines these into a single FAT
# library, that is what we eventually install.
+# When enable_darwin_at_rpath is true, use @rpath instead of $(slibdir) for
+# this and dylibs that depend on this. So this def must come first and be
+# overridden in a make fragment that depends on the rpath setting.
+SHLIB_RPATH = $(slibdir)
+
SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) $(LDFLAGS) -dynamiclib -nodefaultlibs \
- -install_name $(SHLIB_INSTALL_DIR)/$(SHLIB_INSTALL_NAME) \
+ -install_name $(SHLIB_RPATH)/$(SHLIB_INSTALL_NAME) \
-single_module -o $(SHLIB_DIR)/$(SHLIB_SONAME) \
-Wl,-exported_symbols_list,$(SHLIB_MAP) \
- $(SHLIB_VERSTRING) \
+ $(SHLIB_VERSTRING) -nodefaultrpaths \
@multilib_flags@ @shlib_objs@ $(SHLIB_LC)
# we do our own thing
@@ -63,9 +67,9 @@ EHS_INSTNAME = libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT)
libgcc_ehs$(SHLIB_EXT): $(LIBEHSOBJS) $(extra-parts)
mkdir -p $(MULTIDIR)
$(CC) $(LIBGCC2_CFLAGS) $(LDFLAGS) -dynamiclib -nodefaultlibs \
- -install_name $(SHLIB_INSTALL_DIR)/$(EHS_INSTNAME) \
+ -install_name $(SHLIB_RPATH)/$(EHS_INSTNAME) \
-o $(MULTIDIR)/libgcc_ehs$(SHLIB_EXT) $(SHLIB_VERSTRING) \
- $(LIBEHSOBJS) $(SHLIB_LC)
+ -nodefaultrpaths $(LIBEHSOBJS) $(SHLIB_LC)
all: libgcc_ehs$(SHLIB_EXT)
@@ -122,12 +126,12 @@ libgcc_s.1.dylib: all-multi libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT) \
cp ../$${mlib}/libgcc/$${mlib}/libgcc_ehs$(SHLIB_EXT) \
./libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} || exit 1 ; \
arch=`$(LIPO) -info libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} | sed -e 's/.*:\ //'` ; \
- $(CC) -arch $${arch} -nodefaultlibs -dynamiclib \
+ $(CC) -arch $${arch} -nodefaultlibs -dynamiclib -nodefaultrpaths \
-o libgcc_s.1$(SHLIB_EXT)_T_$${mlib} \
-Wl,-reexport_library,libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} \
-Wl,-reexport_library,libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} \
- -install_name $(SHLIB_INSTALL_DIR)/libgcc_s.1.dylib \
- -compatibility_version 1 -current_version 1 ; \
+ -install_name $(SHLIB_RPATH)/libgcc_s.1.dylib \
+ -compatibility_version 1 -current_version 1.1 ; \
done
$(LIPO) -output libgcc_s.1$(SHLIB_EXT) -create libgcc_s.1$(SHLIB_EXT)_T*
rm libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T*
@@ -141,13 +145,13 @@ libgcc_s.1.dylib: all-multi libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)
cp ../$${mlib}/libgcc/$${mlib}/libgcc_s$(SHLIB_EXT) \
./libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} || exit 1 ; \
arch=`$(LIPO) -info libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} | sed -e 's/.*:\ //'` ; \
- $(CC) -arch $${arch} -nodefaultlibs -dynamiclib \
+ $(CC) -arch $${arch} -nodefaultlibs -dynamiclib -nodefaultrpaths \
-o libgcc_s.1$(SHLIB_EXT)_T_$${mlib} \
-Wl,-reexport_library,libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} \
-lSystem \
-Wl,-reexported_symbols_list,$(srcdir)/config/darwin-unwind.ver \
- -install_name $(SHLIB_INSTALL_DIR)/libgcc_s.1.dylib \
- -compatibility_version 1 -current_version 1 ; \
+ -install_name $(SHLIB_RPATH)/libgcc_s.1.dylib \
+ -compatibility_version 1 -current_version 1.1 ; \
done
$(LIPO) -output libgcc_s.1$(SHLIB_EXT) -create libgcc_s.1$(SHLIB_EXT)_T*
rm libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T*
diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am
index 9fab07c9a50..9f8a4f69863 100644
--- a/libgfortran/Makefile.am
+++ b/libgfortran/Makefile.am
@@ -37,6 +37,11 @@ else
version_arg =
version_dep =
endif
+extra_darwin_ldflags_libgfortran = @extra_ldflags_libgfortran@
+if ENABLE_DARWIN_AT_RPATH
+extra_darwin_ldflags_libgfortran += -Wc,-nodefaultrpaths
+extra_darwin_ldflags_libgfortran += -Wl,-rpath,@loader_path
+endif
gfor_c_HEADERS = ISO_Fortran_binding.h
gfor_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
@@ -50,7 +55,7 @@ libgfortran_la_LINK = $(LINK) $(libgfortran_la_LDFLAGS)
libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
$(LTLDFLAGS) $(LIBQUADLIB) ../libbacktrace/libbacktrace.la \
$(HWCAP_LDFLAGS) \
- $(LIBM) $(extra_ldflags_libgfortran) \
+ $(LIBM) $(extra_darwin_ldflags_libgfortran) \
$(version_arg) -Wc,-shared-libgcc
libgfortran_la_DEPENDENCIES = $(version_dep) libgfortran.spec $(LIBQUADLIB_DEP)
diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in
index e8627f9a4bc..30d1dc56da7 100644
--- a/libgfortran/Makefile.in
+++ b/libgfortran/Makefile.in
@@ -91,8 +91,10 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-@LIBGFOR_MINIMAL_TRUE@am__append_1 = -DLIBGFOR_MINIMAL
-@LIBGFOR_MINIMAL_FALSE@am__append_2 = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+@LIBGFOR_MINIMAL_TRUE@am__append_2 = -DLIBGFOR_MINIMAL
+@LIBGFOR_MINIMAL_FALSE@am__append_3 = \
@LIBGFOR_MINIMAL_FALSE@io/close.c \
@LIBGFOR_MINIMAL_FALSE@io/file_pos.c \
@LIBGFOR_MINIMAL_FALSE@io/format.c \
@@ -110,7 +112,7 @@ target_triplet = @target@
@LIBGFOR_MINIMAL_FALSE@io/fbuf.c \
@LIBGFOR_MINIMAL_FALSE@io/async.c
-@LIBGFOR_MINIMAL_FALSE@am__append_3 = \
+@LIBGFOR_MINIMAL_FALSE@am__append_4 = \
@LIBGFOR_MINIMAL_FALSE@intrinsics/access.c \
@LIBGFOR_MINIMAL_FALSE@intrinsics/c99_functions.c \
@LIBGFOR_MINIMAL_FALSE@intrinsics/chdir.c \
@@ -143,9 +145,9 @@ target_triplet = @target@
@LIBGFOR_MINIMAL_FALSE@intrinsics/umask.c \
@LIBGFOR_MINIMAL_FALSE@intrinsics/unlink.c
-@IEEE_SUPPORT_TRUE@am__append_4 = ieee/ieee_helper.c
-@LIBGFOR_MINIMAL_TRUE@am__append_5 = runtime/minimal.c
-@LIBGFOR_MINIMAL_FALSE@am__append_6 = \
+@IEEE_SUPPORT_TRUE@am__append_5 = ieee/ieee_helper.c
+@LIBGFOR_MINIMAL_TRUE@am__append_6 = runtime/minimal.c
+@LIBGFOR_MINIMAL_FALSE@am__append_7 = \
@LIBGFOR_MINIMAL_FALSE@runtime/backtrace.c \
@LIBGFOR_MINIMAL_FALSE@runtime/convert_char.c \
@LIBGFOR_MINIMAL_FALSE@runtime/environ.c \
@@ -584,7 +586,7 @@ AMTAR = @AMTAR@
# Some targets require additional compiler options for IEEE compatibility.
AM_CFLAGS = @AM_CFLAGS@ -fcx-fortran-rules $(SECTION_FLAGS) \
- $(IEEE_FLAGS) $(am__append_1)
+ $(IEEE_FLAGS) $(am__append_2)
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ $(IEEE_FLAGS)
AR = @AR@
@@ -743,6 +745,8 @@ gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
@LIBGFOR_USE_SYMVER_FALSE@version_dep =
@LIBGFOR_USE_SYMVER_GNU_TRUE@@LIBGFOR_USE_SYMVER_TRUE@version_dep = gfortran.ver
@LIBGFOR_USE_SYMVER_SUN_TRUE@@LIBGFOR_USE_SYMVER_TRUE@version_dep = gfortran.ver-sun gfortran.ver
+extra_darwin_ldflags_libgfortran = @extra_ldflags_libgfortran@ \
+ $(am__append_1)
gfor_c_HEADERS = ISO_Fortran_binding.h
gfor_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) \
@@ -754,7 +758,7 @@ libgfortran_la_LINK = $(LINK) $(libgfortran_la_LDFLAGS)
libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
$(LTLDFLAGS) $(LIBQUADLIB) ../libbacktrace/libbacktrace.la \
$(HWCAP_LDFLAGS) \
- $(LIBM) $(extra_ldflags_libgfortran) \
+ $(LIBM) $(extra_darwin_ldflags_libgfortran) \
$(version_arg) -Wc,-shared-libgcc
libgfortran_la_DEPENDENCIES = $(version_dep) libgfortran.spec $(LIBQUADLIB_DEP)
@@ -775,7 +779,7 @@ AM_CPPFLAGS = -iquote$(srcdir)/io -I$(srcdir)/$(MULTISRCTOP)../gcc \
-I$(MULTIBUILDTOP)../libbacktrace \
-I../libbacktrace
-gfor_io_src = io/size_from_kind.c $(am__append_2)
+gfor_io_src = io/size_from_kind.c $(am__append_3)
gfor_io_headers = \
io/io.h \
io/fbuf.h \
@@ -797,7 +801,7 @@ gfor_helper_src = intrinsics/associated.c intrinsics/abort.c \
intrinsics/selected_int_kind.f90 \
intrinsics/selected_real_kind.f90 intrinsics/trigd.c \
intrinsics/unpack_generic.c runtime/in_pack_generic.c \
- runtime/in_unpack_generic.c $(am__append_3) $(am__append_4)
+ runtime/in_unpack_generic.c $(am__append_4) $(am__append_5)
@IEEE_SUPPORT_TRUE@gfor_ieee_helper_src = ieee/ieee_helper.c
@IEEE_SUPPORT_FALSE@gfor_ieee_src =
@IEEE_SUPPORT_TRUE@gfor_ieee_src = \
@@ -806,8 +810,8 @@ gfor_helper_src = intrinsics/associated.c intrinsics/abort.c \
@IEEE_SUPPORT_TRUE@ieee/ieee_features.F90
gfor_src = runtime/bounds.c runtime/compile_options.c runtime/memory.c \
- runtime/string.c runtime/select.c $(am__append_5) \
- $(am__append_6)
+ runtime/string.c runtime/select.c $(am__append_6) \
+ $(am__append_7)
i_all_c = \
$(srcdir)/generated/all_l1.c \
$(srcdir)/generated/all_l2.c \
diff --git a/libgfortran/configure b/libgfortran/configure
index cd176b04a14..774dd52fc95 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -654,6 +654,8 @@ extra_ldflags_libgfortran
ac_ct_FC
FCFLAGS
FC
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -819,6 +821,7 @@ enable_static
with_pic
enable_fast_install
enable_libtool_lock
+enable_darwin_at_rpath
enable_largefile
enable_libquadmath_support
with_gcc_major_version_only
@@ -1473,6 +1476,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--disable-largefile omit support for large files
--disable-libquadmath-support
disable libquadmath support for Fortran
@@ -9243,7 +9249,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10953,6 +10959,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10970,9 +11019,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12799,7 +12852,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12802 "configure"
+#line 12855 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12905,7 +12958,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12908 "configure"
+#line 12961 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13307,6 +13360,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
#AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10
# We need gfortran to compile parts of the library
@@ -14950,6 +15011,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_FC=no
hardcode_direct_FC=no
hardcode_automatic_FC=yes
@@ -14967,9 +15071,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_FC="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_FC="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -16242,9 +16350,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# extra LD Flags which are required for targets
+extra_ldflags_libgfortran=
case "${host}" in
- *-darwin*)
- # Darwin needs -single_module when linking libgfortran
+ *-*-darwin[4567]*)
+ # Earlier Darwin needs -single_module when linking libgfortran
extra_ldflags_libgfortran=-Wl,-single_module
;;
esac
@@ -31601,6 +31710,10 @@ if test -z "${HAVE_HWCAP_TRUE}" && test -z "${HAVE_HWCAP_FALSE}"; then
as_fn_error $? "conditional \"HAVE_HWCAP\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${IEEE_SUPPORT_TRUE}" && test -z "${IEEE_SUPPORT_FALSE}"; then
as_fn_error $? "conditional \"IEEE_SUPPORT\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index 8bd2af966c8..46585a3ee14 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -269,6 +269,7 @@ LT_LIB_M
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
#AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10
# We need gfortran to compile parts of the library
@@ -277,9 +278,10 @@ FC="$GFORTRAN"
AC_PROG_FC(gfortran)
# extra LD Flags which are required for targets
+extra_ldflags_libgfortran=
case "${host}" in
- *-darwin*)
- # Darwin needs -single_module when linking libgfortran
+ *-*-darwin[[4567]]*)
+ # Earlier Darwin needs -single_module when linking libgfortran
extra_ldflags_libgfortran=-Wl,-single_module
;;
esac
diff --git a/libgm2/Makefile.am b/libgm2/Makefile.am
index 95df3ed7a30..aa35e747c9a 100644
--- a/libgm2/Makefile.am
+++ b/libgm2/Makefile.am
@@ -46,6 +46,12 @@ SUBDIRS = libm2min libm2log libm2cor libm2iso libm2pim
GM2_BUILDDIR := $(shell pwd)
gm2_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
+if ENABLE_DARWIN_AT_RPATH
+DARWIN_AT_RPATH=yes
+else
+DARWIN_AT_RPATH=yes
+endif
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
# friends when we are called from the top level Makefile.
@@ -91,7 +97,8 @@ AM_MAKEFLAGS = \
"WERROR=$(WERROR)" \
"TARGET_LIB_PATH=$(TARGET_LIB_PATH)" \
"TARGET_LIB_PATH_libgm2=$(TARGET_LIB_PATH_libgm2)" \
- "LIBTOOL=$(GM2_BUILDDIR)/libtool"
+ "LIBTOOL=$(GM2_BUILDDIR)/libtool" \
+ "DARWIN_AT_RPATH=$(DARWIN_AT_RPATH)"
# Subdir rules rely on $(FLAGS_TO_PASS)
FLAGS_TO_PASS = $(AM_MAKEFLAGS)
diff --git a/libgm2/Makefile.in b/libgm2/Makefile.in
index c0396791f48..e8fa4aa52dc 100644
--- a/libgm2/Makefile.in
+++ b/libgm2/Makefile.in
@@ -90,15 +90,15 @@ host_triplet = @host@
target_triplet = @target@
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
@@ -343,6 +343,8 @@ GM2_SRC = $(GCC_DIR)/m2
SUBDIRS = libm2min libm2log libm2cor libm2iso libm2pim
GM2_BUILDDIR := $(shell pwd)
gm2_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
+@ENABLE_DARWIN_AT_RPATH_FALSE@DARWIN_AT_RPATH = yes
+@ENABLE_DARWIN_AT_RPATH_TRUE@DARWIN_AT_RPATH = yes
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
@@ -389,7 +391,8 @@ AM_MAKEFLAGS = \
"WERROR=$(WERROR)" \
"TARGET_LIB_PATH=$(TARGET_LIB_PATH)" \
"TARGET_LIB_PATH_libgm2=$(TARGET_LIB_PATH_libgm2)" \
- "LIBTOOL=$(GM2_BUILDDIR)/libtool"
+ "LIBTOOL=$(GM2_BUILDDIR)/libtool" \
+ "DARWIN_AT_RPATH=$(DARWIN_AT_RPATH)"
# Subdir rules rely on $(FLAGS_TO_PASS)
diff --git a/libgm2/aclocal.m4 b/libgm2/aclocal.m4
index c352303012d..832065fbb9b 100644
--- a/libgm2/aclocal.m4
+++ b/libgm2/aclocal.m4
@@ -1187,14 +1187,14 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
-m4_include([../libtool.m4])
-m4_include([../ltoptions.m4])
-m4_include([../ltsugar.m4])
-m4_include([../ltversion.m4])
-m4_include([../lt~obsolete.m4])
m4_include([../config/acx.m4])
m4_include([../config/depstand.m4])
m4_include([../config/lead-dot.m4])
m4_include([../config/multi.m4])
m4_include([../config/no-executables.m4])
m4_include([../config/override.m4])
+m4_include([../libtool.m4])
+m4_include([../ltoptions.m4])
+m4_include([../ltsugar.m4])
+m4_include([../ltversion.m4])
+m4_include([../lt~obsolete.m4])
diff --git a/libgm2/configure b/libgm2/configure
index 072d584544e..d55a7f4a74b 100755
--- a/libgm2/configure
+++ b/libgm2/configure
@@ -649,6 +649,8 @@ GM2_FOR_TARGET
CC_FOR_BUILD
enable_static
enable_shared
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
CXXCPP
OTOOL64
OTOOL
@@ -805,6 +807,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
with_gcc_major_version_only
'
ac_precious_vars='build_alias
@@ -1455,6 +1458,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -6569,10 +6575,6 @@ fi
-enable_dlopen=yes
-
-
-
case `pwd` in
*\ * | *\ *)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
@@ -9181,7 +9183,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9229,6 +9231,8 @@ done
+ enable_dlopen=no
+
enable_win32_dll=no
@@ -10892,6 +10896,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10909,9 +10956,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12738,7 +12789,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12741 "configure"
+#line 12792 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12844,7 +12895,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12847 "configure"
+#line 12898 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13726,6 +13777,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13743,12 +13837,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -16122,6 +16224,21 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+enable_dlopen=yes
+
+
+
+
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
+
if test "${multilib}" = "yes"; then
@@ -20310,6 +20427,10 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${BUILD_PIMLIB_TRUE}" && test -z "${BUILD_PIMLIB_FALSE}"; then
as_fn_error $? "conditional \"BUILD_PIMLIB\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgm2/configure.ac b/libgm2/configure.ac
index 92e76c9346c..5701b95878b 100644
--- a/libgm2/configure.ac
+++ b/libgm2/configure.ac
@@ -212,8 +212,12 @@ AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
AC_PROG_MAKE_SET
AC_PROG_INSTALL
-AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
+LT_INIT
+AC_LIBTOOL_DLOPEN
+
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
diff --git a/libgm2/libm2cor/Makefile.am b/libgm2/libm2cor/Makefile.am
index 48de40c22dd..e50c7a2ef55 100644
--- a/libgm2/libm2cor/Makefile.am
+++ b/libgm2/libm2cor/Makefile.am
@@ -123,6 +123,10 @@ libm2cor_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2cor_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2cor_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
+
libm2cor_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2cor_la_link_flags)
BUILT_SOURCES = SYSTEM.def
CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2cor/Makefile.in b/libgm2/libm2cor/Makefile.in
index 3b0b40fea60..cc8a3fa73ed 100644
--- a/libgm2/libm2cor/Makefile.in
+++ b/libgm2/libm2cor/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@BUILD_CORLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2cor
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -468,8 +469,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_CORLIB_TRUE@ -fm2-pathname=m2iso -I$(GM2_SRC)/gm2-libs-iso \
@BUILD_CORLIB_TRUE@ -fm2-g -g -Wreturn-type -fcase -fm2-prefix=m2cor
-@BUILD_CORLIB_TRUE@@TARGET_DARWIN_FALSE@libm2cor_la_link_flags =
-@BUILD_CORLIB_TRUE@@TARGET_DARWIN_TRUE@libm2cor_la_link_flags = -Wl,-undefined,dynamic_lookup
+@BUILD_CORLIB_TRUE@@TARGET_DARWIN_FALSE@libm2cor_la_link_flags = \
+@BUILD_CORLIB_TRUE@@TARGET_DARWIN_FALSE@ $(am__append_1)
+@BUILD_CORLIB_TRUE@@TARGET_DARWIN_TRUE@libm2cor_la_link_flags = -Wl,-undefined,dynamic_lookup \
+@BUILD_CORLIB_TRUE@@TARGET_DARWIN_TRUE@ $(am__append_1)
@BUILD_CORLIB_TRUE@libm2cor_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2cor_la_link_flags)
@BUILD_CORLIB_TRUE@BUILT_SOURCES = SYSTEM.def
@BUILD_CORLIB_TRUE@CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2iso/Makefile.am b/libgm2/libm2iso/Makefile.am
index 1386f156cab..4d8e897266f 100644
--- a/libgm2/libm2iso/Makefile.am
+++ b/libgm2/libm2iso/Makefile.am
@@ -197,6 +197,10 @@ libm2iso_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2iso_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2iso_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
+
libm2iso_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2iso_la_link_flags)
CLEANFILES = SYSTEM.def
BUILT_SOURCES = SYSTEM.def
diff --git a/libgm2/libm2iso/Makefile.in b/libgm2/libm2iso/Makefile.in
index b939581b7c1..08563adfe78 100644
--- a/libgm2/libm2iso/Makefile.in
+++ b/libgm2/libm2iso/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@BUILD_ISOLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2iso
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -569,8 +570,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_ISOLIB_TRUE@ -fm2-pathname=m2pim -I$(GM2_SRC)/gm2-libs \
@BUILD_ISOLIB_TRUE@ -fiso -fextended-opaque -fm2-g -g -Wreturn-type -fcase -fm2-prefix=m2iso
-@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_FALSE@libm2iso_la_link_flags =
-@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_TRUE@libm2iso_la_link_flags = -Wl,-undefined,dynamic_lookup
+@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_FALSE@libm2iso_la_link_flags = \
+@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_FALSE@ $(am__append_1)
+@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_TRUE@libm2iso_la_link_flags = -Wl,-undefined,dynamic_lookup \
+@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_TRUE@ $(am__append_1)
@BUILD_ISOLIB_TRUE@libm2iso_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2iso_la_link_flags)
@BUILD_ISOLIB_TRUE@CLEANFILES = SYSTEM.def
@BUILD_ISOLIB_TRUE@BUILT_SOURCES = SYSTEM.def
diff --git a/libgm2/libm2log/Makefile.am b/libgm2/libm2log/Makefile.am
index a15747fd245..3b7609ee5c1 100644
--- a/libgm2/libm2log/Makefile.am
+++ b/libgm2/libm2log/Makefile.am
@@ -142,6 +142,9 @@ libm2log_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2log_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2log_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
libm2log_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2log_la_link_flags)
BUILT_SOURCES = ../libm2pim/SYSTEM.def
diff --git a/libgm2/libm2log/Makefile.in b/libgm2/libm2log/Makefile.in
index ba34a6b445a..fa12a386c55 100644
--- a/libgm2/libm2log/Makefile.in
+++ b/libgm2/libm2log/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@BUILD_LOGLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2log
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -477,8 +478,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_LOGLIB_TRUE@ -fm2-pathname=m2iso -I$(GM2_SRC)/gm2-libs-iso \
@BUILD_LOGLIB_TRUE@ -Wreturn-type -fcase -fm2-prefix=m2log
-@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_FALSE@libm2log_la_link_flags =
-@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_TRUE@libm2log_la_link_flags = -Wl,-undefined,dynamic_lookup
+@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_FALSE@libm2log_la_link_flags = \
+@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_FALSE@ $(am__append_1)
+@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_TRUE@libm2log_la_link_flags = -Wl,-undefined,dynamic_lookup \
+@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_TRUE@ $(am__append_1)
@BUILD_LOGLIB_TRUE@libm2log_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2log_la_link_flags)
@BUILD_LOGLIB_TRUE@BUILT_SOURCES = ../libm2pim/SYSTEM.def
@BUILD_LOGLIB_TRUE@M2LIBDIR = /m2/m2log/
diff --git a/libgm2/libm2min/Makefile.am b/libgm2/libm2min/Makefile.am
index 1ff160028f6..21411769505 100644
--- a/libgm2/libm2min/Makefile.am
+++ b/libgm2/libm2min/Makefile.am
@@ -113,6 +113,9 @@ libm2min_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2min_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2min_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
libm2min_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2min_la_link_flags)
BUILT_SOURCES = SYSTEM.def
CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2min/Makefile.in b/libgm2/libm2min/Makefile.in
index 9ead8397fd0..73af6568b88 100644
--- a/libgm2/libm2min/Makefile.in
+++ b/libgm2/libm2min/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2min
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -441,8 +442,10 @@ libm2min_la_M2FLAGS = \
-fm2-pathname=m2pim -I$(GM2_SRC)/gm2-libs -fno-exceptions \
-fno-m2-plugin -fno-scaffold-dynamic -fno-scaffold-main -fm2-prefix=m2min
-@TARGET_DARWIN_FALSE@libm2min_la_link_flags =
-@TARGET_DARWIN_TRUE@libm2min_la_link_flags = -Wl,-undefined,dynamic_lookup
+@TARGET_DARWIN_FALSE@libm2min_la_link_flags = $(am__append_1)
+@TARGET_DARWIN_TRUE@libm2min_la_link_flags = \
+@TARGET_DARWIN_TRUE@ -Wl,-undefined,dynamic_lookup \
+@TARGET_DARWIN_TRUE@ $(am__append_1)
libm2min_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2min_la_link_flags)
BUILT_SOURCES = SYSTEM.def
CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2pim/Makefile.am b/libgm2/libm2pim/Makefile.am
index ebfeba1ac1d..e777a60c077 100644
--- a/libgm2/libm2pim/Makefile.am
+++ b/libgm2/libm2pim/Makefile.am
@@ -175,6 +175,9 @@ libm2pim_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2pim_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2pim_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
libm2pim_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2pim_la_link_flags)
BUILT_SOURCES = SYSTEM.def
CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2pim/Makefile.in b/libgm2/libm2pim/Makefile.in
index 660488f9692..54414058bc5 100644
--- a/libgm2/libm2pim/Makefile.in
+++ b/libgm2/libm2pim/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@BUILD_PIMLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2pim
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -538,8 +539,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_PIMLIB_TRUE@ -fm2-pathname=m2iso -I$(GM2_SRC)/gm2-libs-iso \
@BUILD_PIMLIB_TRUE@ -fm2-g -g -Wreturn-type -fcase -fm2-prefix=m2pim
-@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_FALSE@libm2pim_la_link_flags =
-@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_TRUE@libm2pim_la_link_flags = -Wl,-undefined,dynamic_lookup
+@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_FALSE@libm2pim_la_link_flags = \
+@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_FALSE@ $(am__append_1)
+@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_TRUE@libm2pim_la_link_flags = -Wl,-undefined,dynamic_lookup \
+@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_TRUE@ $(am__append_1)
@BUILD_PIMLIB_TRUE@libm2pim_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2pim_la_link_flags)
@BUILD_PIMLIB_TRUE@BUILT_SOURCES = SYSTEM.def
@BUILD_PIMLIB_TRUE@CLEANFILES = SYSTEM.def
diff --git a/libgo/configure b/libgo/configure
index a607dbff68e..72d46c3eec3 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -708,6 +708,8 @@ glibgo_toolexecdir
WERROR
WARN_FLAGS
CC_FOR_BUILD
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
CPP
@@ -11544,7 +11546,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11547 "configure"
+#line 11549 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11650,7 +11652,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11653 "configure"
+#line 11655 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13779,6 +13781,14 @@ CC="$lt_save_CC"
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
CC_FOR_BUILD=${CC_FOR_BUILD:-gcc}
@@ -16386,6 +16396,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${USE_LIBFFI_TRUE}" && test -z "${USE_LIBFFI_FALSE}"; then
as_fn_error $? "conditional \"USE_LIBFFI\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgo/configure.ac b/libgo/configure.ac
index a59aa091d1d..6f1ac32660b 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -53,6 +53,7 @@ AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
CC_FOR_BUILD=${CC_FOR_BUILD:-gcc}
AC_SUBST(CC_FOR_BUILD)
diff --git a/libgomp/Makefile.am b/libgomp/Makefile.am
index 428f7a9dab5..ceb8c910abd 100644
--- a/libgomp/Makefile.am
+++ b/libgomp/Makefile.am
@@ -53,9 +53,14 @@ else
libgomp_version_script =
libgomp_version_dep =
endif
+
libgomp_version_info = -version-info $(libtool_VERSION)
+if ENABLE_DARWIN_AT_RPATH
+libgomp_darwin_rpath = -Wc,-nodefaultrpaths
+libgomp_darwin_rpath += -Wl,-rpath,@loader_path
+endif
libgomp_la_LDFLAGS = $(libgomp_version_info) $(libgomp_version_script) \
- $(lt_host_flags)
+ $(lt_host_flags) $(libgomp_darwin_rpath)
libgomp_la_LIBADD =
libgomp_la_DEPENDENCIES = $(libgomp_version_dep)
libgomp_la_LINK = $(LINK) $(libgomp_la_LDFLAGS)
diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
index 3ef05e6a3cb..2467250215e 100644
--- a/libgomp/Makefile.in
+++ b/libgomp/Makefile.in
@@ -535,8 +535,11 @@ nodist_toolexeclib_HEADERS = libgomp.spec
@LIBGOMP_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgomp_version_dep = libgomp.ver
@LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgomp_version_dep = libgomp.ver-sun
libgomp_version_info = -version-info $(libtool_VERSION)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libgomp_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
libgomp_la_LDFLAGS = $(libgomp_version_info) $(libgomp_version_script) \
- $(lt_host_flags)
+ $(lt_host_flags) $(libgomp_darwin_rpath)
libgomp_la_LIBADD = $(DL_LIBS)
libgomp_la_DEPENDENCIES = $(libgomp_version_dep)
diff --git a/libgomp/configure b/libgomp/configure
index a12b30f1b0f..7c103cf37f1 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -683,6 +683,8 @@ CXX
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -822,6 +824,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
enable_linux_futex
enable_tls
@@ -1477,6 +1480,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -7618,7 +7624,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9591,6 +9597,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9608,9 +9657,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11416,7 +11469,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11419 "configure"
+#line 11472 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11522,7 +11575,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11525 "configure"
+#line 11578 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11783,6 +11836,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
@@ -13469,6 +13530,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_FC=no
hardcode_direct_FC=no
hardcode_automatic_FC=yes
@@ -13486,9 +13590,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_FC="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_FC="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -17130,6 +17238,10 @@ if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then
as_fn_error $? "conditional \"BUILD_INFO\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index 1aad83a79da..8c941cddd2f 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -148,6 +148,7 @@ AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
AM_MAINTAINER_MODE
diff --git a/libitm/Makefile.am b/libitm/Makefile.am
index 3f31ad30556..a25317b07fe 100644
--- a/libitm/Makefile.am
+++ b/libitm/Makefile.am
@@ -54,7 +54,12 @@ libitm_version_info = -version-info $(libtool_VERSION)
# want or need libstdc++.
libitm_la_DEPENDENCIES = $(libitm_version_dep)
libitm_la_LINK = $(LINK) $(libitm_la_LDFLAGS)
-libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script)
+if ENABLE_DARWIN_AT_RPATH
+libitm_darwin_rpath = -Wc,-nodefaultrpaths
+libitm_darwin_rpath += -Wl,-rpath,@loader_path
+endif
+libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script) \
+ $(libitm_darwin_rpath)
libitm_la_SOURCES = \
aatree.cc alloc.cc alloc_c.cc alloc_cpp.cc barrier.cc beginend.cc \
diff --git a/libitm/Makefile.in b/libitm/Makefile.in
index 7c51fe02511..9f0691018a9 100644
--- a/libitm/Makefile.in
+++ b/libitm/Makefile.in
@@ -480,7 +480,12 @@ libitm_version_info = -version-info $(libtool_VERSION)
# want or need libstdc++.
libitm_la_DEPENDENCIES = $(libitm_version_dep)
libitm_la_LINK = $(LINK) $(libitm_la_LDFLAGS)
-libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libitm_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script) \
+ $(libitm_darwin_rpath)
+
libitm_la_SOURCES = aatree.cc alloc.cc alloc_c.cc alloc_cpp.cc \
barrier.cc beginend.cc clone.cc eh_cpp.cc local.cc query.cc \
retry.cc rwlock.cc useraction.cc util.cc sjlj.S tls.cc \
diff --git a/libitm/configure b/libitm/configure
index 02e8de7896b..9ba7fb03a57 100755
--- a/libitm/configure
+++ b/libitm/configure
@@ -660,6 +660,8 @@ libtool_VERSION
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
CXXCPP
@@ -809,6 +811,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
enable_linux_futex
enable_tls
@@ -1461,6 +1464,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -8279,7 +8285,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10253,6 +10259,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10270,9 +10319,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12078,7 +12131,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12081 "configure"
+#line 12134 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12184,7 +12237,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12187 "configure"
+#line 12240 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13060,6 +13113,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13077,12 +13173,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15454,6 +15558,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
@@ -18212,6 +18324,10 @@ if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then
as_fn_error $? "conditional \"BUILD_INFO\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libitm/configure.ac b/libitm/configure.ac
index 892a24caa85..dded4d387be 100644
--- a/libitm/configure.ac
+++ b/libitm/configure.ac
@@ -156,6 +156,7 @@ AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes")
AM_PROG_LIBTOOL
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
AM_MAINTAINER_MODE
diff --git a/libobjc/configure b/libobjc/configure
index 752f6fdfebd..68172549137 100755
--- a/libobjc/configure
+++ b/libobjc/configure
@@ -636,6 +636,9 @@ OBJC_BOEHM_GC_LIBS
OBJC_BOEHM_GC_INCLUDES
OBJC_BOEHM_GC
OBJC_GCFLAGS
+extra_ldflags_libobjc
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
SET_MAKE
CPP
OTOOL64
@@ -667,7 +670,6 @@ RANLIB
AR
AS
XCFLAGS
-extra_ldflags_libobjc
lt_host_flags
OBJEXT
EXEEXT
@@ -755,6 +757,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_tls
enable_objc_gc
with_target_bdw_gc
@@ -1392,6 +1395,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-tls Use thread-local storage [default=yes]
--enable-objc-gc enable use of Boehm's garbage collector with the GNU
Objective-C runtime
@@ -3431,17 +3437,6 @@ esac
-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
-
# Add CET specific flags if CET is enabled
@@ -7011,7 +7006,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -8988,6 +8983,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9005,9 +9043,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -10834,7 +10876,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10837 "configure"
+#line 10879 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10940,7 +10982,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10943 "configure"
+#line 10985 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11212,6 +11254,38 @@ $as_echo "no" >&6; }
fi
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
+# 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
+
+
# -------
# Headers
# -------
@@ -11953,6 +12027,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/libobjc/configure.ac b/libobjc/configure.ac
index 9bd7d59d597..cb21ebbfcc7 100644
--- a/libobjc/configure.ac
+++ b/libobjc/configure.ac
@@ -148,17 +148,6 @@ m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
# 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)
@@ -183,6 +172,31 @@ AM_PROG_CC_C_O
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
# -------
diff --git a/libphobos/configure b/libphobos/configure
index b7276d95010..25b13bdd93e 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -707,6 +707,8 @@ get_gcc_base_ver
phobos_compiler_shared_flag
phobos_compiler_pic_flag
phobos_lt_pic_flag
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
OTOOL64
@@ -838,6 +840,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
with_gcc_major_version_only
enable_werror
with_libatomic
@@ -1490,6 +1493,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-werror turns on -Werror [default=no]
--enable-version-specific-runtime-libs
Specify that runtime libraries should be installed
@@ -8282,7 +8288,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9987,6 +9993,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10004,9 +10053,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11812,7 +11865,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11815 "configure"
+#line 11868 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11918,7 +11971,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11921 "configure"
+#line 11974 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13443,6 +13496,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_D=no
hardcode_direct_D=no
hardcode_automatic_D=yes
@@ -13460,9 +13556,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_D="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_D="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_D="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_D="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_D="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_D="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -14064,6 +14164,14 @@ CFLAGS=$lt_save_CFLAGS
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
# libtool variables for Phobos shared and position-independent compiles.
#
@@ -15877,6 +15985,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${DRUNTIME_CPU_AARCH64_TRUE}" && test -z "${DRUNTIME_CPU_AARCH64_FALSE}"; then
as_fn_error $? "conditional \"DRUNTIME_CPU_AARCH64\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libphobos/configure.ac b/libphobos/configure.ac
index 3b2e6df5d5c..bb669675ce0 100644
--- a/libphobos/configure.ac
+++ b/libphobos/configure.ac
@@ -93,6 +93,7 @@ AM_PROG_LIBTOOL
WITH_LOCAL_DRUNTIME([LT_LANG([D])], [])
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
# libtool variables for Phobos shared and position-independent compiles.
#
diff --git a/libphobos/libdruntime/Makefile.am b/libphobos/libdruntime/Makefile.am
index 832a0524ab3..b78bcdd203f 100644
--- a/libphobos/libdruntime/Makefile.am
+++ b/libphobos/libdruntime/Makefile.am
@@ -128,8 +128,11 @@ ALL_DRUNTIME_SOURCES = $(DRUNTIME_DSOURCES) $(DRUNTIME_CSOURCES) \
toolexeclib_LTLIBRARIES = libgdruntime.la
libgdruntime_la_SOURCES = $(ALL_DRUNTIME_SOURCES)
libgdruntime_la_LIBTOOLFLAGS =
+if ENABLE_DARWIN_AT_RPATH
+libgdruntime_darwin_rpath = -Wl,-rpath,@loader_path
+endif
libgdruntime_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../src,-Bgcc \
- -version-info $(libtool_VERSION)
+ -version-info $(libtool_VERSION) $(libgdruntime_darwin_rpath)
libgdruntime_la_LIBADD = $(LIBATOMIC) $(LIBBACKTRACE)
libgdruntime_la_DEPENDENCIES = $(DRTSTUFF)
# Also override library link commands: This is not strictly
diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in
index 61a2a770888..4d62985349b 100644
--- a/libphobos/libdruntime/Makefile.in
+++ b/libphobos/libdruntime/Makefile.in
@@ -813,8 +813,9 @@ ALL_DRUNTIME_SOURCES = $(DRUNTIME_DSOURCES) $(DRUNTIME_CSOURCES) \
toolexeclib_LTLIBRARIES = libgdruntime.la
libgdruntime_la_SOURCES = $(ALL_DRUNTIME_SOURCES)
libgdruntime_la_LIBTOOLFLAGS =
+@ENABLE_DARWIN_AT_RPATH_TRUE@libgdruntime_darwin_rpath = -Wl,-rpath,@loader_path
libgdruntime_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../src,-Bgcc \
- -version-info $(libtool_VERSION)
+ -version-info $(libtool_VERSION) $(libgdruntime_darwin_rpath)
libgdruntime_la_LIBADD = $(LIBATOMIC) $(LIBBACKTRACE)
libgdruntime_la_DEPENDENCIES = $(DRTSTUFF)
diff --git a/libphobos/src/Makefile.am b/libphobos/src/Makefile.am
index 6474fca5eb5..f6521ed5860 100644
--- a/libphobos/src/Makefile.am
+++ b/libphobos/src/Makefile.am
@@ -44,8 +44,11 @@ toolexeclib_DATA = libgphobos.spec
toolexeclib_LTLIBRARIES = libgphobos.la
libgphobos_la_SOURCES = $(ALL_PHOBOS_SOURCES)
libgphobos_la_LIBTOOLFLAGS =
+if ENABLE_DARWIN_AT_RPATH
+libgphobos_darwin_rpath = -Wl,-rpath,@loader_path
+endif
libgphobos_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../libdruntime/gcc \
- -version-info $(libtool_VERSION)
+ -version-info $(libtool_VERSION) $(libgphobos_darwin_rpath)
if ENABLE_LIBDRUNTIME_ONLY
libgphobos_la_LIBADD = ../libdruntime/libgdruntime_convenience.la
else
diff --git a/libphobos/src/Makefile.in b/libphobos/src/Makefile.in
index a6229587e7b..cc3358b437e 100644
--- a/libphobos/src/Makefile.in
+++ b/libphobos/src/Makefile.in
@@ -529,8 +529,9 @@ toolexeclib_DATA = libgphobos.spec
toolexeclib_LTLIBRARIES = libgphobos.la
libgphobos_la_SOURCES = $(ALL_PHOBOS_SOURCES)
libgphobos_la_LIBTOOLFLAGS =
+@ENABLE_DARWIN_AT_RPATH_TRUE@libgphobos_darwin_rpath = -Wl,-rpath,@loader_path
libgphobos_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../libdruntime/gcc \
- -version-info $(libtool_VERSION)
+ -version-info $(libtool_VERSION) $(libgphobos_darwin_rpath)
@ENABLE_LIBDRUNTIME_ONLY_FALSE@libgphobos_la_LIBADD = \
@ENABLE_LIBDRUNTIME_ONLY_FALSE@ ../libdruntime/libgdruntime_convenience.la $(LIBZ)
diff --git a/libquadmath/Makefile.am b/libquadmath/Makefile.am
index 35dffb46f6e..0d02c95e738 100644
--- a/libquadmath/Makefile.am
+++ b/libquadmath/Makefile.am
@@ -36,8 +36,13 @@ endif
toolexeclib_LTLIBRARIES = libquadmath.la
libquadmath_la_LIBADD =
+
+if ENABLE_DARWIN_AT_RPATH
+libquadmath_darwin_rpath = -Wc,-nodefaultrpaths
+libquadmath_darwin_rpath += -Wl,-rpath,@loader_path
+endif
libquadmath_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
- $(version_arg) $(lt_host_flags) -lm
+ $(version_arg) $(lt_host_flags) $(LIBM) $(libquadmath_darwin_rpath)
libquadmath_la_DEPENDENCIES = $(version_dep) $(libquadmath_la_LIBADD)
nodist_libsubinclude_HEADERS = quadmath.h quadmath_weak.h
diff --git a/libquadmath/Makefile.in b/libquadmath/Makefile.in
index 8c011212258..068af559457 100644
--- a/libquadmath/Makefile.in
+++ b/libquadmath/Makefile.in
@@ -355,6 +355,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
+LIBM = @LIBM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
@@ -463,8 +464,10 @@ AUTOMAKE_OPTIONS = foreign info-in-builddir
@BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_SUN_TRUE@@LIBQUAD_USE_SYMVER_TRUE@version_dep = quadmath.map-sun
@BUILD_LIBQUADMATH_TRUE@toolexeclib_LTLIBRARIES = libquadmath.la
@BUILD_LIBQUADMATH_TRUE@libquadmath_la_LIBADD =
+@BUILD_LIBQUADMATH_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@libquadmath_darwin_rpath = -Wc,-nodefaultrpaths \
+@BUILD_LIBQUADMATH_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
@BUILD_LIBQUADMATH_TRUE@libquadmath_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
-@BUILD_LIBQUADMATH_TRUE@ $(version_arg) $(lt_host_flags) -lm
+@BUILD_LIBQUADMATH_TRUE@ $(version_arg) $(lt_host_flags) $(LIBM) $(libquadmath_darwin_rpath)
@BUILD_LIBQUADMATH_TRUE@libquadmath_la_DEPENDENCIES = $(version_dep) $(libquadmath_la_LIBADD)
@BUILD_LIBQUADMATH_TRUE@nodist_libsubinclude_HEADERS = quadmath.h quadmath_weak.h
diff --git a/libquadmath/configure b/libquadmath/configure
index 0b145a644c3..5bd9a070fdc 100755
--- a/libquadmath/configure
+++ b/libquadmath/configure
@@ -644,11 +644,14 @@ LIBQUAD_USE_SYMVER_GNU_FALSE
LIBQUAD_USE_SYMVER_GNU_TRUE
LIBQUAD_USE_SYMVER_FALSE
LIBQUAD_USE_SYMVER_TRUE
+LIBM
toolexeclibdir
toolexecdir
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -785,6 +788,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
with_toolexeclibdir
enable_symvers
@@ -1435,6 +1439,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -7310,7 +7317,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9022,6 +9029,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9039,9 +9089,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -10868,7 +10922,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10871 "configure"
+#line 10925 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10974,7 +11028,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10977 "configure"
+#line 11031 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11235,6 +11289,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
@@ -12199,6 +12261,148 @@ esac
+LIBM=
+case $host in
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+ # These system don't have libm, or don't need it
+ ;;
+*-ncr-sysv4.3*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mwvalidcheckl in -lmw" >&5
+$as_echo_n "checking for _mwvalidcheckl in -lmw... " >&6; }
+if ${ac_cv_lib_mw__mwvalidcheckl+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lmw $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char _mwvalidcheckl ();
+int
+main ()
+{
+return _mwvalidcheckl ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_mw__mwvalidcheckl=yes
+else
+ ac_cv_lib_mw__mwvalidcheckl=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mw__mwvalidcheckl" >&5
+$as_echo "$ac_cv_lib_mw__mwvalidcheckl" >&6; }
+if test "x$ac_cv_lib_mw__mwvalidcheckl" = xyes; then :
+ LIBM="-lmw"
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
+$as_echo_n "checking for cos in -lm... " >&6; }
+if ${ac_cv_lib_m_cos+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char cos ();
+int
+main ()
+{
+return cos ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_cos=yes
+else
+ ac_cv_lib_m_cos=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
+$as_echo "$ac_cv_lib_m_cos" >&6; }
+if test "x$ac_cv_lib_m_cos" = xyes; then :
+ LIBM="$LIBM -lm"
+fi
+
+ ;;
+*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
+$as_echo_n "checking for cos in -lm... " >&6; }
+if ${ac_cv_lib_m_cos+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char cos ();
+int
+main ()
+{
+return cos ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_cos=yes
+else
+ ac_cv_lib_m_cos=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
+$as_echo "$ac_cv_lib_m_cos" >&6; }
+if test "x$ac_cv_lib_m_cos" = xyes; then :
+ LIBM="-lm"
+fi
+
+ ;;
+esac
+
+
+
for ac_header in fenv.h langinfo.h locale.h wchar.h wctype.h limits.h ctype.h printf.h errno.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
@@ -13459,6 +13663,10 @@ if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then
as_fn_error $? "conditional \"BUILD_INFO\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libquadmath/configure.ac b/libquadmath/configure.ac
index eec4084a45f..94a3f2179e9 100644
--- a/libquadmath/configure.ac
+++ b/libquadmath/configure.ac
@@ -59,6 +59,7 @@ AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
AM_MAINTAINER_MODE
@@ -121,6 +122,8 @@ esac
AC_SUBST(toolexecdir)
AC_SUBST(toolexeclibdir)
+AC_CHECK_LIBM
+
AC_CHECK_HEADERS(fenv.h langinfo.h locale.h wchar.h wctype.h limits.h ctype.h printf.h errno.h)
LIBQUAD_CHECK_MATH_H_SIGNGAM
diff --git a/libsanitizer/asan/Makefile.am b/libsanitizer/asan/Makefile.am
index 4f802f723d6..223d3e07816 100644
--- a/libsanitizer/asan/Makefile.am
+++ b/libsanitizer/asan/Makefile.am
@@ -60,7 +60,12 @@ libasan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
libasan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libasan)
+if ENABLE_DARWIN_AT_RPATH
+libasan_darwin_rpath = -Wc,-nodefaultrpaths
+libasan_darwin_rpath += -Wl,-rpath,@loader_path
+endif
+libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libasan) $(libasan_darwin_rpath)
libasan_preinit.o: asan_preinit.o
cp $< $@
diff --git a/libsanitizer/asan/Makefile.in b/libsanitizer/asan/Makefile.in
index 7833a9a4c3f..e88e5e0b0a7 100644
--- a/libsanitizer/asan/Makefile.in
+++ b/libsanitizer/asan/Makefile.in
@@ -465,7 +465,12 @@ libasan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(top_builddir)/lsan/libsanitizer_lsan.la $(am__append_2) \
$(am__append_3) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libasan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libasan_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libasan) $(libasan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
diff --git a/libsanitizer/configure b/libsanitizer/configure
index 0805d254fe5..2edd5c37ce7 100755
--- a/libsanitizer/configure
+++ b/libsanitizer/configure
@@ -666,6 +666,8 @@ LSAN_SUPPORTED_FALSE
LSAN_SUPPORTED_TRUE
TSAN_SUPPORTED_FALSE
TSAN_SUPPORTED_TRUE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
CXXCPP
@@ -817,6 +819,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_werror
with_gcc_major_version_only
enable_cet
@@ -1471,6 +1474,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--disable-werror disable building with -Werror
--enable-cet enable Intel CET in target libraries [default=auto]
@@ -8891,7 +8897,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10596,6 +10602,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10613,9 +10662,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12421,7 +12474,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12424 "configure"
+#line 12477 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12527,7 +12580,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12530 "configure"
+#line 12583 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13403,6 +13456,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13420,12 +13516,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15845,6 +15949,15 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
@@ -17243,6 +17356,10 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${TSAN_SUPPORTED_TRUE}" && test -z "${TSAN_SUPPORTED_FALSE}"; then
as_fn_error $? "conditional \"TSAN_SUPPORTED\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libsanitizer/configure.ac b/libsanitizer/configure.ac
index 04cd8910ed6..5906c8d4887 100644
--- a/libsanitizer/configure.ac
+++ b/libsanitizer/configure.ac
@@ -85,6 +85,8 @@ esac
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
AC_CHECK_SIZEOF([void *])
if test "${multilib}" = "yes"; then
diff --git a/libsanitizer/hwasan/Makefile.am b/libsanitizer/hwasan/Makefile.am
index bb7f8fa0b7b..653fc8c4720 100644
--- a/libsanitizer/hwasan/Makefile.am
+++ b/libsanitizer/hwasan/Makefile.am
@@ -47,7 +47,11 @@ libhwasan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
libhwasan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libhwasan)
+if ENABLE_DARWIN_AT_RPATH
+libhwasan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
+libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libhwasan) $(libhwasan_darwin_rpath)
libhwasan_preinit.o: hwasan_preinit.o
cp $< $@
diff --git a/libsanitizer/hwasan/Makefile.in b/libsanitizer/hwasan/Makefile.in
index 58bc26b44b9..87971fd3374 100644
--- a/libsanitizer/hwasan/Makefile.in
+++ b/libsanitizer/hwasan/Makefile.in
@@ -447,7 +447,10 @@ libhwasan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(top_builddir)/lsan/libsanitizer_lsan.la $(am__append_1) \
$(am__append_2) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libhwasan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libhwasan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/
+libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libhwasan) $(libhwasan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
diff --git a/libsanitizer/lsan/Makefile.am b/libsanitizer/lsan/Makefile.am
index 6ff28ff5eea..7701b0e18cf 100644
--- a/libsanitizer/lsan/Makefile.am
+++ b/libsanitizer/lsan/Makefile.am
@@ -41,8 +41,12 @@ if LIBBACKTRACE_SUPPORTED
liblsan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
liblsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_liblsan)
-
+if ENABLE_DARWIN_AT_RPATH
+liblsan_darwin_rpath = -Wc,-nodefaultrpaths
+liblsan_darwin_rpath += -Wl,-rpath,@loader_path
+endif
+liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_liblsan) $(liblsan_darwin_rpath)
liblsan_preinit.o: lsan_preinit.o
cp $< $@
diff --git a/libsanitizer/lsan/Makefile.in b/libsanitizer/lsan/Makefile.in
index d8fd4ee9557..078edf01fda 100644
--- a/libsanitizer/lsan/Makefile.in
+++ b/libsanitizer/lsan/Makefile.in
@@ -413,7 +413,12 @@ liblsan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(top_builddir)/interception/libinterception.la \
$(am__append_1) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_liblsan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@liblsan_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_liblsan) $(liblsan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
@@ -788,7 +793,6 @@ uninstall-am: uninstall-nodist_toolexeclibHEADERS \
.PRECIOUS: Makefile
-
liblsan_preinit.o: lsan_preinit.o
cp $< $@
diff --git a/libsanitizer/tsan/Makefile.am b/libsanitizer/tsan/Makefile.am
index da80743da9d..01290b0313d 100644
--- a/libsanitizer/tsan/Makefile.am
+++ b/libsanitizer/tsan/Makefile.am
@@ -57,7 +57,11 @@ libtsan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
libtsan_la_DEPENDENCIES +=$(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
libtsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libtsan)
+if ENABLE_DARWIN_AT_RPATH
+libtsan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
+libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libtsan) $(libtsan_darwin_rpath)
libtsan_preinit.o: tsan_preinit.o
cp $< $@
diff --git a/libsanitizer/tsan/Makefile.in b/libsanitizer/tsan/Makefile.in
index 36498832bb8..95011584bcb 100644
--- a/libsanitizer/tsan/Makefile.in
+++ b/libsanitizer/tsan/Makefile.in
@@ -464,7 +464,10 @@ libtsan_la_DEPENDENCIES = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(top_builddir)/interception/libinterception.la \
$(TSAN_TARGET_DEPENDENT_OBJECTS) $(am__append_2)
-libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libtsan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libtsan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/
+libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libtsan) $(libtsan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
diff --git a/libsanitizer/ubsan/Makefile.am b/libsanitizer/ubsan/Makefile.am
index d480f26adc0..7769b3437e4 100644
--- a/libsanitizer/ubsan/Makefile.am
+++ b/libsanitizer/ubsan/Makefile.am
@@ -36,7 +36,12 @@ if LIBBACKTRACE_SUPPORTED
libubsan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
libubsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libubsan)
+if ENABLE_DARWIN_AT_RPATH
+libubsan_darwin_rpath = -Wc,-nodefaultrpaths
+libubsan_darwin_rpath += -Wl,-rpath,@loader_path
+endif
+libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libubsan) $(libubsan_darwin_rpath)
# Use special rules for files that require RTTI support.
ubsan_handlers_cxx.% ubsan_type_hash.% ubsan_type_hash_itanium.% : AM_CXXFLAGS += -frtti
diff --git a/libsanitizer/ubsan/Makefile.in b/libsanitizer/ubsan/Makefile.in
index 92a8e387fd7..7e51480e970 100644
--- a/libsanitizer/ubsan/Makefile.in
+++ b/libsanitizer/ubsan/Makefile.in
@@ -400,7 +400,12 @@ libubsan_la_SOURCES = $(ubsan_files)
libubsan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(am__append_1) $(am__append_2) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libubsan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libubsan_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libubsan) $(libubsan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
diff --git a/libssp/Makefile.am b/libssp/Makefile.am
index 1636e43b369..f7ed2aa6043 100644
--- a/libssp/Makefile.am
+++ b/libssp/Makefile.am
@@ -49,8 +49,12 @@ libssp_la_SOURCES = \
vsnprintf-chk.c vsprintf-chk.c
libssp_la_LIBADD =
libssp_la_DEPENDENCIES = $(version_dep) $(libssp_la_LIBADD)
+if ENABLE_DARWIN_AT_RPATH
+libssp_darwin_rpath = -Wc,-nodefaultrpaths
+libssp_darwin_rpath += -Wl,-rpath,@loader_path
+endif
libssp_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
- $(version_arg) $(lt_host_flags)
+ $(version_arg) $(lt_host_flags) $(libssp_darwin_rpath)
libssp_nonshared_la_SOURCES = \
ssp-local.c
diff --git a/libssp/Makefile.in b/libssp/Makefile.in
index bc8a0dc2b28..1cf86361b96 100644
--- a/libssp/Makefile.in
+++ b/libssp/Makefile.in
@@ -376,8 +376,11 @@ libssp_la_SOURCES = \
libssp_la_LIBADD =
libssp_la_DEPENDENCIES = $(version_dep) $(libssp_la_LIBADD)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libssp_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
libssp_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
- $(version_arg) $(lt_host_flags)
+ $(version_arg) $(lt_host_flags) $(libssp_darwin_rpath)
libssp_nonshared_la_SOURCES = \
ssp-local.c
diff --git a/libssp/configure b/libssp/configure
index 7f8b8fdf99d..a31b69f306e 100755
--- a/libssp/configure
+++ b/libssp/configure
@@ -636,6 +636,8 @@ LIBOBJS
get_gcc_base_ver
toolexeclibdir
toolexecdir
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -781,6 +783,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
with_toolexeclibdir
with_gcc_major_version_only
'
@@ -1426,6 +1429,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -7496,7 +7502,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9208,6 +9214,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9225,9 +9274,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11054,7 +11107,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11057 "configure"
+#line 11110 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11160,7 +11213,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11163 "configure"
+#line 11216 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11438,6 +11491,15 @@ fi
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# Calculate toolexeclibdir
# Also toolexecdir, though it's only used in toolexeclibdir
case ${version_specific_libs} in
@@ -11647,6 +11709,10 @@ if test -z "${LIBSSP_USE_SYMVER_SUN_TRUE}" && test -z "${LIBSSP_USE_SYMVER_SUN_F
as_fn_error $? "conditional \"LIBSSP_USE_SYMVER_SUN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/libssp/configure.ac b/libssp/configure.ac
index f30f81c54f6..90778e2355d 100644
--- a/libssp/configure.ac
+++ b/libssp/configure.ac
@@ -165,6 +165,8 @@ AC_SUBST(enable_static)
GCC_WITH_TOOLEXECLIBDIR
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
# Calculate toolexeclibdir
# Also toolexecdir, though it's only used in toolexeclibdir
case ${version_specific_libs} in
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index c4da56c3042..b2b121a0936 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -789,6 +789,8 @@ GLIBCXX_HOSTED_TRUE
glibcxx_compiler_shared_flag
glibcxx_compiler_pic_flag
glibcxx_lt_pic_flag
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -924,6 +926,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_hosted_libstdcxx
enable_libstdcxx_hosted
enable_libstdcxx_verbose
@@ -1615,6 +1618,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--disable-hosted-libstdcxx
only build freestanding C++ runtime support
--disable-libstdcxx-hosted
@@ -8539,7 +8545,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10379,6 +10385,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10396,9 +10445,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12225,7 +12278,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12228 "configure"
+#line 12281 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12331,7 +12384,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12334 "configure"
+#line 12387 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13213,6 +13266,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13230,12 +13326,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15632,6 +15736,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
if test "$enable_vtable_verify" = yes; then
predep_objects_CXX="${predep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_start.o"
@@ -16055,7 +16167,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; }
# Fake what AC_TRY_COMPILE does.
cat > conftest.$ac_ext << EOF
-#line 16058 "configure"
+#line 16170 "configure"
int main()
{
typedef bool atomic_type;
@@ -16090,7 +16202,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16093 "configure"
+#line 16205 "configure"
int main()
{
typedef short atomic_type;
@@ -16125,7 +16237,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16128 "configure"
+#line 16240 "configure"
int main()
{
// NB: _Atomic_word not necessarily int.
@@ -16161,7 +16273,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16164 "configure"
+#line 16276 "configure"
int main()
{
typedef long long atomic_type;
@@ -16317,7 +16429,7 @@ $as_echo "mutex" >&6; }
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 16320 "configure"
+#line 16432 "configure"
int main()
{
_Decimal32 d1;
@@ -16359,7 +16471,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 16362 "configure"
+#line 16474 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
@@ -74906,6 +75018,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${GLIBCXX_HOSTED_TRUE}" && test -z "${GLIBCXX_HOSTED_FALSE}"; then
as_fn_error $? "conditional \"GLIBCXX_HOSTED\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index fc0f2522027..80e573e690f 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -108,6 +108,7 @@ AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
if test "$enable_vtable_verify" = yes; then
predep_objects_CXX="${predep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_start.o"
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index 5b9af41cdb9..925137c2ccc 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -152,8 +152,13 @@ libstdc___la_DEPENDENCIES = \
$(top_builddir)/src/c++17/libc++17convenience.la \
$(top_builddir)/src/c++20/libc++20convenience.la
+if ENABLE_DARWIN_AT_RPATH
+libstdc___darwin_rpath = -Wc,-nodefaultrpaths
+libstdc___darwin_rpath += -Wl,-rpath,@loader_path
+endif
+
libstdc___la_LDFLAGS = \
- -version-info $(libtool_VERSION) ${version_arg} -lm
+ -version-info $(libtool_VERSION) ${version_arg} -lm $(libstdc___darwin_rpath)
libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) $(lt_host_flags)
diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
index f42d957af36..0ce75f30708 100644
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -560,8 +560,11 @@ libstdc___la_DEPENDENCIES = \
$(top_builddir)/src/c++17/libc++17convenience.la \
$(top_builddir)/src/c++20/libc++20convenience.la
+@ENABLE_DARWIN_AT_RPATH_TRUE@libstdc___darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
libstdc___la_LDFLAGS = \
- -version-info $(libtool_VERSION) ${version_arg} -lm
+ -version-info $(libtool_VERSION) ${version_arg} -lm $(libstdc___darwin_rpath)
libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) $(lt_host_flags)
@GLIBCXX_LDBL_ALT128_COMPAT_FALSE@@GLIBCXX_LDBL_COMPAT_TRUE@LTCXXCOMPILE64 = $(LTCXXCOMPILE)
diff --git a/libtool.m4 b/libtool.m4
index e36fdd3c0e2..7f8ae26db62 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -1005,7 +1005,7 @@ _LT_EOF
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[[89]]*|UNSET,*-darwin[[12]][[0123456789]]*)
+ UNSET,*-darwin[[89]]*|UNSET,*-darwin[[12]][[0-9]]*)
;;
10.[[012]][[,.]]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -1039,6 +1039,45 @@ _LT_EOF
m4_defun([_LT_DARWIN_LINKER_FEATURES],
[
m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ AC_ARG_ENABLE([darwin-at-rpath],
+ AS_HELP_STRING([--enable-darwin-at-rpath],
+ [install libraries with @rpath/library-name, requires rpaths to be added to executables]),
+ [if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[[4-8]]*|UNSET,rhapsody*|10.[[0-4]][[,.]]*)
+ AC_MSG_WARN([Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)])
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi],
+ [case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[[4-8]]*|UNSET,rhapsody*|10.[[0-4]][[,.]]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[[5-9]]*|UNSET,darwin2*|10.1[[1-9]][[,.]]*|1[[1-9]].*[[,.]]* )
+ AC_MSG_NOTICE([@rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)])
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+ ])
+
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_automatic, $1)=yes
@@ -1056,13 +1095,21 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
_LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
_LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
m4_if([$1], [CXX],
[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
_LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
],[])
@@ -4265,6 +4312,7 @@ _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
[Compiler flag to prevent dynamic linking])
])# _LT_COMPILER_PIC
+_LT_TAGVAR(enable_darwin_at_rpath, $1)=no
# _LT_LINKER_SHLIBS([TAGNAME])
# ----------------------------
@@ -6504,7 +6552,6 @@ fi # test "$_lt_caught_CXX_error" != yes
AC_LANG_POP
])# _LT_LANG_CXX_CONFIG
-
# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
# ---------------------------------
# Figure out "hidden" library dependencies from verbose
diff --git a/libvtv/configure b/libvtv/configure
index 917557103e9..a7889161c50 100755
--- a/libvtv/configure
+++ b/libvtv/configure
@@ -640,6 +640,8 @@ VTV_CYGMIN_FALSE
VTV_CYGMIN_TRUE
XCFLAGS
libtool_VERSION
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -797,6 +799,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_cet
with_gcc_major_version_only
'
@@ -1446,6 +1449,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-cet enable Intel CET in target libraries [default=auto]
Optional Packages:
@@ -8786,7 +8792,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10491,6 +10497,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10508,9 +10557,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12316,7 +12369,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12319 "configure"
+#line 12372 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12422,7 +12475,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12425 "configure"
+#line 12478 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13298,6 +13351,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13315,12 +13411,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15714,6 +15818,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=1:0:0
@@ -16059,6 +16171,10 @@ if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${VTV_CYGMIN_TRUE}" && test -z "${VTV_CYGMIN_FALSE}"; then
as_fn_error $? "conditional \"VTV_CYGMIN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libvtv/configure.ac b/libvtv/configure.ac
index f3b937e4b10..50aaadbb3a3 100644
--- a/libvtv/configure.ac
+++ b/libvtv/configure.ac
@@ -153,6 +153,7 @@ AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=1:0:0
diff --git a/lto-plugin/configure b/lto-plugin/configure
index 37c44d04a0d..28f5dd79cd7 100755
--- a/lto-plugin/configure
+++ b/lto-plugin/configure
@@ -634,6 +634,8 @@ LTLIBOBJS
LIBOBJS
target_noncanonical
lt_host_flags
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
OTOOL64
OTOOL
LIPO
@@ -788,6 +790,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
'
ac_precious_vars='build_alias
host_alias
@@ -1434,6 +1437,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -8657,7 +8663,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10363,6 +10369,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10380,9 +10429,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12188,7 +12241,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12191 "configure"
+#line 12244 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12294,7 +12347,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12297 "configure"
+#line 12350 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12531,6 +12584,14 @@ CC="$lt_save_CC"
# Only expand once:
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
@@ -12777,6 +12838,10 @@ if test -z "${LTO_PLUGIN_USE_SYMVER_SUN_TRUE}" && test -z "${LTO_PLUGIN_USE_SYMV
as_fn_error $? "conditional \"LTO_PLUGIN_USE_SYMVER_SUN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/lto-plugin/configure.ac b/lto-plugin/configure.ac
index 84f2a60b480..c051b8c6283 100644
--- a/lto-plugin/configure.ac
+++ b/lto-plugin/configure.ac
@@ -121,6 +121,7 @@ fi
AC_SUBST(ac_lto_plugin_extra_ldflags)
AM_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
ACX_LT_HOST_FLAGS
AC_SUBST(target_noncanonical)
AC_TYPE_INT64_T
diff --git a/zlib/configure b/zlib/configure
index 273ac36647d..92c462d04c6 100755
--- a/zlib/configure
+++ b/zlib/configure
@@ -641,6 +641,8 @@ TARGET_LIBRARY_FALSE
TARGET_LIBRARY_TRUE
toolexeclibdir
toolexecdir
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
CPP
OTOOL64
OTOOL
@@ -778,6 +780,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
with_toolexeclibdir
enable_host_shared
enable_host_pie
@@ -1422,6 +1425,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-host-shared build host code as shared libraries
--enable-host-pie build host code as PIE
@@ -6976,7 +6982,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -8955,6 +8961,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -8972,9 +9021,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -10801,7 +10854,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10804 "configure"
+#line 10857 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10907,7 +10960,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10910 "configure"
+#line 10963 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11144,6 +11197,14 @@ CC="$lt_save_CC"
# Only expand once:
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
# Find CPP now so that any conditional tests below won't do it and
# thereby make the resulting definitions conditional.
@@ -11790,6 +11851,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${TARGET_LIBRARY_TRUE}" && test -z "${TARGET_LIBRARY_FALSE}"; then
as_fn_error $? "conditional \"TARGET_LIBRARY\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/zlib/configure.ac b/zlib/configure.ac
index adf7aad4e51..9501cdfea85 100644
--- a/zlib/configure.ac
+++ b/zlib/configure.ac
@@ -64,6 +64,7 @@ GCC_CET_FLAGS(CET_FLAGS)
AC_SUBST(CET_FLAGS)
AC_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
# Find CPP now so that any conditional tests below won't do it and
# thereby make the resulting definitions conditional.
--
2.39.2 (Apple Git-143)
[-- Attachment #4: 0003-Darwin-rpaths-Add-with-darwin-extra-rpath.patch --]
[-- Type: application/octet-stream, Size: 6093 bytes --]
From 2348525bb5fb18d486ad0738fd7939fca26df797 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Sat, 28 May 2022 10:16:27 +0100
Subject: [PATCH 3/5] Darwin, rpaths: Add --with-darwin-extra-rpath.
This is provided to allow distributions to add a single additional
runpath to allow for cases where the installed GCC library directories
are then symlinked to a common dirctory outside of any of the GCC
installations.
For example:
/opt/distro/lib:
libgfortran.dylib -> /opt/distro/lib/gcc-11.3/lib/libgfortran.dylib
So that libraries which are designed to be found in the runpath we would then
add --with-darwin-add-rpath=/opt/distro/lib to the configure line.
This patch makes the configuration a little more forgiving of using
--disable-darwin-at-rpath (although for platform versions >= 10.11 this will
result in misconfigured target libraries).
gcc/ChangeLog:
* configure.ac: Add --with-darwin-extra-rpath option.
* config/darwin.h: Handle DARWIN_EXTRA_RPATH.
* config.in: Regenerate.
* configure: Regenerate.
---
gcc/config.in | 13 +++++++++++++
gcc/config/darwin.h | 14 ++++++++++++++
gcc/configure | 28 ++++++++++++++++++++++++++--
gcc/configure.ac | 13 +++++++++++++
4 files changed, 66 insertions(+), 2 deletions(-)
diff --git a/gcc/config.in b/gcc/config.in
index 5cf51bc1b01..9bda18ab64b 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -49,6 +49,19 @@
#endif
+/* Specify a runpath directory, additional to those provided by the compiler
+ */
+#ifndef USED_FOR_TARGET
+#undef DARWIN_ADD_RPATH
+#endif
+
+
+/* Should add an extra runpath directory */
+#ifndef USED_FOR_TARGET
+#undef DARWIN_DO_EXTRA_RPATH
+#endif
+
+
/* Define to enable the use of a default assembler. */
#ifndef USED_FOR_TARGET
#undef DEFAULT_ASSEMBLER
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 1b6920f4c92..ede8c1d8dbb 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -321,6 +321,19 @@ extern GTY(()) int darwin_ms_struct;
%:version-compare(>= 10.11 mmacosx-version-min= -lemutls_w) "
#endif
+/* We might elect to add a path even when this compiler does not use embedded
+ run paths, so that we can use libraries from an alternate compiler that is
+ using embedded runpaths. */
+#if DARWIN_DO_EXTRA_RPATH
+# define DARWIN_EXTRA_RPATH \
+"%{!r:%{!nostdlib:%{!nodefaultrpaths:\
+ %:version-compare(>= 10.5 mmacosx-version-min= -rpath) \
+ %:version-compare(>= 10.5 mmacosx-version-min= " DARWIN_ADD_RPATH ") \
+ }}}"
+#else
+# define DARWIN_EXTRA_RPATH ""
+#endif
+
#define SUBSUBTARGET_OVERRIDE_OPTIONS \
do { \
darwin_override_options (); \
@@ -415,6 +428,7 @@ extern GTY(()) int darwin_ms_struct;
DARWIN_NOPIE_SPEC \
DARWIN_RDYNAMIC \
DARWIN_NOCOMPACT_UNWIND \
+ DARWIN_EXTRA_RPATH \
DARWIN_RPATH_LINK \
"}}}}}}} %<pie %<no-pie %<rdynamic %<X %<rpath %<nodefaultrpaths "
diff --git a/gcc/configure b/gcc/configure
index eaa1a189583..13472fcfc3c 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1009,6 +1009,7 @@ with_pic
enable_fast_install
enable_libtool_lock
enable_darwin_at_rpath
+with_darwin_extra_rpath
enable_ld
enable_gold
with_plugin_ld
@@ -1870,6 +1871,9 @@ Optional Packages:
--with-pic try to use only PIC/non-PIC objects [default=use
both]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
+ --with-darwin-extra-rpath=[ARG]
+ Specify a runpath directory, additional to those
+ provided by the compiler
--with-plugin-ld=[ARG] specify the plugin linker
--with-glibc-version=M.N
assume GCC used with glibc version M.N or later
@@ -19939,7 +19943,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19942 "configure"
+#line 19946 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -20045,7 +20049,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 20048 "configure"
+#line 20052 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -23373,6 +23377,26 @@ else
ENABLE_DARWIN_AT_RPATH_FALSE=
fi
+DARWIN_DO_EXTRA_RPATH=0
+
+# Check whether --with-darwin-extra-rpath was given.
+if test "${with_darwin_extra_rpath+set}" = set; then :
+ withval=$with_darwin_extra_rpath; if test x"$withval" != x; then
+ DARWIN_ADD_RPATH="$withval"
+ DARWIN_DO_EXTRA_RPATH=1
+ fi
+fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define DARWIN_DO_EXTRA_RPATH $DARWIN_DO_EXTRA_RPATH
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define DARWIN_ADD_RPATH "$DARWIN_ADD_RPATH"
+_ACEOF
+
# Identify the assembler which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the assembler
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 80e31229408..84175a5d7ce 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2600,6 +2600,19 @@ AC_SUBST(objdir)
AC_SUBST(enable_fast_install)
AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+DARWIN_DO_EXTRA_RPATH=0
+AC_ARG_WITH(darwin-extra-rpath,
+[AS_HELP_STRING(
+ [[--with-darwin-extra-rpath=[ARG]]],
+ [Specify a runpath directory, additional to those provided by the compiler])],
+[if test x"$withval" != x; then
+ DARWIN_ADD_RPATH="$withval"
+ DARWIN_DO_EXTRA_RPATH=1
+ fi])
+AC_DEFINE_UNQUOTED(DARWIN_DO_EXTRA_RPATH, $DARWIN_DO_EXTRA_RPATH,
+ [Should add an extra runpath directory])
+AC_DEFINE_UNQUOTED(DARWIN_ADD_RPATH, "$DARWIN_ADD_RPATH",
+ [Specify a runpath directory, additional to those provided by the compiler])
# Identify the assembler which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the assembler
--
2.39.2 (Apple Git-143)
[-- Attachment #5: 0004-Testsuite-allow-non-installed-testing-on-darwin.patch --]
[-- Type: application/octet-stream, Size: 12763 bytes --]
From 0415173d58e7df3683dbd92d5d92003c8200a4b0 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Fri, 16 Apr 2021 20:01:40 +0100
Subject: [PATCH 4/5] Testsuite: allow non-installed testing on darwin
DYLD_LIBRARY_PATH is now removed from the environment for all system
tools, including the shell. Adapt the testsuite and pass the right
options to allow testing, even when the compiler and libraries have not
been installed.
gcc/ChangeLog:
* Makefile.in: set ENABLE_DARWIN_AT_RPATH in site.tmp.
gcc/testsuite/ChangeLog:
* gfortran.dg/coarray/caf.exp: Correctly set
libatomic flags.
* gfortran.dg/dg.exp: Likewise.
* lib/asan-dg.exp: Set correct -B flags.
* lib/atomic-dg.exp: Likewise.
* lib/target-libpath.exp: Handle ENABLE_DARWIN_AT_RPATH.
libatomic/ChangeLog:
* testsuite/lib/libatomic.exp: Pass correct flags on darwin.
libffi/ChangeLog:
* testsuite/lib/libffi.exp: Likewise.
libitm/ChangeLog:
* testsuite/lib/libitm.exp: Likewise.
* testsuite/libitm.c++/c++.exp: Likewise.
---
gcc/Makefile.in | 3 +++
gcc/testsuite/gfortran.dg/coarray/caf.exp | 16 +++++++++---
gcc/testsuite/gfortran.dg/dg.exp | 32 ++++++++++++++++++++---
gcc/testsuite/lib/asan-dg.exp | 2 +-
gcc/testsuite/lib/atomic-dg.exp | 2 +-
gcc/testsuite/lib/target-libpath.exp | 23 +++++++++++++---
libatomic/testsuite/lib/libatomic.exp | 8 ++++--
libffi/testsuite/lib/libffi.exp | 11 +++++---
libitm/testsuite/lib/libitm.exp | 1 +
libitm/testsuite/libitm.c++/c++.exp | 4 ++-
10 files changed, 84 insertions(+), 18 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 60ba2916457..023dba2159c 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -4209,6 +4209,9 @@ site.exp: ./config.status Makefile
echo "set COMPAT_OPTIONS \"$(COMPAT_OPTIONS)\"" >> ./site.tmp; \
else true; \
fi
+ @if test "x@enable_darwin_at_rpath@" = "xyes" ; then \
+ echo "set ENABLE_DARWIN_AT_RPATH 1" >> ./site.tmp; \
+ fi
@echo "## All variables above are generated by configure. Do Not Edit ##" >> ./site.tmp
@cat ./site.tmp > site.exp
@cat site.bak | sed \
diff --git a/gcc/testsuite/gfortran.dg/coarray/caf.exp b/gcc/testsuite/gfortran.dg/coarray/caf.exp
index d232be2fa90..a10b17a78d0 100644
--- a/gcc/testsuite/gfortran.dg/coarray/caf.exp
+++ b/gcc/testsuite/gfortran.dg/coarray/caf.exp
@@ -28,6 +28,7 @@
# Load procedures from common libraries.
load_lib gfortran-dg.exp
+load_lib atomic-dg.exp
# If a testcase doesn't have special options, use these.
global DEFAULT_FFLAGS
@@ -47,6 +48,7 @@ global gfortran_test_path
global gfortran_aux_module_flags
set gfortran_test_path $srcdir/$subdir
set gfortran_aux_module_flags $DEFAULT_FFLAGS
+
proc dg-compile-aux-modules { args } {
global gfortran_test_path
global gfortran_aux_module_flags
@@ -71,7 +73,15 @@ proc dg-compile-aux-modules { args } {
# Add -latomic only where supported. Assume built-in support elsewhere.
set maybe_atomic_lib ""
if [check_effective_target_libatomic_available] {
- set maybe_atomic_lib "-latomic"
+ if ![is_remote host] {
+ if [info exists TOOL_OPTIONS] {
+ set maybe_atomic_lib "[atomic_link_flags [get_multilibs ${TOOL_OPTIONS}]]"
+ } else {
+ set maybe_atomic_lib "[atomic_link_flags [get_multilibs]]"
+ }
+ }
+ set t [get_multilibs]
+ puts "maybe al $maybe_atomic_lib ml $t"
}
# Main loop.
@@ -97,14 +107,14 @@ foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ]]
foreach flags $option_list {
verbose "Testing $nshort (single), $flags" 1
set gfortran_aux_module_flags "-fcoarray=single $flags"
- dg-test $test "-fcoarray=single $flags $maybe_atomic_lib" ""
+ dg-test $test "-fcoarray=single $flags" $maybe_atomic_lib
cleanup-modules ""
}
foreach flags $option_list {
verbose "Testing $nshort (libcaf_single), $flags" 1
set gfortran_aux_module_flags "-fcoarray=lib $flags -lcaf_single"
- dg-test $test "-fcoarray=lib $flags -lcaf_single $maybe_atomic_lib" ""
+ dg-test $test "-fcoarray=lib $flags -lcaf_single" $maybe_atomic_lib
cleanup-modules ""
}
}
diff --git a/gcc/testsuite/gfortran.dg/dg.exp b/gcc/testsuite/gfortran.dg/dg.exp
index ee2760327dc..73541ea7301 100644
--- a/gcc/testsuite/gfortran.dg/dg.exp
+++ b/gcc/testsuite/gfortran.dg/dg.exp
@@ -18,6 +18,7 @@
# Load support procs.
load_lib gfortran-dg.exp
+load_lib atomic-dg.exp
# If a testcase doesn't have special options, use these.
global DEFAULT_FFLAGS
@@ -53,13 +54,38 @@ proc dg-compile-aux-modules { args } {
}
}
+# coarray tests might need libatomic. Assume that it is either not needed or
+# provided by builtins if it's not available.
+set maybe_atomic_lib ""
+if [check_effective_target_libatomic_available] {
+ if ![is_remote host] {
+ if [info exists TOOL_OPTIONS] {
+ set maybe_atomic_lib "[atomic_link_flags [get_multilibs ${TOOL_OPTIONS}]]"
+ } else {
+ set maybe_atomic_lib "[atomic_link_flags [get_multilibs]]"
+ }
+ } else {
+ set maybe_atomic_lib ""
+ }
+ set t [get_multilibs]
+ puts "dg set al $maybe_atomic_lib ml $t"
+}
+
+set all_flags $DEFAULT_FFLAGS
+if { $maybe_atomic_lib != "" } {
+ foreach f $maybe_atomic_lib {
+ lappend all_flags $f
+ }
+}
+
+puts "revised FFLAGS $all_flags"
+
# Main loop.
gfortran-dg-runtest [lsort \
- [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ] ] "" $DEFAULT_FFLAGS
+ [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ] ] "" $all_flags
gfortran-dg-runtest [lsort \
- [glob -nocomplain $srcdir/$subdir/g77/*.\[fF\] ] ] "" $DEFAULT_FFLAGS
-
+ [glob -nocomplain $srcdir/$subdir/g77/*.\[fF\] ] ] "" $all_flags
# All done.
dg-finish
diff --git a/gcc/testsuite/lib/asan-dg.exp b/gcc/testsuite/lib/asan-dg.exp
index 35e60eaaed5..157b60908d6 100644
--- a/gcc/testsuite/lib/asan-dg.exp
+++ b/gcc/testsuite/lib/asan-dg.exp
@@ -78,7 +78,7 @@ proc asan_link_flags_1 { paths lib } {
|| [file exists "${gccpath}/libsanitizer/${lib}/.libs/lib${lib}.${shlib_ext}"] } {
append flags " -B${gccpath}/libsanitizer/ "
append flags " -B${gccpath}/libsanitizer/${lib}/ "
- append flags " -L${gccpath}/libsanitizer/${lib}/.libs "
+ append flags " -B${gccpath}/libsanitizer/${lib}/.libs "
append ld_library_path ":${gccpath}/libsanitizer/${lib}/.libs"
}
} else {
diff --git a/gcc/testsuite/lib/atomic-dg.exp b/gcc/testsuite/lib/atomic-dg.exp
index 1589acd8eaf..ce1799cef2d 100644
--- a/gcc/testsuite/lib/atomic-dg.exp
+++ b/gcc/testsuite/lib/atomic-dg.exp
@@ -33,7 +33,7 @@ proc atomic_link_flags { paths } {
if { [file exists "${gccpath}/libatomic/.libs/libatomic.a"]
|| [file exists "${gccpath}/libatomic/.libs/libatomic.${shlib_ext}"] } {
append flags " -B${gccpath}/libatomic/ "
- append flags " -L${gccpath}/libatomic/.libs"
+ append flags " -B${gccpath}/libatomic/.libs"
append ld_library_path ":${gccpath}/libatomic/.libs"
}
} else {
diff --git a/gcc/testsuite/lib/target-libpath.exp b/gcc/testsuite/lib/target-libpath.exp
index 6d530fb4af6..36b64dd4550 100644
--- a/gcc/testsuite/lib/target-libpath.exp
+++ b/gcc/testsuite/lib/target-libpath.exp
@@ -67,6 +67,7 @@ proc set_ld_library_path_env_vars { } {
global orig_dyld_library_path
global orig_path
global orig_gcc_exec_prefix
+ global ENABLE_DARWIN_AT_RPATH
global env
# Save the original GCC_EXEC_PREFIX.
@@ -133,6 +134,7 @@ proc set_ld_library_path_env_vars { } {
#
# Doing this is somewhat of a hack as ld_library_path gets repeated in
# SHLIB_PATH and LD_LIBRARY_PATH when unix_load sets these variables.
+ if { ![istarget *-*-darwin*] } {
if { $orig_ld_library_path_saved } {
setenv LD_LIBRARY_PATH "$ld_library_path:$orig_ld_library_path"
} else {
@@ -166,10 +168,22 @@ proc set_ld_library_path_env_vars { } {
} else {
setenv LD_LIBRARY_PATH_64 "$ld_library_path"
}
- if { $orig_dyld_library_path_saved } {
- setenv DYLD_LIBRARY_PATH "$ld_library_path:$orig_dyld_library_path"
- } else {
- setenv DYLD_LIBRARY_PATH "$ld_library_path"
+ }
+ if { [istarget *-*-darwin*] } {
+ if { [info exists ENABLE_DARWIN_AT_RPATH] || [istarget *-*-darwin1\[5-9\]*]
+ || [istarget *-*-darwin20*] } {
+ # Either we are not using DYLD_LIBRARY_PATH or we're on a version of the
+ # OS for which it is not passed through system exes.
+ if [info exists env(DYLD_LIBRARY_PATH)] {
+ unsetenv DYLD_LIBRARY_PATH
+ }
+ } else {
+ if { $orig_dyld_library_path_saved } {
+ setenv DYLD_LIBRARY_PATH "$ld_library_path:$orig_dyld_library_path"
+ } else {
+ setenv DYLD_LIBRARY_PATH "$ld_library_path"
+ }
+ }
}
if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } {
if { $orig_path_saved } {
@@ -179,6 +193,7 @@ proc set_ld_library_path_env_vars { } {
}
}
+ verbose -log "set paths"
verbose -log "LD_LIBRARY_PATH=[getenv LD_LIBRARY_PATH]"
verbose -log "LD_RUN_PATH=[getenv LD_RUN_PATH]"
verbose -log "SHLIB_PATH=[getenv SHLIB_PATH]"
diff --git a/libatomic/testsuite/lib/libatomic.exp b/libatomic/testsuite/lib/libatomic.exp
index 10f38475bc8..c6d645e9ae3 100644
--- a/libatomic/testsuite/lib/libatomic.exp
+++ b/libatomic/testsuite/lib/libatomic.exp
@@ -148,11 +148,15 @@ proc libatomic_init { args } {
if { $blddir != "" } {
lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/"
lappend ALWAYS_CFLAGS "additional_flags=-I${blddir}"
- lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs"
+ if [istarget *-*-darwin*] {
+ lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/.libs"
+ } else {
+ lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs"
+ }
}
lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/.."
- if [istarget *-*-darwin*] {
+ if [istarget *-*-darwin\[89\]*] {
lappend ALWAYS_CFLAGS "additional_flags=-shared-libgcc"
}
diff --git a/libffi/testsuite/lib/libffi.exp b/libffi/testsuite/lib/libffi.exp
index 15d3d5ebd73..611f5177c7a 100644
--- a/libffi/testsuite/lib/libffi.exp
+++ b/libffi/testsuite/lib/libffi.exp
@@ -337,8 +337,13 @@ proc libffi-init { args } {
verbose "libffi_dir $libffi_dir"
if { $libffi_dir != "" } {
set libffi_dir [file dirname ${libffi_dir}]
- set libffi_link_flags "-L${libffi_dir}/.libs"
- lappend libffi_link_flags "-L${blddircxx}/src/.libs"
+ if [istarget *-*-darwin*] {
+ set libffi_link_flags "-B${libffi_dir}/.libs"
+ lappend libffi_link_flags "-B${blddircxx}/src/.libs"
+ } else {
+ set libffi_link_flags "-L${libffi_dir}/.libs"
+ lappend libffi_link_flags "-L${blddircxx}/src/.libs"
+ }
}
set_ld_library_path_env_vars
@@ -382,7 +387,7 @@ proc libffi_target_compile { source dest type options } {
# Darwin needs a stack execution allowed flag.
if { [istarget "*-*-darwin9*"] || [istarget "*-*-darwin1*"]
- || [istarget "*-*-darwin2*"] } {
+ || [istarget "x86_64-*-darwin2*"] } {
lappend options "additional_flags=-Wl,-allow_stack_execute"
lappend options "additional_flags=-Wl,-search_paths_first"
}
diff --git a/libitm/testsuite/lib/libitm.exp b/libitm/testsuite/lib/libitm.exp
index da918d1ee8d..61bbfa0c923 100644
--- a/libitm/testsuite/lib/libitm.exp
+++ b/libitm/testsuite/lib/libitm.exp
@@ -159,6 +159,7 @@ proc libitm_init { args } {
}
if [istarget *-*-darwin*] {
+ lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/.libs"
lappend ALWAYS_CFLAGS "additional_flags=-shared-libgcc"
}
diff --git a/libitm/testsuite/libitm.c++/c++.exp b/libitm/testsuite/libitm.c++/c++.exp
index de45e7e5480..1b0ead05fee 100644
--- a/libitm/testsuite/libitm.c++/c++.exp
+++ b/libitm/testsuite/libitm.c++/c++.exp
@@ -56,8 +56,10 @@ if { $lang_test_file_found } {
# Gather a list of all tests.
set tests [lsort [glob -nocomplain $srcdir/$subdir/*.C]]
+ set stdcxxadder ""
if { $blddir != "" } {
set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
+ set stdcxxadder "-B ${blddir}/${lang_library_path}"
} else {
set ld_library_path "$always_ld_library_path"
}
@@ -72,7 +74,7 @@ if { $lang_test_file_found } {
}
# Main loop.
- dg-runtest $tests "" $libstdcxx_includes
+ dg-runtest $tests $stdcxxadder $libstdcxx_includes
}
# All done.
--
2.39.2 (Apple Git-143)
[-- Attachment #6: 0005-Doc-document-the-new-Darwin-options.patch --]
[-- Type: application/octet-stream, Size: 2774 bytes --]
From be8676410ab15a6e6cce300ce617d1f5259dcabf Mon Sep 17 00:00:00 2001
From: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Date: Thu, 24 Aug 2023 13:22:28 +0200
Subject: [PATCH 5/5] Doc: document the new Darwin options
gcc/ChangeLog:
* doc/invoke.texi: Document the new -nodefaultrpaths option.
* doc/install.texi: Document the new --with-darwin-extra-rpath
option.
---
gcc/doc/install.texi | 6 ++++++
gcc/doc/invoke.texi | 10 +++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index e099cd0b568..a388e1f12e0 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -1808,6 +1808,12 @@ particularly useful if you intend to use several versions of GCC in
parallel. The default is @samp{yes} for @samp{libada}, and @samp{no} for
the remaining libraries.
+@item --with-darwin-extra-rpath
+This is provided to allow distributions to add a single additional
+runpath on Darwin / macOS systems. This allows for cases where the
+installed GCC library directories are then symlinked to a common
+directory outside of the GCC installation.
+
@item @anchor{WithAixSoname}--with-aix-soname=@samp{aix}, @samp{svr4} or @samp{both}
Traditional AIX shared library versioning (versioned @code{Shared Object}
files as members of unversioned @code{Archive Library} files named
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index a32dabf0405..778d82ecd2b 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -920,7 +920,7 @@ Objective-C and Objective-C++ Dialects}.
-iframework
-image_base -init -install_name -keep_private_externs
-multi_module -multiply_defined -multiply_defined_unused
--noall_load -no_dead_strip_inits_and_terms
+-noall_load -no_dead_strip_inits_and_terms -nodefaultrpaths
-nofixprebinding -nomultidefs -noprebind -noseglinkedit
-pagezero_size -prebind -prebind_all_twolevel_modules
-private_bundle -read_only_relocs -sectalign
@@ -24269,6 +24269,14 @@ an executable when linking, using the Darwin @file{libtool} command.
This causes GCC's output file to have the @samp{ALL} subtype, instead of
one controlled by the @option{-mcpu} or @option{-march} option.
+@opindex nodefaultrpaths
+@item -nodefaultrpaths
+Do not add default run paths for the compiler library directories to
+executables, modules or dynamic libraries. On macOS 10.5 and later,
+the embedded runpath is added by default unless the user adds
+@option{-nodefaultrpaths} to the link line. Run paths are needed
+(and therefore enforced) to build on macOS version 10.11 or later.
+
@item -allowable_client @var{client_name}
@itemx -client_name
@itemx -compatibility_version
--
2.39.2 (Apple Git-143)
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-08-29 16:06 ` FX Coudert
@ 2023-08-29 19:55 ` Joseph Myers
2023-08-29 20:17 ` FX Coudert
0 siblings, 1 reply; 39+ messages in thread
From: Joseph Myers @ 2023-08-29 19:55 UTC (permalink / raw)
To: FX Coudert; +Cc: GCC Patches
On Tue, 29 Aug 2023, FX Coudert via Gcc-patches wrote:
> > The driver changes are still OK.
>
> Just to be clear: apart from you and Iain, whose approval do I need (and
> for what parts)?
I think a build machinery review is needed.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-08-29 19:55 ` Joseph Myers
@ 2023-08-29 20:17 ` FX Coudert
2023-09-12 17:52 ` FX Coudert
2023-10-21 5:27 ` Alexandre Oliva
0 siblings, 2 replies; 39+ messages in thread
From: FX Coudert @ 2023-08-29 20:17 UTC (permalink / raw)
To: Joseph Myers
Cc: GCC Patches, bonzini, neroden, aoliva, Ralf.Wildenhues, Iain Sandoe
[-- Attachment #1: Type: text/plain, Size: 198 bytes --]
> I think a build machinery review is needed.
Thanks. CC’ing the relevant maintainers for review of the build part.
The driver part and the darwin-specific part are already okayed.
FX
[-- Attachment #2: 0001-Driver-Provide-a-spec-to-insert-rpaths-for-compiler-.patch --]
[-- Type: application/octet-stream, Size: 3952 bytes --]
From ff84f0b0d2971bc589a52c416d0ca6f292f75458 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Thu, 20 Dec 2018 09:00:38 +0000
Subject: [PATCH 1/5] Driver: Provide a spec to insert rpaths for compiler lib
dirs.
This provides a spec to insert "-rpath DDD" for each DDD corresponding
to a compiler startfile directory. This allows a target to use @rpath
as the install path for libraries, and have the compiler provide the
necessary rpath to handle this.
Embed real paths, not relative ones.
We embed a runpath for every path in which libraries might be found. This
change ensures that we embed the actual real path and not a relative one from
the compiler's version-specific directory.
e.g.
/opt/distro/gcc-11-3Dr0/lib
instead of:
/opt/distro/gcc-11-3Dr0/lib/gcc/x86_64-apple-darwin19/11.3.0/../../..
This ensures that if we install, for example, 11.4.0 (and delete the 11.3.0
installation) exes built by 11.3 would continue to function (providing, of course
that 11.4 does not bump any SO names).
gcc/ChangeLog:
* gcc.cc (RUNPATH_OPTION): New.
(do_spec_1): Provide '%P' as a spec to insert rpaths for
each compiler startfile path.
---
gcc/gcc.cc | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index fdfac0b4fe4..7c6e4879a31 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -579,6 +579,7 @@ or with constant text in a single argument.
%l process LINK_SPEC as a spec.
%L process LIB_SPEC as a spec.
%M Output multilib_os_dir.
+ %P Output a RUNPATH_OPTION for each directory in startfile_prefixes.
%G process LIBGCC_SPEC as a spec.
%R Output the concatenation of target_system_root and
target_sysroot_suffix.
@@ -1182,6 +1183,10 @@ proper position among the other output files. */
# define SYSROOT_HEADERS_SUFFIX_SPEC ""
#endif
+#ifndef RUNPATH_OPTION
+# define RUNPATH_OPTION "-rpath"
+#endif
+
static const char *asm_debug = ASM_DEBUG_SPEC;
static const char *asm_debug_option = ASM_DEBUG_OPTION_SPEC;
static const char *cpp_spec = CPP_SPEC;
@@ -5925,6 +5930,7 @@ struct spec_path_info {
size_t append_len;
bool omit_relative;
bool separate_options;
+ bool realpaths;
};
static void *
@@ -5934,6 +5940,16 @@ spec_path (char *path, void *data)
size_t len = 0;
char save = 0;
+ /* The path must exist; we want to resolve it to the realpath so that this
+ can be embedded as a runpath. */
+ if (info->realpaths)
+ path = lrealpath (path);
+
+ /* However, if we failed to resolve it - perhaps because there was a bogus
+ -B option on the command line, then punt on this entry. */
+ if (!path)
+ return NULL;
+
if (info->omit_relative && !IS_ABSOLUTE_PATH (path))
return NULL;
@@ -6165,6 +6181,22 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
info.omit_relative = false;
#endif
info.separate_options = false;
+ info.realpaths = false;
+
+ for_each_path (&startfile_prefixes, true, 0, spec_path, &info);
+ }
+ break;
+
+ case 'P':
+ {
+ struct spec_path_info info;
+
+ info.option = RUNPATH_OPTION;
+ info.append_len = 0;
+ info.omit_relative = false;
+ info.separate_options = true;
+ /* We want to embed the actual paths that have the libraries. */
+ info.realpaths = true;
for_each_path (&startfile_prefixes, true, 0, spec_path, &info);
}
@@ -6491,6 +6523,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
info.append_len = strlen (info.append);
info.omit_relative = false;
info.separate_options = true;
+ info.realpaths = false;
for_each_path (&include_prefixes, false, info.append_len,
spec_path, &info);
--
2.39.2 (Apple Git-143)
[-- Attachment #3: 0002-Darwin-Allow-for-configuring-Darwin-to-use-embedded-.patch --]
[-- Type: application/octet-stream, Size: 279683 bytes --]
From 5259260cf3bfc6cec7a3f0e5caeecfbc6bf00778 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Sun, 28 Mar 2021 14:48:17 +0100
Subject: [PATCH 2/5] Darwin: Allow for configuring Darwin to use embedded
runpath.
Recent Darwin versions place contraints on the use of run paths
specified in environment variables. This breaks some assumptions
in the GCC build.
This change allows the user to configure a Darwin build to use
'@rpath/libraryname.dylib' in library names and then to add an
embedded runpath to executables (and libraries with dependents).
The embedded runpath is added by default unless the user adds
'-nodefaultrpaths' to the link line.
For an installed compiler, it means that any executable built with
that compiler will reference the runtimes installed with the
compiler (equivalent to hard-coding the library path into the name
of the library).
During build-time configurations any "-B" entries will be added to
the runpath thus the newly-built libraries will be found by exes.
Since the install name is set in libtool, that decision needs to be
available here (but might also cause dependent ones in Makefiles,
so we need to export a conditional).
This facility is not available for Darwin 8 or earlier, however the
existing environment variable runpath does work there.
We default this on for systems where the external DYLD_LIBRARY_PATH
does not work and off for Darwin 8 or earlier. For systems that can
use either method, if the value is unset, we use the default (which
is currently DYLD_LIBRARY_PATH).
ChangeLog:
* configure: Regenerate.
* configure.ac: Do not add default runpaths to GCC exes
when we are building -static-libstdc++/-static-libgcc (the
default).
* libtool.m4: Add 'enable-darwin-at-runpath'. Act on the
enable flag to alter Darwin libraries to use @rpath names.
gcc/ChangeLog:
* aclocal.m4: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
* config/darwin.h: Handle Darwin rpaths.
* config/darwin.opt: Handle Darwin rpaths.
* Makefile.in: Handle Darwin rpaths.
gcc/ada/ChangeLog:
* gcc-interface/Makefile.in: Handle Darwin rpaths.
gcc/jit/ChangeLog:
* Make-lang.in: Handle Darwin rpaths.
libatomic/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libbacktrace/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libcc1/ChangeLog:
* configure: Regenerate.
libffi/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
libgcc/ChangeLog:
* config/t-slibgcc-darwin: Generate libgcc_s
with an @rpath name.
* config.host: Handle Darwin rpaths.
libgfortran/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths
libgm2/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* aclocal.m4: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
* libm2cor/Makefile.am: Handle Darwin rpaths.
* libm2cor/Makefile.in: Regenerate.
* libm2iso/Makefile.am: Handle Darwin rpaths.
* libm2iso/Makefile.in: Regenerate.
* libm2log/Makefile.am: Handle Darwin rpaths.
* libm2log/Makefile.in: Regenerate.
* libm2min/Makefile.am: Handle Darwin rpaths.
* libm2min/Makefile.in: Regenerate.
* libm2pim/Makefile.am: Handle Darwin rpaths.
* libm2pim/Makefile.in: Regenerate.
libgomp/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths
libitm/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libobjc/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libphobos/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
* libdruntime/Makefile.am: Handle Darwin rpaths.
* libdruntime/Makefile.in: Regenerate.
* src/Makefile.am: Handle Darwin rpaths.
* src/Makefile.in: Regenerate.
libquadmath/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libsanitizer/ChangeLog:
* asan/Makefile.am: Handle Darwin rpaths.
* asan/Makefile.in: Regenerate.
* configure: Regenerate.
* hwasan/Makefile.am: Handle Darwin rpaths.
* hwasan/Makefile.in: Regenerate.
* lsan/Makefile.am: Handle Darwin rpaths.
* lsan/Makefile.in: Regenerate.
* tsan/Makefile.am: Handle Darwin rpaths.
* tsan/Makefile.in: Regenerate.
* ubsan/Makefile.am: Handle Darwin rpaths.
* ubsan/Makefile.in: Regenerate.
libssp/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libstdc++-v3/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
* src/Makefile.am: Handle Darwin rpaths.
* src/Makefile.in: Regenerate.
libvtv/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
lto-plugin/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
zlib/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
---
configure | 14 ++
configure.ac | 14 ++
gcc/Makefile.in | 11 +-
gcc/aclocal.m4 | 50 +++++++
gcc/ada/gcc-interface/Makefile.in | 5 +-
gcc/config/darwin.h | 32 ++++-
gcc/config/darwin.opt | 4 +
gcc/configure | 133 ++++++++++++++++--
gcc/configure.ac | 2 +
gcc/jit/Make-lang.in | 2 +-
libatomic/Makefile.am | 7 +-
libatomic/Makefile.in | 7 +-
libatomic/configure | 76 ++++++++++-
libatomic/configure.ac | 2 +
libbacktrace/configure | 76 ++++++++++-
libbacktrace/configure.ac | 2 +
libcc1/configure | 118 ++++++++++++++--
libffi/Makefile.am | 7 +-
libffi/Makefile.in | 6 +-
libffi/configure | 132 ++++++++++++++++--
libffi/configure.ac | 1 +
libffi/doc/version.texi | 4 +-
libgcc/config.host | 23 +++-
libgcc/config/t-darwin-rpath | 2 +
libgcc/config/t-slibgcc-darwin | 28 ++--
libgfortran/Makefile.am | 7 +-
libgfortran/Makefile.in | 28 ++--
libgfortran/configure | 131 ++++++++++++++++--
libgfortran/configure.ac | 6 +-
libgm2/Makefile.am | 9 +-
libgm2/Makefile.in | 15 +-
libgm2/aclocal.m4 | 10 +-
libgm2/configure | 145 ++++++++++++++++++--
libgm2/configure.ac | 6 +-
libgm2/libm2cor/Makefile.am | 4 +
libgm2/libm2cor/Makefile.in | 17 ++-
libgm2/libm2iso/Makefile.am | 4 +
libgm2/libm2iso/Makefile.in | 17 ++-
libgm2/libm2log/Makefile.am | 3 +
libgm2/libm2log/Makefile.in | 17 ++-
libgm2/libm2min/Makefile.am | 3 +
libgm2/libm2min/Makefile.in | 17 ++-
libgm2/libm2pim/Makefile.am | 3 +
libgm2/libm2pim/Makefile.in | 17 ++-
libgo/configure | 18 ++-
libgo/configure.ac | 1 +
libgomp/Makefile.am | 7 +-
libgomp/Makefile.in | 5 +-
libgomp/configure | 126 ++++++++++++++++-
libgomp/configure.ac | 1 +
libitm/Makefile.am | 7 +-
libitm/Makefile.in | 7 +-
libitm/configure | 132 ++++++++++++++++--
libitm/configure.ac | 1 +
libobjc/configure | 112 ++++++++++++---
libobjc/configure.ac | 36 +++--
libphobos/configure | 126 ++++++++++++++++-
libphobos/configure.ac | 1 +
libphobos/libdruntime/Makefile.am | 5 +-
libphobos/libdruntime/Makefile.in | 3 +-
libphobos/src/Makefile.am | 5 +-
libphobos/src/Makefile.in | 3 +-
libquadmath/Makefile.am | 7 +-
libquadmath/Makefile.in | 5 +-
libquadmath/configure | 218 +++++++++++++++++++++++++++++-
libquadmath/configure.ac | 3 +
libsanitizer/asan/Makefile.am | 7 +-
libsanitizer/asan/Makefile.in | 7 +-
libsanitizer/configure | 133 ++++++++++++++++--
libsanitizer/configure.ac | 2 +
libsanitizer/hwasan/Makefile.am | 6 +-
libsanitizer/hwasan/Makefile.in | 5 +-
libsanitizer/lsan/Makefile.am | 8 +-
libsanitizer/lsan/Makefile.in | 8 +-
libsanitizer/tsan/Makefile.am | 6 +-
libsanitizer/tsan/Makefile.in | 5 +-
libsanitizer/ubsan/Makefile.am | 7 +-
libsanitizer/ubsan/Makefile.in | 7 +-
libssp/Makefile.am | 6 +-
libssp/Makefile.in | 5 +-
libssp/configure | 76 ++++++++++-
libssp/configure.ac | 2 +
libstdc++-v3/configure | 144 ++++++++++++++++++--
libstdc++-v3/configure.ac | 1 +
libstdc++-v3/src/Makefile.am | 7 +-
libstdc++-v3/src/Makefile.in | 5 +-
libtool.m4 | 57 +++++++-
libvtv/configure | 132 ++++++++++++++++--
libvtv/configure.ac | 1 +
lto-plugin/configure | 75 +++++++++-
lto-plugin/configure.ac | 1 +
zlib/configure | 75 +++++++++-
zlib/configure.ac | 1 +
93 files changed, 2556 insertions(+), 279 deletions(-)
create mode 100644 libgcc/config/t-darwin-rpath
diff --git a/configure b/configure
index 28f0913bdd4..28e25bf7162 100755
--- a/configure
+++ b/configure
@@ -8492,6 +8492,20 @@ else
fi
fi
+case $target in
+ *-darwin2* | *-darwin1[56789]*)
+ # For these versions, we default to using embedded rpaths.
+ if test "x$enable_darwin_at_rpath" != "xno"; then
+ poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths"
+ fi
+ ;;
+ *-darwin*)
+ # For these versions, we only use embedded rpaths on demand.
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths"
+ fi
+ ;;
+esac
# GCC GRAPHITE dependency isl.
diff --git a/configure.ac b/configure.ac
index 5d25dc864c3..49c237bb8b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1855,6 +1855,20 @@ AC_ARG_WITH(boot-ldflags,
if test "$poststage1_libs" = ""; then
poststage1_ldflags="-static-libstdc++ -static-libgcc"
fi])
+case $target in
+ *-darwin2* | *-darwin1[[56789]]*)
+ # For these versions, we default to using embedded rpaths.
+ if test "x$enable_darwin_at_rpath" != "xno"; then
+ poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths"
+ fi
+ ;;
+ *-darwin*)
+ # For these versions, we only use embedded rpaths on demand.
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths"
+ fi
+ ;;
+esac
AC_SUBST(poststage1_ldflags)
# GCC GRAPHITE dependency isl.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 78779546459..60ba2916457 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1193,6 +1193,8 @@ LANG_MAKEFRAGS = @all_lang_makefrags@
# Used by gcc/jit/Make-lang.in
LD_VERSION_SCRIPT_OPTION = @ld_version_script_option@
LD_SONAME_OPTION = @ld_soname_option@
+@ENABLE_DARWIN_AT_RPATH_TRUE@DARWIN_RPATH = @rpath
+@ENABLE_DARWIN_AT_RPATH_FALSE@DARWIN_RPATH = ${libdir}
# Flags to pass to recursive makes.
# CC is set by configure.
@@ -2014,9 +2016,12 @@ cs-tconfig.h: Makefile
$(SHELL) $(srcdir)/mkconfig.sh tconfig.h
cs-tm.h: Makefile
- TARGET_CPU_DEFAULT="$(target_cpu_default)" \
- HEADERS="$(tm_include_list)" DEFINES="$(tm_defines)" \
- $(SHELL) $(srcdir)/mkconfig.sh tm.h
+@ENABLE_DARWIN_AT_RPATH_FALSE@ TARGET_CPU_DEFAULT="$(target_cpu_default)" \
+@ENABLE_DARWIN_AT_RPATH_FALSE@ HEADERS="$(tm_include_list)" DEFINES="$(tm_defines)" \
+@ENABLE_DARWIN_AT_RPATH_FALSE@ $(SHELL) $(srcdir)/mkconfig.sh tm.h
+@ENABLE_DARWIN_AT_RPATH_TRUE@ TARGET_CPU_DEFAULT="$(target_cpu_default)" \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ HEADERS="$(tm_include_list)" DEFINES="$(tm_defines) DARWIN_AT_RPATH=1" \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ $(SHELL) $(srcdir)/mkconfig.sh tm.h
cs-tm_p.h: Makefile
TARGET_CPU_DEFAULT="" \
diff --git a/gcc/aclocal.m4 b/gcc/aclocal.m4
index 6be36df5190..126e09bbcd1 100644
--- a/gcc/aclocal.m4
+++ b/gcc/aclocal.m4
@@ -12,6 +12,56 @@
# PARTICULAR PURPOSE.
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ([2.52])dnl
+ m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 2006-2017 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# --------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
m4_include([../libtool.m4])
m4_include([../ltoptions.m4])
m4_include([../ltsugar.m4])
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index b5243a24a8f..ad7cf5072e5 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -794,12 +794,15 @@ gnatlib-shared-darwin:
$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
$(SO_OPTS) \
-Wl,-install_name,@rpath/libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
- $(MISCLIB)
+ -nodefaultrpaths -Wl,-rpath,@loader_path/,-rpath,@loader_path/.. \
+ -Wl,-rpath,@loader_path/../../../../ $(MISCLIB)
cd $(RTSDIR); $(GCC_FOR_ADA_RTS) -dynamiclib $(PICFLAG_FOR_TARGET) \
-o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
$(GNATRTL_TASKING_OBJS) \
$(SO_OPTS) \
-Wl,-install_name,@rpath/libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ -nodefaultrpaths -Wl,-rpath,@loader_path/,-rpath,@loader_path/.. \
+ -Wl,-rpath,@loader_path/../../../../ \
$(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
cd $(RTSDIR); $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
libgnat$(soext)
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index e0e8672a455..1b6920f4c92 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -309,6 +309,18 @@ extern GTY(()) int darwin_ms_struct;
#define DARWIN_CC1_SPEC \
"%<dynamic %<dynamiclib %<force_cpusubtype_ALL %<multiply_defined* "
+/* When we are using embedded runpaths DARWIN_AT_RPATH is set. */
+#if DARWIN_AT_RPATH
+# define DARWIN_RPATH_LINK \
+"%{!r:%{!nostdlib:%{!nodefaultrpaths:%(darwin_rpaths)}}}"
+# define DARWIN_SHARED_LIBGCC "-lgcc_s.1.1"
+#else
+# define DARWIN_RPATH_LINK ""
+# define DARWIN_SHARED_LIBGCC \
+"%:version-compare(!> 10.11 mmacosx-version-min= -lgcc_s.1.1) \
+ %:version-compare(>= 10.11 mmacosx-version-min= -lemutls_w) "
+#endif
+
#define SUBSUBTARGET_OVERRIDE_OPTIONS \
do { \
darwin_override_options (); \
@@ -403,7 +415,8 @@ extern GTY(()) int darwin_ms_struct;
DARWIN_NOPIE_SPEC \
DARWIN_RDYNAMIC \
DARWIN_NOCOMPACT_UNWIND \
- "}}}}}}} %<pie %<no-pie %<rdynamic %<X %<rpath "
+ DARWIN_RPATH_LINK \
+ "}}}}}}} %<pie %<no-pie %<rdynamic %<X %<rpath %<nodefaultrpaths "
/* Spec that controls whether the debug linker is run automatically for
a link step. This needs to be done if there is a source file on the
@@ -518,8 +531,7 @@ extern GTY(()) int darwin_ms_struct;
%:version-compare(!> 10.6 mmacosx-version-min= -lgcc_eh) \
%:version-compare(>= 10.6 mmacosx-version-min= -lemutls_w); \
shared-libgcc|fexceptions|fobjc-exceptions|fgnu-runtime: \
- %:version-compare(!> 10.11 mmacosx-version-min= -lgcc_s.1.1) \
- %:version-compare(>= 10.11 mmacosx-version-min= -lemutls_w) \
+ " DARWIN_SHARED_LIBGCC " \
%:version-compare(!> 10.3.9 mmacosx-version-min= -lgcc_eh) \
%:version-compare(>< 10.3.9 10.5 mmacosx-version-min= -lgcc_s.10.4) \
%:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5); \
@@ -554,7 +566,8 @@ extern GTY(()) int darwin_ms_struct;
{ "darwin_crt2", DARWIN_CRT2_SPEC }, \
{ "darwin_crt3", DARWIN_CRT3_SPEC }, \
{ "darwin_dylib1", DARWIN_DYLIB1_SPEC }, \
- { "darwin_bundle1", DARWIN_BUNDLE1_SPEC },
+ { "darwin_bundle1", DARWIN_BUNDLE1_SPEC }, \
+ { "darwin_rpaths", DARWIN_RPATH_SPEC },
#define DARWIN_CRT1_SPEC \
"%:version-compare(!> 10.5 mmacosx-version-min= -lcrt1.o) \
@@ -580,6 +593,17 @@ extern GTY(()) int darwin_ms_struct;
"%{!static:%:version-compare(< 10.6 mmacosx-version-min= -lbundle1.o) \
%{fgnu-tm: -lcrttms.o}}"
+#if DARWIN_AT_RPATH
+/* A default rpath, that picks up dependent libraries installed in the same
+ director as one being loaded. */
+#define DARWIN_RPATH_SPEC \
+ "%:version-compare(>= 10.5 mmacosx-version-min= -rpath) \
+ %:version-compare(>= 10.5 mmacosx-version-min= @loader_path) \
+ %P "
+#else
+#define DARWIN_RPATH_SPEC ""
+#endif
+
#ifdef HAVE_AS_MMACOSX_VERSION_MIN_OPTION
/* Emit macosx version (but only major). */
#define ASM_MMACOSX_VERSION_MIN_SPEC \
diff --git a/gcc/config/darwin.opt b/gcc/config/darwin.opt
index d655aaef2fb..ff624ffd82a 100644
--- a/gcc/config/darwin.opt
+++ b/gcc/config/darwin.opt
@@ -241,6 +241,10 @@ nodefaultexport
Driver RejectNegative
Do not add a default symbol exports to modules or dynamic libraries.
+nodefaultrpaths
+Driver RejectNegative
+Do not add default run paths (for the compiler library directories) to executables, modules or dynamic libraries.
+
nofixprebinding
Driver RejectNegative
(Obsolete after 10.3.9) Set MH_NOPREFIXBINDING, in an executable.
diff --git a/gcc/configure b/gcc/configure
index 07e8a64afbb..eaa1a189583 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -741,6 +741,8 @@ ORIGINAL_PLUGIN_LD_FOR_TARGET
gcc_cv_ld
ORIGINAL_AS_FOR_TARGET
gcc_cv_as
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_fast_install
objdir
OTOOL64
@@ -1006,6 +1008,7 @@ enable_static
with_pic
enable_fast_install
enable_libtool_lock
+enable_darwin_at_rpath
enable_ld
enable_gold
with_plugin_ld
@@ -1741,6 +1744,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-ld[=ARG] build ld [ARG={default,yes,no}]
--enable-gold[=ARG] build gold [ARG={default,yes,no}]
--enable-gnu-indirect-function
@@ -16356,7 +16362,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -18061,6 +18067,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -18078,9 +18127,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -19886,7 +19939,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19889 "configure"
+#line 19942 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -19992,7 +20045,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19995 "configure"
+#line 20048 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -20868,6 +20921,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -20885,12 +20981,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -23261,6 +23365,15 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# Identify the assembler which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the assembler
# which will be driven by the driver program.
@@ -32851,6 +32964,10 @@ LTLIBOBJS=$ac_ltlibobjs
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 62c31d8e02d..80e31229408 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2599,6 +2599,8 @@ AC_PROG_LIBTOOL
AC_SUBST(objdir)
AC_SUBST(enable_fast_install)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
# Identify the assembler which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the assembler
# which will be driven by the driver program.
diff --git a/gcc/jit/Make-lang.in b/gcc/jit/Make-lang.in
index a65f13853ae..3fd564a5932 100644
--- a/gcc/jit/Make-lang.in
+++ b/gcc/jit/Make-lang.in
@@ -59,7 +59,7 @@ LIBGCCJIT_AGE = 1
LIBGCCJIT_BASENAME = libgccjit
LIBGCCJIT_SONAME = \
- ${libdir}/$(LIBGCCJIT_BASENAME).$(LIBGCCJIT_VERSION_NUM).dylib
+ $(DARWIN_RPATH)/$(LIBGCCJIT_BASENAME).$(LIBGCCJIT_VERSION_NUM).dylib
LIBGCCJIT_FILENAME = $(LIBGCCJIT_BASENAME).$(LIBGCCJIT_VERSION_NUM).dylib
LIBGCCJIT_LINKER_NAME = $(LIBGCCJIT_BASENAME).dylib
diff --git a/libatomic/Makefile.am b/libatomic/Makefile.am
index c6c8d81c56a..3bb32f32ebf 100644
--- a/libatomic/Makefile.am
+++ b/libatomic/Makefile.am
@@ -65,8 +65,13 @@ libatomic_version_script =
libatomic_version_dep =
endif
libatomic_version_info = -version-info $(libtool_VERSION)
+if ENABLE_DARWIN_AT_RPATH
+libatomic_darwin_rpath = -Wc,-nodefaultrpaths
+libatomic_darwin_rpath += -Wl,-rpath,@loader_path
+endif
-libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) $(lt_host_flags)
+libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) \
+ $(lt_host_flags) $(libatomic_darwin_rpath)
libatomic_la_SOURCES = gload.c gstore.c gcas.c gexch.c glfree.c lock.c init.c \
fenv.c fence.c flag.c
diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in
index 83efe7d2694..4164199cf9d 100644
--- a/libatomic/Makefile.in
+++ b/libatomic/Makefile.in
@@ -416,7 +416,12 @@ noinst_LTLIBRARIES = libatomic_convenience.la
@LIBAT_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@libatomic_version_dep = $(top_srcdir)/libatomic.map
@LIBAT_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@libatomic_version_dep = libatomic.map-sun
libatomic_version_info = -version-info $(libtool_VERSION)
-libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) $(lt_host_flags)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libatomic_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) \
+ $(lt_host_flags) $(libatomic_darwin_rpath)
+
libatomic_la_SOURCES = gload.c gstore.c gcas.c gexch.c glfree.c lock.c \
init.c fenv.c fence.c flag.c $(am__append_2)
SIZEOBJS = load store cas exch fadd fsub fand fior fxor fnand tas
diff --git a/libatomic/configure b/libatomic/configure
index 57f320753e1..dc5f4bca65e 100755
--- a/libatomic/configure
+++ b/libatomic/configure
@@ -658,6 +658,8 @@ OPT_LDFLAGS
SECTION_LDFLAGS
enable_aarch64_lse
libtool_VERSION
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
@@ -802,6 +804,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
enable_symvers
enable_werror
@@ -1451,6 +1454,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -7604,7 +7610,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9577,6 +9583,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9594,9 +9643,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11402,7 +11455,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11405 "configure"
+#line 11458 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11508,7 +11561,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11511 "configure"
+#line 11564 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11793,6 +11846,15 @@ fi
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=3:0:2
@@ -15920,6 +15982,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${LIBAT_BUILD_VERSIONED_SHLIB_TRUE}" && test -z "${LIBAT_BUILD_VERSIONED_SHLIB_FALSE}"; then
as_fn_error $? "conditional \"LIBAT_BUILD_VERSIONED_SHLIB\" was never defined.
diff --git a/libatomic/configure.ac b/libatomic/configure.ac
index 318b605a1d7..6919d212ae5 100644
--- a/libatomic/configure.ac
+++ b/libatomic/configure.ac
@@ -155,6 +155,8 @@ AC_SUBST(enable_shared)
AC_SUBST(enable_static)
AM_MAINTAINER_MODE
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=3:0:2
AC_SUBST(libtool_VERSION)
diff --git a/libbacktrace/configure b/libbacktrace/configure
index c3e7b884e36..0ccc060901d 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -681,6 +681,8 @@ PIC_FLAG
WARN_FLAGS
EXTRA_FLAGS
BACKTRACE_FILE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
OTOOL64
OTOOL
LIPO
@@ -805,6 +807,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_largefile
enable_cet
enable_werror
@@ -1453,6 +1456,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--disable-largefile omit support for large files
--enable-cet enable Intel CET in target libraries [default=auto]
--disable-werror disable building with -Werror
@@ -8048,7 +8054,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9754,6 +9760,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9771,9 +9820,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11579,7 +11632,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11582 "configure"
+#line 11635 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11685,7 +11738,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11688 "configure"
+#line 11741 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11924,6 +11977,15 @@ CC="$lt_save_CC"
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# Check whether --enable-largefile was given.
if test "${enable_largefile+set}" = set; then :
enableval=$enable_largefile;
@@ -14486,6 +14548,10 @@ if test -z "${HAVE_DWZ_TRUE}" && test -z "${HAVE_DWZ_FALSE}"; then
as_fn_error $? "conditional \"HAVE_DWZ\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${HAVE_ELF_TRUE}" && test -z "${HAVE_ELF_FALSE}"; then
as_fn_error $? "conditional \"HAVE_ELF\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac
index 72ff2b30053..71cd50f8cdf 100644
--- a/libbacktrace/configure.ac
+++ b/libbacktrace/configure.ac
@@ -84,6 +84,8 @@ AM_CONDITIONAL(HAVE_DWZ, test "$DWZ" != "")
LT_INIT
AM_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
AC_SYS_LARGEFILE
backtrace_supported=yes
diff --git a/libcc1/configure b/libcc1/configure
index 2a914a0bfc8..ea689a353c8 100755
--- a/libcc1/configure
+++ b/libcc1/configure
@@ -787,6 +787,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_cet
with_gcc_major_version_only
enable_werror_always
@@ -1439,6 +1440,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-cet enable Intel CET in host libraries [default=auto]
--enable-werror-always enable -Werror despite compiler version
--enable-plugin enable plugin support
@@ -7309,7 +7313,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9014,6 +9018,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9031,9 +9078,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -10839,7 +10890,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10842 "configure"
+#line 10893 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10945,7 +10996,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10948 "configure"
+#line 10999 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12227,6 +12278,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -12244,12 +12338,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
diff --git a/libffi/Makefile.am b/libffi/Makefile.am
index 2259ddb75f9..2c5b74df9ee 100644
--- a/libffi/Makefile.am
+++ b/libffi/Makefile.am
@@ -214,7 +214,12 @@ libffi.map: $(top_srcdir)/libffi.map.in
$(COMPILE) -D$(TARGET) -DGENERATE_LIBFFI_MAP \
-E -x assembler-with-cpp -o $@ $(top_srcdir)/libffi.map.in
-libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS)
+if ENABLE_DARWIN_AT_RPATH
+libffi_darwin_rpath = -Wl,-rpath,@loader_path
+endif
+libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) \
+ $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS) \
+ $(libffi_darwin_rpath)
libffi_la_DEPENDENCIES = $(libffi_la_LIBADD) $(libffi_version_dep)
AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
diff --git a/libffi/Makefile.in b/libffi/Makefile.in
index 1d936b5c8a5..71469f7d632 100644
--- a/libffi/Makefile.in
+++ b/libffi/Makefile.in
@@ -597,7 +597,11 @@ AM_CFLAGS = -Wall -g -fexceptions $(CET_FLAGS) $(am__append_2)
@LIBFFI_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBFFI_BUILD_VERSIONED_SHLIB_TRUE@libffi_version_dep = libffi.map
@LIBFFI_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBFFI_BUILD_VERSIONED_SHLIB_TRUE@libffi_version_dep = libffi.map-sun
libffi_version_info = -version-info `grep -v '^\#' $(srcdir)/libtool-version`
-libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libffi_darwin_rpath = -Wl,-rpath,@loader_path
+libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) \
+ $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS) \
+ $(libffi_darwin_rpath)
+
libffi_la_DEPENDENCIES = $(libffi_la_LIBADD) $(libffi_version_dep)
AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
AM_CCASFLAGS = $(AM_CPPFLAGS) $(CET_FLAGS)
diff --git a/libffi/configure b/libffi/configure
index 9eac9c907bf..29054551f7e 100755
--- a/libffi/configure
+++ b/libffi/configure
@@ -667,6 +667,8 @@ MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
READELF
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
CXXCPP
CPP
OTOOL64
@@ -810,6 +812,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
enable_pax_emutramp
enable_debug
@@ -1465,6 +1468,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -7835,7 +7841,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9809,6 +9815,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9826,9 +9875,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11634,7 +11687,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11637 "configure"
+#line 11690 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11740,7 +11793,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11743 "configure"
+#line 11796 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12616,6 +12669,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -12633,12 +12729,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15008,6 +15112,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# Only expand once:
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}readelf", so it can be a program name with args.
@@ -17153,6 +17265,10 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libffi/configure.ac b/libffi/configure.ac
index 014d89d0423..716f20ae313 100644
--- a/libffi/configure.ac
+++ b/libffi/configure.ac
@@ -55,6 +55,7 @@ AC_SUBST(CET_FLAGS)
AM_PROG_AS
AM_PROG_CC_C_O
AC_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
AC_CHECK_TOOL(READELF, readelf)
diff --git a/libffi/doc/version.texi b/libffi/doc/version.texi
index f2b741e87e4..6261b21fec9 100644
--- a/libffi/doc/version.texi
+++ b/libffi/doc/version.texi
@@ -1,4 +1,4 @@
-@set UPDATED 27 June 2021
-@set UPDATED-MONTH June 2021
+@set UPDATED 31 August 2022
+@set UPDATED-MONTH August 2022
@set EDITION 3.4.2
@set VERSION 3.4.2
diff --git a/libgcc/config.host b/libgcc/config.host
index c94d69d84b7..d40cf55acb6 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -233,7 +233,6 @@ case ${host} in
;;
esac
tmake_file="$tmake_file t-slibgcc-darwin"
- # newer toolsets produce warnings when building for unsupported versions.
case ${host} in
*-*-darwin1[89]* | *-*-darwin2* )
tmake_file="t-darwin-min-8 $tmake_file"
@@ -251,6 +250,28 @@ case ${host} in
echo "Warning: libgcc configured to support macOS 10.5" 1>&2
;;
esac
+ # We are not using libtool to build the libs here, so we need to replicate
+ # a little of the logic around setting Darwin rpaths. Setting an explicit
+ # yes or no is honoured, otherwise we choose a suitable default.
+ # Sadly, this has to be kept in line with the rules in libtool.m4.
+ # This make fragment will override the setting in t-slibgcc-darwin so it
+ # must appear after it.
+ if test "x$enable_darwin_at_rpath" = "x"; then
+ echo "enable_darwin_at_rpath is unset" 1>&2
+ case ${host} in
+ *-darwin[45678]*) ;;
+ *-darwin9* | *-darwin1[01234]*) ;; # We might default these on later.
+ *-darwin*)
+ echo "but is needed after macOS 10.11 (setting it on)" 1>&2
+ enable_darwin_at_rpath=yes
+ ;;
+ esac
+ else
+ echo "enable_darwin_at_rpath is '$enable_darwin_at_rpath'" 1>&2
+ fi
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ tmake_file="$tmake_file t-darwin-rpath "
+ fi
extra_parts="crt3.o libd10-uwfef.a crttms.o crttme.o libemutls_w.a"
;;
*-*-dragonfly*)
diff --git a/libgcc/config/t-darwin-rpath b/libgcc/config/t-darwin-rpath
new file mode 100644
index 00000000000..e73d7f378b0
--- /dev/null
+++ b/libgcc/config/t-darwin-rpath
@@ -0,0 +1,2 @@
+# Use @rpath and add a search path to exes and dylibs that depend on this.
+SHLIB_RPATH = @rpath
diff --git a/libgcc/config/t-slibgcc-darwin b/libgcc/config/t-slibgcc-darwin
index cb0cbbdb1c5..da4886848e8 100644
--- a/libgcc/config/t-slibgcc-darwin
+++ b/libgcc/config/t-slibgcc-darwin
@@ -1,4 +1,4 @@
-# Build a shared libgcc library with the darwin linker.
+# Build a shared libgcc library able to use embedded runpaths.
SHLIB_SOVERSION = 1.1
SHLIB_SO_MINVERSION = 1
@@ -6,7 +6,6 @@ SHLIB_VERSTRING = -compatibility_version $(SHLIB_SO_MINVERSION) \
-current_version $(SHLIB_SOVERSION)
SHLIB_EXT = .dylib
SHLIB_LC = -lSystem
-SHLIB_INSTALL_DIR = $(slibdir)
SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
SHLIB_MKMAP_OPTS = -v leading_underscore=1
@@ -23,11 +22,16 @@ SHLIB_SONAME = @shlib_base_name@$(SHLIB_EXT)
# subdir. The code under MULTIBUILDTOP combines these into a single FAT
# library, that is what we eventually install.
+# When enable_darwin_at_rpath is true, use @rpath instead of $(slibdir) for
+# this and dylibs that depend on this. So this def must come first and be
+# overridden in a make fragment that depends on the rpath setting.
+SHLIB_RPATH = $(slibdir)
+
SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) $(LDFLAGS) -dynamiclib -nodefaultlibs \
- -install_name $(SHLIB_INSTALL_DIR)/$(SHLIB_INSTALL_NAME) \
+ -install_name $(SHLIB_RPATH)/$(SHLIB_INSTALL_NAME) \
-single_module -o $(SHLIB_DIR)/$(SHLIB_SONAME) \
-Wl,-exported_symbols_list,$(SHLIB_MAP) \
- $(SHLIB_VERSTRING) \
+ $(SHLIB_VERSTRING) -nodefaultrpaths \
@multilib_flags@ @shlib_objs@ $(SHLIB_LC)
# we do our own thing
@@ -63,9 +67,9 @@ EHS_INSTNAME = libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT)
libgcc_ehs$(SHLIB_EXT): $(LIBEHSOBJS) $(extra-parts)
mkdir -p $(MULTIDIR)
$(CC) $(LIBGCC2_CFLAGS) $(LDFLAGS) -dynamiclib -nodefaultlibs \
- -install_name $(SHLIB_INSTALL_DIR)/$(EHS_INSTNAME) \
+ -install_name $(SHLIB_RPATH)/$(EHS_INSTNAME) \
-o $(MULTIDIR)/libgcc_ehs$(SHLIB_EXT) $(SHLIB_VERSTRING) \
- $(LIBEHSOBJS) $(SHLIB_LC)
+ -nodefaultrpaths $(LIBEHSOBJS) $(SHLIB_LC)
all: libgcc_ehs$(SHLIB_EXT)
@@ -122,12 +126,12 @@ libgcc_s.1.dylib: all-multi libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT) \
cp ../$${mlib}/libgcc/$${mlib}/libgcc_ehs$(SHLIB_EXT) \
./libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} || exit 1 ; \
arch=`$(LIPO) -info libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} | sed -e 's/.*:\ //'` ; \
- $(CC) -arch $${arch} -nodefaultlibs -dynamiclib \
+ $(CC) -arch $${arch} -nodefaultlibs -dynamiclib -nodefaultrpaths \
-o libgcc_s.1$(SHLIB_EXT)_T_$${mlib} \
-Wl,-reexport_library,libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} \
-Wl,-reexport_library,libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} \
- -install_name $(SHLIB_INSTALL_DIR)/libgcc_s.1.dylib \
- -compatibility_version 1 -current_version 1 ; \
+ -install_name $(SHLIB_RPATH)/libgcc_s.1.dylib \
+ -compatibility_version 1 -current_version 1.1 ; \
done
$(LIPO) -output libgcc_s.1$(SHLIB_EXT) -create libgcc_s.1$(SHLIB_EXT)_T*
rm libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T*
@@ -141,13 +145,13 @@ libgcc_s.1.dylib: all-multi libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)
cp ../$${mlib}/libgcc/$${mlib}/libgcc_s$(SHLIB_EXT) \
./libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} || exit 1 ; \
arch=`$(LIPO) -info libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} | sed -e 's/.*:\ //'` ; \
- $(CC) -arch $${arch} -nodefaultlibs -dynamiclib \
+ $(CC) -arch $${arch} -nodefaultlibs -dynamiclib -nodefaultrpaths \
-o libgcc_s.1$(SHLIB_EXT)_T_$${mlib} \
-Wl,-reexport_library,libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} \
-lSystem \
-Wl,-reexported_symbols_list,$(srcdir)/config/darwin-unwind.ver \
- -install_name $(SHLIB_INSTALL_DIR)/libgcc_s.1.dylib \
- -compatibility_version 1 -current_version 1 ; \
+ -install_name $(SHLIB_RPATH)/libgcc_s.1.dylib \
+ -compatibility_version 1 -current_version 1.1 ; \
done
$(LIPO) -output libgcc_s.1$(SHLIB_EXT) -create libgcc_s.1$(SHLIB_EXT)_T*
rm libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T*
diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am
index 9fab07c9a50..9f8a4f69863 100644
--- a/libgfortran/Makefile.am
+++ b/libgfortran/Makefile.am
@@ -37,6 +37,11 @@ else
version_arg =
version_dep =
endif
+extra_darwin_ldflags_libgfortran = @extra_ldflags_libgfortran@
+if ENABLE_DARWIN_AT_RPATH
+extra_darwin_ldflags_libgfortran += -Wc,-nodefaultrpaths
+extra_darwin_ldflags_libgfortran += -Wl,-rpath,@loader_path
+endif
gfor_c_HEADERS = ISO_Fortran_binding.h
gfor_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
@@ -50,7 +55,7 @@ libgfortran_la_LINK = $(LINK) $(libgfortran_la_LDFLAGS)
libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
$(LTLDFLAGS) $(LIBQUADLIB) ../libbacktrace/libbacktrace.la \
$(HWCAP_LDFLAGS) \
- $(LIBM) $(extra_ldflags_libgfortran) \
+ $(LIBM) $(extra_darwin_ldflags_libgfortran) \
$(version_arg) -Wc,-shared-libgcc
libgfortran_la_DEPENDENCIES = $(version_dep) libgfortran.spec $(LIBQUADLIB_DEP)
diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in
index e8627f9a4bc..30d1dc56da7 100644
--- a/libgfortran/Makefile.in
+++ b/libgfortran/Makefile.in
@@ -91,8 +91,10 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-@LIBGFOR_MINIMAL_TRUE@am__append_1 = -DLIBGFOR_MINIMAL
-@LIBGFOR_MINIMAL_FALSE@am__append_2 = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+@LIBGFOR_MINIMAL_TRUE@am__append_2 = -DLIBGFOR_MINIMAL
+@LIBGFOR_MINIMAL_FALSE@am__append_3 = \
@LIBGFOR_MINIMAL_FALSE@io/close.c \
@LIBGFOR_MINIMAL_FALSE@io/file_pos.c \
@LIBGFOR_MINIMAL_FALSE@io/format.c \
@@ -110,7 +112,7 @@ target_triplet = @target@
@LIBGFOR_MINIMAL_FALSE@io/fbuf.c \
@LIBGFOR_MINIMAL_FALSE@io/async.c
-@LIBGFOR_MINIMAL_FALSE@am__append_3 = \
+@LIBGFOR_MINIMAL_FALSE@am__append_4 = \
@LIBGFOR_MINIMAL_FALSE@intrinsics/access.c \
@LIBGFOR_MINIMAL_FALSE@intrinsics/c99_functions.c \
@LIBGFOR_MINIMAL_FALSE@intrinsics/chdir.c \
@@ -143,9 +145,9 @@ target_triplet = @target@
@LIBGFOR_MINIMAL_FALSE@intrinsics/umask.c \
@LIBGFOR_MINIMAL_FALSE@intrinsics/unlink.c
-@IEEE_SUPPORT_TRUE@am__append_4 = ieee/ieee_helper.c
-@LIBGFOR_MINIMAL_TRUE@am__append_5 = runtime/minimal.c
-@LIBGFOR_MINIMAL_FALSE@am__append_6 = \
+@IEEE_SUPPORT_TRUE@am__append_5 = ieee/ieee_helper.c
+@LIBGFOR_MINIMAL_TRUE@am__append_6 = runtime/minimal.c
+@LIBGFOR_MINIMAL_FALSE@am__append_7 = \
@LIBGFOR_MINIMAL_FALSE@runtime/backtrace.c \
@LIBGFOR_MINIMAL_FALSE@runtime/convert_char.c \
@LIBGFOR_MINIMAL_FALSE@runtime/environ.c \
@@ -584,7 +586,7 @@ AMTAR = @AMTAR@
# Some targets require additional compiler options for IEEE compatibility.
AM_CFLAGS = @AM_CFLAGS@ -fcx-fortran-rules $(SECTION_FLAGS) \
- $(IEEE_FLAGS) $(am__append_1)
+ $(IEEE_FLAGS) $(am__append_2)
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ $(IEEE_FLAGS)
AR = @AR@
@@ -743,6 +745,8 @@ gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
@LIBGFOR_USE_SYMVER_FALSE@version_dep =
@LIBGFOR_USE_SYMVER_GNU_TRUE@@LIBGFOR_USE_SYMVER_TRUE@version_dep = gfortran.ver
@LIBGFOR_USE_SYMVER_SUN_TRUE@@LIBGFOR_USE_SYMVER_TRUE@version_dep = gfortran.ver-sun gfortran.ver
+extra_darwin_ldflags_libgfortran = @extra_ldflags_libgfortran@ \
+ $(am__append_1)
gfor_c_HEADERS = ISO_Fortran_binding.h
gfor_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) \
@@ -754,7 +758,7 @@ libgfortran_la_LINK = $(LINK) $(libgfortran_la_LDFLAGS)
libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
$(LTLDFLAGS) $(LIBQUADLIB) ../libbacktrace/libbacktrace.la \
$(HWCAP_LDFLAGS) \
- $(LIBM) $(extra_ldflags_libgfortran) \
+ $(LIBM) $(extra_darwin_ldflags_libgfortran) \
$(version_arg) -Wc,-shared-libgcc
libgfortran_la_DEPENDENCIES = $(version_dep) libgfortran.spec $(LIBQUADLIB_DEP)
@@ -775,7 +779,7 @@ AM_CPPFLAGS = -iquote$(srcdir)/io -I$(srcdir)/$(MULTISRCTOP)../gcc \
-I$(MULTIBUILDTOP)../libbacktrace \
-I../libbacktrace
-gfor_io_src = io/size_from_kind.c $(am__append_2)
+gfor_io_src = io/size_from_kind.c $(am__append_3)
gfor_io_headers = \
io/io.h \
io/fbuf.h \
@@ -797,7 +801,7 @@ gfor_helper_src = intrinsics/associated.c intrinsics/abort.c \
intrinsics/selected_int_kind.f90 \
intrinsics/selected_real_kind.f90 intrinsics/trigd.c \
intrinsics/unpack_generic.c runtime/in_pack_generic.c \
- runtime/in_unpack_generic.c $(am__append_3) $(am__append_4)
+ runtime/in_unpack_generic.c $(am__append_4) $(am__append_5)
@IEEE_SUPPORT_TRUE@gfor_ieee_helper_src = ieee/ieee_helper.c
@IEEE_SUPPORT_FALSE@gfor_ieee_src =
@IEEE_SUPPORT_TRUE@gfor_ieee_src = \
@@ -806,8 +810,8 @@ gfor_helper_src = intrinsics/associated.c intrinsics/abort.c \
@IEEE_SUPPORT_TRUE@ieee/ieee_features.F90
gfor_src = runtime/bounds.c runtime/compile_options.c runtime/memory.c \
- runtime/string.c runtime/select.c $(am__append_5) \
- $(am__append_6)
+ runtime/string.c runtime/select.c $(am__append_6) \
+ $(am__append_7)
i_all_c = \
$(srcdir)/generated/all_l1.c \
$(srcdir)/generated/all_l2.c \
diff --git a/libgfortran/configure b/libgfortran/configure
index cd176b04a14..774dd52fc95 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -654,6 +654,8 @@ extra_ldflags_libgfortran
ac_ct_FC
FCFLAGS
FC
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -819,6 +821,7 @@ enable_static
with_pic
enable_fast_install
enable_libtool_lock
+enable_darwin_at_rpath
enable_largefile
enable_libquadmath_support
with_gcc_major_version_only
@@ -1473,6 +1476,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--disable-largefile omit support for large files
--disable-libquadmath-support
disable libquadmath support for Fortran
@@ -9243,7 +9249,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10953,6 +10959,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10970,9 +11019,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12799,7 +12852,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12802 "configure"
+#line 12855 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12905,7 +12958,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12908 "configure"
+#line 12961 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13307,6 +13360,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
#AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10
# We need gfortran to compile parts of the library
@@ -14950,6 +15011,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_FC=no
hardcode_direct_FC=no
hardcode_automatic_FC=yes
@@ -14967,9 +15071,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_FC="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_FC="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -16242,9 +16350,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# extra LD Flags which are required for targets
+extra_ldflags_libgfortran=
case "${host}" in
- *-darwin*)
- # Darwin needs -single_module when linking libgfortran
+ *-*-darwin[4567]*)
+ # Earlier Darwin needs -single_module when linking libgfortran
extra_ldflags_libgfortran=-Wl,-single_module
;;
esac
@@ -31601,6 +31710,10 @@ if test -z "${HAVE_HWCAP_TRUE}" && test -z "${HAVE_HWCAP_FALSE}"; then
as_fn_error $? "conditional \"HAVE_HWCAP\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${IEEE_SUPPORT_TRUE}" && test -z "${IEEE_SUPPORT_FALSE}"; then
as_fn_error $? "conditional \"IEEE_SUPPORT\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index 8bd2af966c8..46585a3ee14 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -269,6 +269,7 @@ LT_LIB_M
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
#AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10
# We need gfortran to compile parts of the library
@@ -277,9 +278,10 @@ FC="$GFORTRAN"
AC_PROG_FC(gfortran)
# extra LD Flags which are required for targets
+extra_ldflags_libgfortran=
case "${host}" in
- *-darwin*)
- # Darwin needs -single_module when linking libgfortran
+ *-*-darwin[[4567]]*)
+ # Earlier Darwin needs -single_module when linking libgfortran
extra_ldflags_libgfortran=-Wl,-single_module
;;
esac
diff --git a/libgm2/Makefile.am b/libgm2/Makefile.am
index 95df3ed7a30..aa35e747c9a 100644
--- a/libgm2/Makefile.am
+++ b/libgm2/Makefile.am
@@ -46,6 +46,12 @@ SUBDIRS = libm2min libm2log libm2cor libm2iso libm2pim
GM2_BUILDDIR := $(shell pwd)
gm2_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
+if ENABLE_DARWIN_AT_RPATH
+DARWIN_AT_RPATH=yes
+else
+DARWIN_AT_RPATH=yes
+endif
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
# friends when we are called from the top level Makefile.
@@ -91,7 +97,8 @@ AM_MAKEFLAGS = \
"WERROR=$(WERROR)" \
"TARGET_LIB_PATH=$(TARGET_LIB_PATH)" \
"TARGET_LIB_PATH_libgm2=$(TARGET_LIB_PATH_libgm2)" \
- "LIBTOOL=$(GM2_BUILDDIR)/libtool"
+ "LIBTOOL=$(GM2_BUILDDIR)/libtool" \
+ "DARWIN_AT_RPATH=$(DARWIN_AT_RPATH)"
# Subdir rules rely on $(FLAGS_TO_PASS)
FLAGS_TO_PASS = $(AM_MAKEFLAGS)
diff --git a/libgm2/Makefile.in b/libgm2/Makefile.in
index c0396791f48..e8fa4aa52dc 100644
--- a/libgm2/Makefile.in
+++ b/libgm2/Makefile.in
@@ -90,15 +90,15 @@ host_triplet = @host@
target_triplet = @target@
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
@@ -343,6 +343,8 @@ GM2_SRC = $(GCC_DIR)/m2
SUBDIRS = libm2min libm2log libm2cor libm2iso libm2pim
GM2_BUILDDIR := $(shell pwd)
gm2_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
+@ENABLE_DARWIN_AT_RPATH_FALSE@DARWIN_AT_RPATH = yes
+@ENABLE_DARWIN_AT_RPATH_TRUE@DARWIN_AT_RPATH = yes
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
@@ -389,7 +391,8 @@ AM_MAKEFLAGS = \
"WERROR=$(WERROR)" \
"TARGET_LIB_PATH=$(TARGET_LIB_PATH)" \
"TARGET_LIB_PATH_libgm2=$(TARGET_LIB_PATH_libgm2)" \
- "LIBTOOL=$(GM2_BUILDDIR)/libtool"
+ "LIBTOOL=$(GM2_BUILDDIR)/libtool" \
+ "DARWIN_AT_RPATH=$(DARWIN_AT_RPATH)"
# Subdir rules rely on $(FLAGS_TO_PASS)
diff --git a/libgm2/aclocal.m4 b/libgm2/aclocal.m4
index c352303012d..832065fbb9b 100644
--- a/libgm2/aclocal.m4
+++ b/libgm2/aclocal.m4
@@ -1187,14 +1187,14 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
-m4_include([../libtool.m4])
-m4_include([../ltoptions.m4])
-m4_include([../ltsugar.m4])
-m4_include([../ltversion.m4])
-m4_include([../lt~obsolete.m4])
m4_include([../config/acx.m4])
m4_include([../config/depstand.m4])
m4_include([../config/lead-dot.m4])
m4_include([../config/multi.m4])
m4_include([../config/no-executables.m4])
m4_include([../config/override.m4])
+m4_include([../libtool.m4])
+m4_include([../ltoptions.m4])
+m4_include([../ltsugar.m4])
+m4_include([../ltversion.m4])
+m4_include([../lt~obsolete.m4])
diff --git a/libgm2/configure b/libgm2/configure
index 072d584544e..d55a7f4a74b 100755
--- a/libgm2/configure
+++ b/libgm2/configure
@@ -649,6 +649,8 @@ GM2_FOR_TARGET
CC_FOR_BUILD
enable_static
enable_shared
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
CXXCPP
OTOOL64
OTOOL
@@ -805,6 +807,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
with_gcc_major_version_only
'
ac_precious_vars='build_alias
@@ -1455,6 +1458,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -6569,10 +6575,6 @@ fi
-enable_dlopen=yes
-
-
-
case `pwd` in
*\ * | *\ *)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
@@ -9181,7 +9183,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9229,6 +9231,8 @@ done
+ enable_dlopen=no
+
enable_win32_dll=no
@@ -10892,6 +10896,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10909,9 +10956,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12738,7 +12789,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12741 "configure"
+#line 12792 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12844,7 +12895,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12847 "configure"
+#line 12898 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13726,6 +13777,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13743,12 +13837,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -16122,6 +16224,21 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+enable_dlopen=yes
+
+
+
+
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
+
if test "${multilib}" = "yes"; then
@@ -20310,6 +20427,10 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${BUILD_PIMLIB_TRUE}" && test -z "${BUILD_PIMLIB_FALSE}"; then
as_fn_error $? "conditional \"BUILD_PIMLIB\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgm2/configure.ac b/libgm2/configure.ac
index 92e76c9346c..5701b95878b 100644
--- a/libgm2/configure.ac
+++ b/libgm2/configure.ac
@@ -212,8 +212,12 @@ AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
AC_PROG_MAKE_SET
AC_PROG_INSTALL
-AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
+LT_INIT
+AC_LIBTOOL_DLOPEN
+
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
diff --git a/libgm2/libm2cor/Makefile.am b/libgm2/libm2cor/Makefile.am
index 48de40c22dd..e50c7a2ef55 100644
--- a/libgm2/libm2cor/Makefile.am
+++ b/libgm2/libm2cor/Makefile.am
@@ -123,6 +123,10 @@ libm2cor_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2cor_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2cor_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
+
libm2cor_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2cor_la_link_flags)
BUILT_SOURCES = SYSTEM.def
CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2cor/Makefile.in b/libgm2/libm2cor/Makefile.in
index 3b0b40fea60..cc8a3fa73ed 100644
--- a/libgm2/libm2cor/Makefile.in
+++ b/libgm2/libm2cor/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@BUILD_CORLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2cor
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -468,8 +469,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_CORLIB_TRUE@ -fm2-pathname=m2iso -I$(GM2_SRC)/gm2-libs-iso \
@BUILD_CORLIB_TRUE@ -fm2-g -g -Wreturn-type -fcase -fm2-prefix=m2cor
-@BUILD_CORLIB_TRUE@@TARGET_DARWIN_FALSE@libm2cor_la_link_flags =
-@BUILD_CORLIB_TRUE@@TARGET_DARWIN_TRUE@libm2cor_la_link_flags = -Wl,-undefined,dynamic_lookup
+@BUILD_CORLIB_TRUE@@TARGET_DARWIN_FALSE@libm2cor_la_link_flags = \
+@BUILD_CORLIB_TRUE@@TARGET_DARWIN_FALSE@ $(am__append_1)
+@BUILD_CORLIB_TRUE@@TARGET_DARWIN_TRUE@libm2cor_la_link_flags = -Wl,-undefined,dynamic_lookup \
+@BUILD_CORLIB_TRUE@@TARGET_DARWIN_TRUE@ $(am__append_1)
@BUILD_CORLIB_TRUE@libm2cor_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2cor_la_link_flags)
@BUILD_CORLIB_TRUE@BUILT_SOURCES = SYSTEM.def
@BUILD_CORLIB_TRUE@CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2iso/Makefile.am b/libgm2/libm2iso/Makefile.am
index 1386f156cab..4d8e897266f 100644
--- a/libgm2/libm2iso/Makefile.am
+++ b/libgm2/libm2iso/Makefile.am
@@ -197,6 +197,10 @@ libm2iso_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2iso_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2iso_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
+
libm2iso_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2iso_la_link_flags)
CLEANFILES = SYSTEM.def
BUILT_SOURCES = SYSTEM.def
diff --git a/libgm2/libm2iso/Makefile.in b/libgm2/libm2iso/Makefile.in
index b939581b7c1..08563adfe78 100644
--- a/libgm2/libm2iso/Makefile.in
+++ b/libgm2/libm2iso/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@BUILD_ISOLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2iso
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -569,8 +570,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_ISOLIB_TRUE@ -fm2-pathname=m2pim -I$(GM2_SRC)/gm2-libs \
@BUILD_ISOLIB_TRUE@ -fiso -fextended-opaque -fm2-g -g -Wreturn-type -fcase -fm2-prefix=m2iso
-@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_FALSE@libm2iso_la_link_flags =
-@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_TRUE@libm2iso_la_link_flags = -Wl,-undefined,dynamic_lookup
+@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_FALSE@libm2iso_la_link_flags = \
+@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_FALSE@ $(am__append_1)
+@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_TRUE@libm2iso_la_link_flags = -Wl,-undefined,dynamic_lookup \
+@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_TRUE@ $(am__append_1)
@BUILD_ISOLIB_TRUE@libm2iso_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2iso_la_link_flags)
@BUILD_ISOLIB_TRUE@CLEANFILES = SYSTEM.def
@BUILD_ISOLIB_TRUE@BUILT_SOURCES = SYSTEM.def
diff --git a/libgm2/libm2log/Makefile.am b/libgm2/libm2log/Makefile.am
index a15747fd245..3b7609ee5c1 100644
--- a/libgm2/libm2log/Makefile.am
+++ b/libgm2/libm2log/Makefile.am
@@ -142,6 +142,9 @@ libm2log_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2log_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2log_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
libm2log_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2log_la_link_flags)
BUILT_SOURCES = ../libm2pim/SYSTEM.def
diff --git a/libgm2/libm2log/Makefile.in b/libgm2/libm2log/Makefile.in
index ba34a6b445a..fa12a386c55 100644
--- a/libgm2/libm2log/Makefile.in
+++ b/libgm2/libm2log/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@BUILD_LOGLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2log
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -477,8 +478,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_LOGLIB_TRUE@ -fm2-pathname=m2iso -I$(GM2_SRC)/gm2-libs-iso \
@BUILD_LOGLIB_TRUE@ -Wreturn-type -fcase -fm2-prefix=m2log
-@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_FALSE@libm2log_la_link_flags =
-@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_TRUE@libm2log_la_link_flags = -Wl,-undefined,dynamic_lookup
+@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_FALSE@libm2log_la_link_flags = \
+@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_FALSE@ $(am__append_1)
+@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_TRUE@libm2log_la_link_flags = -Wl,-undefined,dynamic_lookup \
+@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_TRUE@ $(am__append_1)
@BUILD_LOGLIB_TRUE@libm2log_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2log_la_link_flags)
@BUILD_LOGLIB_TRUE@BUILT_SOURCES = ../libm2pim/SYSTEM.def
@BUILD_LOGLIB_TRUE@M2LIBDIR = /m2/m2log/
diff --git a/libgm2/libm2min/Makefile.am b/libgm2/libm2min/Makefile.am
index 1ff160028f6..21411769505 100644
--- a/libgm2/libm2min/Makefile.am
+++ b/libgm2/libm2min/Makefile.am
@@ -113,6 +113,9 @@ libm2min_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2min_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2min_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
libm2min_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2min_la_link_flags)
BUILT_SOURCES = SYSTEM.def
CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2min/Makefile.in b/libgm2/libm2min/Makefile.in
index 9ead8397fd0..73af6568b88 100644
--- a/libgm2/libm2min/Makefile.in
+++ b/libgm2/libm2min/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2min
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -441,8 +442,10 @@ libm2min_la_M2FLAGS = \
-fm2-pathname=m2pim -I$(GM2_SRC)/gm2-libs -fno-exceptions \
-fno-m2-plugin -fno-scaffold-dynamic -fno-scaffold-main -fm2-prefix=m2min
-@TARGET_DARWIN_FALSE@libm2min_la_link_flags =
-@TARGET_DARWIN_TRUE@libm2min_la_link_flags = -Wl,-undefined,dynamic_lookup
+@TARGET_DARWIN_FALSE@libm2min_la_link_flags = $(am__append_1)
+@TARGET_DARWIN_TRUE@libm2min_la_link_flags = \
+@TARGET_DARWIN_TRUE@ -Wl,-undefined,dynamic_lookup \
+@TARGET_DARWIN_TRUE@ $(am__append_1)
libm2min_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2min_la_link_flags)
BUILT_SOURCES = SYSTEM.def
CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2pim/Makefile.am b/libgm2/libm2pim/Makefile.am
index ebfeba1ac1d..e777a60c077 100644
--- a/libgm2/libm2pim/Makefile.am
+++ b/libgm2/libm2pim/Makefile.am
@@ -175,6 +175,9 @@ libm2pim_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2pim_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2pim_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
libm2pim_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2pim_la_link_flags)
BUILT_SOURCES = SYSTEM.def
CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2pim/Makefile.in b/libgm2/libm2pim/Makefile.in
index 660488f9692..54414058bc5 100644
--- a/libgm2/libm2pim/Makefile.in
+++ b/libgm2/libm2pim/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@BUILD_PIMLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2pim
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -538,8 +539,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_PIMLIB_TRUE@ -fm2-pathname=m2iso -I$(GM2_SRC)/gm2-libs-iso \
@BUILD_PIMLIB_TRUE@ -fm2-g -g -Wreturn-type -fcase -fm2-prefix=m2pim
-@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_FALSE@libm2pim_la_link_flags =
-@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_TRUE@libm2pim_la_link_flags = -Wl,-undefined,dynamic_lookup
+@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_FALSE@libm2pim_la_link_flags = \
+@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_FALSE@ $(am__append_1)
+@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_TRUE@libm2pim_la_link_flags = -Wl,-undefined,dynamic_lookup \
+@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_TRUE@ $(am__append_1)
@BUILD_PIMLIB_TRUE@libm2pim_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2pim_la_link_flags)
@BUILD_PIMLIB_TRUE@BUILT_SOURCES = SYSTEM.def
@BUILD_PIMLIB_TRUE@CLEANFILES = SYSTEM.def
diff --git a/libgo/configure b/libgo/configure
index a607dbff68e..72d46c3eec3 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -708,6 +708,8 @@ glibgo_toolexecdir
WERROR
WARN_FLAGS
CC_FOR_BUILD
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
CPP
@@ -11544,7 +11546,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11547 "configure"
+#line 11549 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11650,7 +11652,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11653 "configure"
+#line 11655 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13779,6 +13781,14 @@ CC="$lt_save_CC"
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
CC_FOR_BUILD=${CC_FOR_BUILD:-gcc}
@@ -16386,6 +16396,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${USE_LIBFFI_TRUE}" && test -z "${USE_LIBFFI_FALSE}"; then
as_fn_error $? "conditional \"USE_LIBFFI\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgo/configure.ac b/libgo/configure.ac
index a59aa091d1d..6f1ac32660b 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -53,6 +53,7 @@ AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
CC_FOR_BUILD=${CC_FOR_BUILD:-gcc}
AC_SUBST(CC_FOR_BUILD)
diff --git a/libgomp/Makefile.am b/libgomp/Makefile.am
index 428f7a9dab5..ceb8c910abd 100644
--- a/libgomp/Makefile.am
+++ b/libgomp/Makefile.am
@@ -53,9 +53,14 @@ else
libgomp_version_script =
libgomp_version_dep =
endif
+
libgomp_version_info = -version-info $(libtool_VERSION)
+if ENABLE_DARWIN_AT_RPATH
+libgomp_darwin_rpath = -Wc,-nodefaultrpaths
+libgomp_darwin_rpath += -Wl,-rpath,@loader_path
+endif
libgomp_la_LDFLAGS = $(libgomp_version_info) $(libgomp_version_script) \
- $(lt_host_flags)
+ $(lt_host_flags) $(libgomp_darwin_rpath)
libgomp_la_LIBADD =
libgomp_la_DEPENDENCIES = $(libgomp_version_dep)
libgomp_la_LINK = $(LINK) $(libgomp_la_LDFLAGS)
diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
index 3ef05e6a3cb..2467250215e 100644
--- a/libgomp/Makefile.in
+++ b/libgomp/Makefile.in
@@ -535,8 +535,11 @@ nodist_toolexeclib_HEADERS = libgomp.spec
@LIBGOMP_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgomp_version_dep = libgomp.ver
@LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgomp_version_dep = libgomp.ver-sun
libgomp_version_info = -version-info $(libtool_VERSION)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libgomp_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
libgomp_la_LDFLAGS = $(libgomp_version_info) $(libgomp_version_script) \
- $(lt_host_flags)
+ $(lt_host_flags) $(libgomp_darwin_rpath)
libgomp_la_LIBADD = $(DL_LIBS)
libgomp_la_DEPENDENCIES = $(libgomp_version_dep)
diff --git a/libgomp/configure b/libgomp/configure
index a12b30f1b0f..7c103cf37f1 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -683,6 +683,8 @@ CXX
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -822,6 +824,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
enable_linux_futex
enable_tls
@@ -1477,6 +1480,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -7618,7 +7624,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9591,6 +9597,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9608,9 +9657,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11416,7 +11469,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11419 "configure"
+#line 11472 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11522,7 +11575,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11525 "configure"
+#line 11578 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11783,6 +11836,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
@@ -13469,6 +13530,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_FC=no
hardcode_direct_FC=no
hardcode_automatic_FC=yes
@@ -13486,9 +13590,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_FC="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_FC="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -17130,6 +17238,10 @@ if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then
as_fn_error $? "conditional \"BUILD_INFO\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index 1aad83a79da..8c941cddd2f 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -148,6 +148,7 @@ AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
AM_MAINTAINER_MODE
diff --git a/libitm/Makefile.am b/libitm/Makefile.am
index 3f31ad30556..a25317b07fe 100644
--- a/libitm/Makefile.am
+++ b/libitm/Makefile.am
@@ -54,7 +54,12 @@ libitm_version_info = -version-info $(libtool_VERSION)
# want or need libstdc++.
libitm_la_DEPENDENCIES = $(libitm_version_dep)
libitm_la_LINK = $(LINK) $(libitm_la_LDFLAGS)
-libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script)
+if ENABLE_DARWIN_AT_RPATH
+libitm_darwin_rpath = -Wc,-nodefaultrpaths
+libitm_darwin_rpath += -Wl,-rpath,@loader_path
+endif
+libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script) \
+ $(libitm_darwin_rpath)
libitm_la_SOURCES = \
aatree.cc alloc.cc alloc_c.cc alloc_cpp.cc barrier.cc beginend.cc \
diff --git a/libitm/Makefile.in b/libitm/Makefile.in
index 7c51fe02511..9f0691018a9 100644
--- a/libitm/Makefile.in
+++ b/libitm/Makefile.in
@@ -480,7 +480,12 @@ libitm_version_info = -version-info $(libtool_VERSION)
# want or need libstdc++.
libitm_la_DEPENDENCIES = $(libitm_version_dep)
libitm_la_LINK = $(LINK) $(libitm_la_LDFLAGS)
-libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libitm_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script) \
+ $(libitm_darwin_rpath)
+
libitm_la_SOURCES = aatree.cc alloc.cc alloc_c.cc alloc_cpp.cc \
barrier.cc beginend.cc clone.cc eh_cpp.cc local.cc query.cc \
retry.cc rwlock.cc useraction.cc util.cc sjlj.S tls.cc \
diff --git a/libitm/configure b/libitm/configure
index 02e8de7896b..9ba7fb03a57 100755
--- a/libitm/configure
+++ b/libitm/configure
@@ -660,6 +660,8 @@ libtool_VERSION
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
CXXCPP
@@ -809,6 +811,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
enable_linux_futex
enable_tls
@@ -1461,6 +1464,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -8279,7 +8285,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10253,6 +10259,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10270,9 +10319,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12078,7 +12131,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12081 "configure"
+#line 12134 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12184,7 +12237,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12187 "configure"
+#line 12240 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13060,6 +13113,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13077,12 +13173,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15454,6 +15558,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
@@ -18212,6 +18324,10 @@ if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then
as_fn_error $? "conditional \"BUILD_INFO\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libitm/configure.ac b/libitm/configure.ac
index 892a24caa85..dded4d387be 100644
--- a/libitm/configure.ac
+++ b/libitm/configure.ac
@@ -156,6 +156,7 @@ AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes")
AM_PROG_LIBTOOL
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
AM_MAINTAINER_MODE
diff --git a/libobjc/configure b/libobjc/configure
index 752f6fdfebd..68172549137 100755
--- a/libobjc/configure
+++ b/libobjc/configure
@@ -636,6 +636,9 @@ OBJC_BOEHM_GC_LIBS
OBJC_BOEHM_GC_INCLUDES
OBJC_BOEHM_GC
OBJC_GCFLAGS
+extra_ldflags_libobjc
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
SET_MAKE
CPP
OTOOL64
@@ -667,7 +670,6 @@ RANLIB
AR
AS
XCFLAGS
-extra_ldflags_libobjc
lt_host_flags
OBJEXT
EXEEXT
@@ -755,6 +757,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_tls
enable_objc_gc
with_target_bdw_gc
@@ -1392,6 +1395,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-tls Use thread-local storage [default=yes]
--enable-objc-gc enable use of Boehm's garbage collector with the GNU
Objective-C runtime
@@ -3431,17 +3437,6 @@ esac
-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
-
# Add CET specific flags if CET is enabled
@@ -7011,7 +7006,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -8988,6 +8983,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9005,9 +9043,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -10834,7 +10876,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10837 "configure"
+#line 10879 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10940,7 +10982,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10943 "configure"
+#line 10985 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11212,6 +11254,38 @@ $as_echo "no" >&6; }
fi
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
+# 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
+
+
# -------
# Headers
# -------
@@ -11953,6 +12027,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/libobjc/configure.ac b/libobjc/configure.ac
index 9bd7d59d597..cb21ebbfcc7 100644
--- a/libobjc/configure.ac
+++ b/libobjc/configure.ac
@@ -148,17 +148,6 @@ m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
# 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)
@@ -183,6 +172,31 @@ AM_PROG_CC_C_O
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
# -------
diff --git a/libphobos/configure b/libphobos/configure
index b7276d95010..25b13bdd93e 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -707,6 +707,8 @@ get_gcc_base_ver
phobos_compiler_shared_flag
phobos_compiler_pic_flag
phobos_lt_pic_flag
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
OTOOL64
@@ -838,6 +840,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
with_gcc_major_version_only
enable_werror
with_libatomic
@@ -1490,6 +1493,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-werror turns on -Werror [default=no]
--enable-version-specific-runtime-libs
Specify that runtime libraries should be installed
@@ -8282,7 +8288,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9987,6 +9993,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10004,9 +10053,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11812,7 +11865,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11815 "configure"
+#line 11868 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11918,7 +11971,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11921 "configure"
+#line 11974 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13443,6 +13496,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_D=no
hardcode_direct_D=no
hardcode_automatic_D=yes
@@ -13460,9 +13556,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_D="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_D="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_D="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_D="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_D="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_D="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -14064,6 +14164,14 @@ CFLAGS=$lt_save_CFLAGS
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
# libtool variables for Phobos shared and position-independent compiles.
#
@@ -15877,6 +15985,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${DRUNTIME_CPU_AARCH64_TRUE}" && test -z "${DRUNTIME_CPU_AARCH64_FALSE}"; then
as_fn_error $? "conditional \"DRUNTIME_CPU_AARCH64\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libphobos/configure.ac b/libphobos/configure.ac
index 3b2e6df5d5c..bb669675ce0 100644
--- a/libphobos/configure.ac
+++ b/libphobos/configure.ac
@@ -93,6 +93,7 @@ AM_PROG_LIBTOOL
WITH_LOCAL_DRUNTIME([LT_LANG([D])], [])
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
# libtool variables for Phobos shared and position-independent compiles.
#
diff --git a/libphobos/libdruntime/Makefile.am b/libphobos/libdruntime/Makefile.am
index 832a0524ab3..b78bcdd203f 100644
--- a/libphobos/libdruntime/Makefile.am
+++ b/libphobos/libdruntime/Makefile.am
@@ -128,8 +128,11 @@ ALL_DRUNTIME_SOURCES = $(DRUNTIME_DSOURCES) $(DRUNTIME_CSOURCES) \
toolexeclib_LTLIBRARIES = libgdruntime.la
libgdruntime_la_SOURCES = $(ALL_DRUNTIME_SOURCES)
libgdruntime_la_LIBTOOLFLAGS =
+if ENABLE_DARWIN_AT_RPATH
+libgdruntime_darwin_rpath = -Wl,-rpath,@loader_path
+endif
libgdruntime_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../src,-Bgcc \
- -version-info $(libtool_VERSION)
+ -version-info $(libtool_VERSION) $(libgdruntime_darwin_rpath)
libgdruntime_la_LIBADD = $(LIBATOMIC) $(LIBBACKTRACE)
libgdruntime_la_DEPENDENCIES = $(DRTSTUFF)
# Also override library link commands: This is not strictly
diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in
index 61a2a770888..4d62985349b 100644
--- a/libphobos/libdruntime/Makefile.in
+++ b/libphobos/libdruntime/Makefile.in
@@ -813,8 +813,9 @@ ALL_DRUNTIME_SOURCES = $(DRUNTIME_DSOURCES) $(DRUNTIME_CSOURCES) \
toolexeclib_LTLIBRARIES = libgdruntime.la
libgdruntime_la_SOURCES = $(ALL_DRUNTIME_SOURCES)
libgdruntime_la_LIBTOOLFLAGS =
+@ENABLE_DARWIN_AT_RPATH_TRUE@libgdruntime_darwin_rpath = -Wl,-rpath,@loader_path
libgdruntime_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../src,-Bgcc \
- -version-info $(libtool_VERSION)
+ -version-info $(libtool_VERSION) $(libgdruntime_darwin_rpath)
libgdruntime_la_LIBADD = $(LIBATOMIC) $(LIBBACKTRACE)
libgdruntime_la_DEPENDENCIES = $(DRTSTUFF)
diff --git a/libphobos/src/Makefile.am b/libphobos/src/Makefile.am
index 6474fca5eb5..f6521ed5860 100644
--- a/libphobos/src/Makefile.am
+++ b/libphobos/src/Makefile.am
@@ -44,8 +44,11 @@ toolexeclib_DATA = libgphobos.spec
toolexeclib_LTLIBRARIES = libgphobos.la
libgphobos_la_SOURCES = $(ALL_PHOBOS_SOURCES)
libgphobos_la_LIBTOOLFLAGS =
+if ENABLE_DARWIN_AT_RPATH
+libgphobos_darwin_rpath = -Wl,-rpath,@loader_path
+endif
libgphobos_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../libdruntime/gcc \
- -version-info $(libtool_VERSION)
+ -version-info $(libtool_VERSION) $(libgphobos_darwin_rpath)
if ENABLE_LIBDRUNTIME_ONLY
libgphobos_la_LIBADD = ../libdruntime/libgdruntime_convenience.la
else
diff --git a/libphobos/src/Makefile.in b/libphobos/src/Makefile.in
index a6229587e7b..cc3358b437e 100644
--- a/libphobos/src/Makefile.in
+++ b/libphobos/src/Makefile.in
@@ -529,8 +529,9 @@ toolexeclib_DATA = libgphobos.spec
toolexeclib_LTLIBRARIES = libgphobos.la
libgphobos_la_SOURCES = $(ALL_PHOBOS_SOURCES)
libgphobos_la_LIBTOOLFLAGS =
+@ENABLE_DARWIN_AT_RPATH_TRUE@libgphobos_darwin_rpath = -Wl,-rpath,@loader_path
libgphobos_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../libdruntime/gcc \
- -version-info $(libtool_VERSION)
+ -version-info $(libtool_VERSION) $(libgphobos_darwin_rpath)
@ENABLE_LIBDRUNTIME_ONLY_FALSE@libgphobos_la_LIBADD = \
@ENABLE_LIBDRUNTIME_ONLY_FALSE@ ../libdruntime/libgdruntime_convenience.la $(LIBZ)
diff --git a/libquadmath/Makefile.am b/libquadmath/Makefile.am
index 35dffb46f6e..0d02c95e738 100644
--- a/libquadmath/Makefile.am
+++ b/libquadmath/Makefile.am
@@ -36,8 +36,13 @@ endif
toolexeclib_LTLIBRARIES = libquadmath.la
libquadmath_la_LIBADD =
+
+if ENABLE_DARWIN_AT_RPATH
+libquadmath_darwin_rpath = -Wc,-nodefaultrpaths
+libquadmath_darwin_rpath += -Wl,-rpath,@loader_path
+endif
libquadmath_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
- $(version_arg) $(lt_host_flags) -lm
+ $(version_arg) $(lt_host_flags) $(LIBM) $(libquadmath_darwin_rpath)
libquadmath_la_DEPENDENCIES = $(version_dep) $(libquadmath_la_LIBADD)
nodist_libsubinclude_HEADERS = quadmath.h quadmath_weak.h
diff --git a/libquadmath/Makefile.in b/libquadmath/Makefile.in
index 8c011212258..068af559457 100644
--- a/libquadmath/Makefile.in
+++ b/libquadmath/Makefile.in
@@ -355,6 +355,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
+LIBM = @LIBM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
@@ -463,8 +464,10 @@ AUTOMAKE_OPTIONS = foreign info-in-builddir
@BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_SUN_TRUE@@LIBQUAD_USE_SYMVER_TRUE@version_dep = quadmath.map-sun
@BUILD_LIBQUADMATH_TRUE@toolexeclib_LTLIBRARIES = libquadmath.la
@BUILD_LIBQUADMATH_TRUE@libquadmath_la_LIBADD =
+@BUILD_LIBQUADMATH_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@libquadmath_darwin_rpath = -Wc,-nodefaultrpaths \
+@BUILD_LIBQUADMATH_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
@BUILD_LIBQUADMATH_TRUE@libquadmath_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
-@BUILD_LIBQUADMATH_TRUE@ $(version_arg) $(lt_host_flags) -lm
+@BUILD_LIBQUADMATH_TRUE@ $(version_arg) $(lt_host_flags) $(LIBM) $(libquadmath_darwin_rpath)
@BUILD_LIBQUADMATH_TRUE@libquadmath_la_DEPENDENCIES = $(version_dep) $(libquadmath_la_LIBADD)
@BUILD_LIBQUADMATH_TRUE@nodist_libsubinclude_HEADERS = quadmath.h quadmath_weak.h
diff --git a/libquadmath/configure b/libquadmath/configure
index 0b145a644c3..5bd9a070fdc 100755
--- a/libquadmath/configure
+++ b/libquadmath/configure
@@ -644,11 +644,14 @@ LIBQUAD_USE_SYMVER_GNU_FALSE
LIBQUAD_USE_SYMVER_GNU_TRUE
LIBQUAD_USE_SYMVER_FALSE
LIBQUAD_USE_SYMVER_TRUE
+LIBM
toolexeclibdir
toolexecdir
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -785,6 +788,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
with_toolexeclibdir
enable_symvers
@@ -1435,6 +1439,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -7310,7 +7317,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9022,6 +9029,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9039,9 +9089,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -10868,7 +10922,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10871 "configure"
+#line 10925 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10974,7 +11028,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10977 "configure"
+#line 11031 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11235,6 +11289,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
@@ -12199,6 +12261,148 @@ esac
+LIBM=
+case $host in
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+ # These system don't have libm, or don't need it
+ ;;
+*-ncr-sysv4.3*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mwvalidcheckl in -lmw" >&5
+$as_echo_n "checking for _mwvalidcheckl in -lmw... " >&6; }
+if ${ac_cv_lib_mw__mwvalidcheckl+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lmw $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char _mwvalidcheckl ();
+int
+main ()
+{
+return _mwvalidcheckl ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_mw__mwvalidcheckl=yes
+else
+ ac_cv_lib_mw__mwvalidcheckl=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mw__mwvalidcheckl" >&5
+$as_echo "$ac_cv_lib_mw__mwvalidcheckl" >&6; }
+if test "x$ac_cv_lib_mw__mwvalidcheckl" = xyes; then :
+ LIBM="-lmw"
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
+$as_echo_n "checking for cos in -lm... " >&6; }
+if ${ac_cv_lib_m_cos+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char cos ();
+int
+main ()
+{
+return cos ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_cos=yes
+else
+ ac_cv_lib_m_cos=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
+$as_echo "$ac_cv_lib_m_cos" >&6; }
+if test "x$ac_cv_lib_m_cos" = xyes; then :
+ LIBM="$LIBM -lm"
+fi
+
+ ;;
+*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
+$as_echo_n "checking for cos in -lm... " >&6; }
+if ${ac_cv_lib_m_cos+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char cos ();
+int
+main ()
+{
+return cos ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_cos=yes
+else
+ ac_cv_lib_m_cos=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
+$as_echo "$ac_cv_lib_m_cos" >&6; }
+if test "x$ac_cv_lib_m_cos" = xyes; then :
+ LIBM="-lm"
+fi
+
+ ;;
+esac
+
+
+
for ac_header in fenv.h langinfo.h locale.h wchar.h wctype.h limits.h ctype.h printf.h errno.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
@@ -13459,6 +13663,10 @@ if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then
as_fn_error $? "conditional \"BUILD_INFO\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libquadmath/configure.ac b/libquadmath/configure.ac
index eec4084a45f..94a3f2179e9 100644
--- a/libquadmath/configure.ac
+++ b/libquadmath/configure.ac
@@ -59,6 +59,7 @@ AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
AM_MAINTAINER_MODE
@@ -121,6 +122,8 @@ esac
AC_SUBST(toolexecdir)
AC_SUBST(toolexeclibdir)
+AC_CHECK_LIBM
+
AC_CHECK_HEADERS(fenv.h langinfo.h locale.h wchar.h wctype.h limits.h ctype.h printf.h errno.h)
LIBQUAD_CHECK_MATH_H_SIGNGAM
diff --git a/libsanitizer/asan/Makefile.am b/libsanitizer/asan/Makefile.am
index 4f802f723d6..223d3e07816 100644
--- a/libsanitizer/asan/Makefile.am
+++ b/libsanitizer/asan/Makefile.am
@@ -60,7 +60,12 @@ libasan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
libasan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libasan)
+if ENABLE_DARWIN_AT_RPATH
+libasan_darwin_rpath = -Wc,-nodefaultrpaths
+libasan_darwin_rpath += -Wl,-rpath,@loader_path
+endif
+libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libasan) $(libasan_darwin_rpath)
libasan_preinit.o: asan_preinit.o
cp $< $@
diff --git a/libsanitizer/asan/Makefile.in b/libsanitizer/asan/Makefile.in
index 7833a9a4c3f..e88e5e0b0a7 100644
--- a/libsanitizer/asan/Makefile.in
+++ b/libsanitizer/asan/Makefile.in
@@ -465,7 +465,12 @@ libasan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(top_builddir)/lsan/libsanitizer_lsan.la $(am__append_2) \
$(am__append_3) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libasan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libasan_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libasan) $(libasan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
diff --git a/libsanitizer/configure b/libsanitizer/configure
index 0805d254fe5..2edd5c37ce7 100755
--- a/libsanitizer/configure
+++ b/libsanitizer/configure
@@ -666,6 +666,8 @@ LSAN_SUPPORTED_FALSE
LSAN_SUPPORTED_TRUE
TSAN_SUPPORTED_FALSE
TSAN_SUPPORTED_TRUE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
CXXCPP
@@ -817,6 +819,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_werror
with_gcc_major_version_only
enable_cet
@@ -1471,6 +1474,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--disable-werror disable building with -Werror
--enable-cet enable Intel CET in target libraries [default=auto]
@@ -8891,7 +8897,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10596,6 +10602,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10613,9 +10662,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12421,7 +12474,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12424 "configure"
+#line 12477 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12527,7 +12580,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12530 "configure"
+#line 12583 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13403,6 +13456,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13420,12 +13516,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15845,6 +15949,15 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
@@ -17243,6 +17356,10 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${TSAN_SUPPORTED_TRUE}" && test -z "${TSAN_SUPPORTED_FALSE}"; then
as_fn_error $? "conditional \"TSAN_SUPPORTED\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libsanitizer/configure.ac b/libsanitizer/configure.ac
index 04cd8910ed6..5906c8d4887 100644
--- a/libsanitizer/configure.ac
+++ b/libsanitizer/configure.ac
@@ -85,6 +85,8 @@ esac
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
AC_CHECK_SIZEOF([void *])
if test "${multilib}" = "yes"; then
diff --git a/libsanitizer/hwasan/Makefile.am b/libsanitizer/hwasan/Makefile.am
index bb7f8fa0b7b..653fc8c4720 100644
--- a/libsanitizer/hwasan/Makefile.am
+++ b/libsanitizer/hwasan/Makefile.am
@@ -47,7 +47,11 @@ libhwasan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
libhwasan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libhwasan)
+if ENABLE_DARWIN_AT_RPATH
+libhwasan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
+libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libhwasan) $(libhwasan_darwin_rpath)
libhwasan_preinit.o: hwasan_preinit.o
cp $< $@
diff --git a/libsanitizer/hwasan/Makefile.in b/libsanitizer/hwasan/Makefile.in
index 58bc26b44b9..87971fd3374 100644
--- a/libsanitizer/hwasan/Makefile.in
+++ b/libsanitizer/hwasan/Makefile.in
@@ -447,7 +447,10 @@ libhwasan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(top_builddir)/lsan/libsanitizer_lsan.la $(am__append_1) \
$(am__append_2) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libhwasan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libhwasan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/
+libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libhwasan) $(libhwasan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
diff --git a/libsanitizer/lsan/Makefile.am b/libsanitizer/lsan/Makefile.am
index 6ff28ff5eea..7701b0e18cf 100644
--- a/libsanitizer/lsan/Makefile.am
+++ b/libsanitizer/lsan/Makefile.am
@@ -41,8 +41,12 @@ if LIBBACKTRACE_SUPPORTED
liblsan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
liblsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_liblsan)
-
+if ENABLE_DARWIN_AT_RPATH
+liblsan_darwin_rpath = -Wc,-nodefaultrpaths
+liblsan_darwin_rpath += -Wl,-rpath,@loader_path
+endif
+liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_liblsan) $(liblsan_darwin_rpath)
liblsan_preinit.o: lsan_preinit.o
cp $< $@
diff --git a/libsanitizer/lsan/Makefile.in b/libsanitizer/lsan/Makefile.in
index d8fd4ee9557..078edf01fda 100644
--- a/libsanitizer/lsan/Makefile.in
+++ b/libsanitizer/lsan/Makefile.in
@@ -413,7 +413,12 @@ liblsan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(top_builddir)/interception/libinterception.la \
$(am__append_1) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_liblsan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@liblsan_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_liblsan) $(liblsan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
@@ -788,7 +793,6 @@ uninstall-am: uninstall-nodist_toolexeclibHEADERS \
.PRECIOUS: Makefile
-
liblsan_preinit.o: lsan_preinit.o
cp $< $@
diff --git a/libsanitizer/tsan/Makefile.am b/libsanitizer/tsan/Makefile.am
index da80743da9d..01290b0313d 100644
--- a/libsanitizer/tsan/Makefile.am
+++ b/libsanitizer/tsan/Makefile.am
@@ -57,7 +57,11 @@ libtsan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
libtsan_la_DEPENDENCIES +=$(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
libtsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libtsan)
+if ENABLE_DARWIN_AT_RPATH
+libtsan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
+libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libtsan) $(libtsan_darwin_rpath)
libtsan_preinit.o: tsan_preinit.o
cp $< $@
diff --git a/libsanitizer/tsan/Makefile.in b/libsanitizer/tsan/Makefile.in
index 36498832bb8..95011584bcb 100644
--- a/libsanitizer/tsan/Makefile.in
+++ b/libsanitizer/tsan/Makefile.in
@@ -464,7 +464,10 @@ libtsan_la_DEPENDENCIES = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(top_builddir)/interception/libinterception.la \
$(TSAN_TARGET_DEPENDENT_OBJECTS) $(am__append_2)
-libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libtsan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libtsan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/
+libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libtsan) $(libtsan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
diff --git a/libsanitizer/ubsan/Makefile.am b/libsanitizer/ubsan/Makefile.am
index d480f26adc0..7769b3437e4 100644
--- a/libsanitizer/ubsan/Makefile.am
+++ b/libsanitizer/ubsan/Makefile.am
@@ -36,7 +36,12 @@ if LIBBACKTRACE_SUPPORTED
libubsan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
libubsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libubsan)
+if ENABLE_DARWIN_AT_RPATH
+libubsan_darwin_rpath = -Wc,-nodefaultrpaths
+libubsan_darwin_rpath += -Wl,-rpath,@loader_path
+endif
+libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libubsan) $(libubsan_darwin_rpath)
# Use special rules for files that require RTTI support.
ubsan_handlers_cxx.% ubsan_type_hash.% ubsan_type_hash_itanium.% : AM_CXXFLAGS += -frtti
diff --git a/libsanitizer/ubsan/Makefile.in b/libsanitizer/ubsan/Makefile.in
index 92a8e387fd7..7e51480e970 100644
--- a/libsanitizer/ubsan/Makefile.in
+++ b/libsanitizer/ubsan/Makefile.in
@@ -400,7 +400,12 @@ libubsan_la_SOURCES = $(ubsan_files)
libubsan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(am__append_1) $(am__append_2) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libubsan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libubsan_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libubsan) $(libubsan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
diff --git a/libssp/Makefile.am b/libssp/Makefile.am
index 1636e43b369..f7ed2aa6043 100644
--- a/libssp/Makefile.am
+++ b/libssp/Makefile.am
@@ -49,8 +49,12 @@ libssp_la_SOURCES = \
vsnprintf-chk.c vsprintf-chk.c
libssp_la_LIBADD =
libssp_la_DEPENDENCIES = $(version_dep) $(libssp_la_LIBADD)
+if ENABLE_DARWIN_AT_RPATH
+libssp_darwin_rpath = -Wc,-nodefaultrpaths
+libssp_darwin_rpath += -Wl,-rpath,@loader_path
+endif
libssp_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
- $(version_arg) $(lt_host_flags)
+ $(version_arg) $(lt_host_flags) $(libssp_darwin_rpath)
libssp_nonshared_la_SOURCES = \
ssp-local.c
diff --git a/libssp/Makefile.in b/libssp/Makefile.in
index bc8a0dc2b28..1cf86361b96 100644
--- a/libssp/Makefile.in
+++ b/libssp/Makefile.in
@@ -376,8 +376,11 @@ libssp_la_SOURCES = \
libssp_la_LIBADD =
libssp_la_DEPENDENCIES = $(version_dep) $(libssp_la_LIBADD)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libssp_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
libssp_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
- $(version_arg) $(lt_host_flags)
+ $(version_arg) $(lt_host_flags) $(libssp_darwin_rpath)
libssp_nonshared_la_SOURCES = \
ssp-local.c
diff --git a/libssp/configure b/libssp/configure
index 7f8b8fdf99d..a31b69f306e 100755
--- a/libssp/configure
+++ b/libssp/configure
@@ -636,6 +636,8 @@ LIBOBJS
get_gcc_base_ver
toolexeclibdir
toolexecdir
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -781,6 +783,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
with_toolexeclibdir
with_gcc_major_version_only
'
@@ -1426,6 +1429,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -7496,7 +7502,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9208,6 +9214,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9225,9 +9274,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11054,7 +11107,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11057 "configure"
+#line 11110 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11160,7 +11213,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11163 "configure"
+#line 11216 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11438,6 +11491,15 @@ fi
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# Calculate toolexeclibdir
# Also toolexecdir, though it's only used in toolexeclibdir
case ${version_specific_libs} in
@@ -11647,6 +11709,10 @@ if test -z "${LIBSSP_USE_SYMVER_SUN_TRUE}" && test -z "${LIBSSP_USE_SYMVER_SUN_F
as_fn_error $? "conditional \"LIBSSP_USE_SYMVER_SUN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/libssp/configure.ac b/libssp/configure.ac
index f30f81c54f6..90778e2355d 100644
--- a/libssp/configure.ac
+++ b/libssp/configure.ac
@@ -165,6 +165,8 @@ AC_SUBST(enable_static)
GCC_WITH_TOOLEXECLIBDIR
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
# Calculate toolexeclibdir
# Also toolexecdir, though it's only used in toolexeclibdir
case ${version_specific_libs} in
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index c4da56c3042..b2b121a0936 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -789,6 +789,8 @@ GLIBCXX_HOSTED_TRUE
glibcxx_compiler_shared_flag
glibcxx_compiler_pic_flag
glibcxx_lt_pic_flag
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -924,6 +926,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_hosted_libstdcxx
enable_libstdcxx_hosted
enable_libstdcxx_verbose
@@ -1615,6 +1618,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--disable-hosted-libstdcxx
only build freestanding C++ runtime support
--disable-libstdcxx-hosted
@@ -8539,7 +8545,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10379,6 +10385,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10396,9 +10445,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12225,7 +12278,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12228 "configure"
+#line 12281 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12331,7 +12384,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12334 "configure"
+#line 12387 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13213,6 +13266,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13230,12 +13326,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15632,6 +15736,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
if test "$enable_vtable_verify" = yes; then
predep_objects_CXX="${predep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_start.o"
@@ -16055,7 +16167,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; }
# Fake what AC_TRY_COMPILE does.
cat > conftest.$ac_ext << EOF
-#line 16058 "configure"
+#line 16170 "configure"
int main()
{
typedef bool atomic_type;
@@ -16090,7 +16202,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16093 "configure"
+#line 16205 "configure"
int main()
{
typedef short atomic_type;
@@ -16125,7 +16237,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16128 "configure"
+#line 16240 "configure"
int main()
{
// NB: _Atomic_word not necessarily int.
@@ -16161,7 +16273,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16164 "configure"
+#line 16276 "configure"
int main()
{
typedef long long atomic_type;
@@ -16317,7 +16429,7 @@ $as_echo "mutex" >&6; }
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 16320 "configure"
+#line 16432 "configure"
int main()
{
_Decimal32 d1;
@@ -16359,7 +16471,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 16362 "configure"
+#line 16474 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
@@ -74906,6 +75018,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${GLIBCXX_HOSTED_TRUE}" && test -z "${GLIBCXX_HOSTED_FALSE}"; then
as_fn_error $? "conditional \"GLIBCXX_HOSTED\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index fc0f2522027..80e573e690f 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -108,6 +108,7 @@ AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
if test "$enable_vtable_verify" = yes; then
predep_objects_CXX="${predep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_start.o"
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index 5b9af41cdb9..925137c2ccc 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -152,8 +152,13 @@ libstdc___la_DEPENDENCIES = \
$(top_builddir)/src/c++17/libc++17convenience.la \
$(top_builddir)/src/c++20/libc++20convenience.la
+if ENABLE_DARWIN_AT_RPATH
+libstdc___darwin_rpath = -Wc,-nodefaultrpaths
+libstdc___darwin_rpath += -Wl,-rpath,@loader_path
+endif
+
libstdc___la_LDFLAGS = \
- -version-info $(libtool_VERSION) ${version_arg} -lm
+ -version-info $(libtool_VERSION) ${version_arg} -lm $(libstdc___darwin_rpath)
libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) $(lt_host_flags)
diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
index f42d957af36..0ce75f30708 100644
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -560,8 +560,11 @@ libstdc___la_DEPENDENCIES = \
$(top_builddir)/src/c++17/libc++17convenience.la \
$(top_builddir)/src/c++20/libc++20convenience.la
+@ENABLE_DARWIN_AT_RPATH_TRUE@libstdc___darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
libstdc___la_LDFLAGS = \
- -version-info $(libtool_VERSION) ${version_arg} -lm
+ -version-info $(libtool_VERSION) ${version_arg} -lm $(libstdc___darwin_rpath)
libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) $(lt_host_flags)
@GLIBCXX_LDBL_ALT128_COMPAT_FALSE@@GLIBCXX_LDBL_COMPAT_TRUE@LTCXXCOMPILE64 = $(LTCXXCOMPILE)
diff --git a/libtool.m4 b/libtool.m4
index e36fdd3c0e2..7f8ae26db62 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -1005,7 +1005,7 @@ _LT_EOF
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[[89]]*|UNSET,*-darwin[[12]][[0123456789]]*)
+ UNSET,*-darwin[[89]]*|UNSET,*-darwin[[12]][[0-9]]*)
;;
10.[[012]][[,.]]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -1039,6 +1039,45 @@ _LT_EOF
m4_defun([_LT_DARWIN_LINKER_FEATURES],
[
m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ AC_ARG_ENABLE([darwin-at-rpath],
+ AS_HELP_STRING([--enable-darwin-at-rpath],
+ [install libraries with @rpath/library-name, requires rpaths to be added to executables]),
+ [if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[[4-8]]*|UNSET,rhapsody*|10.[[0-4]][[,.]]*)
+ AC_MSG_WARN([Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)])
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi],
+ [case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[[4-8]]*|UNSET,rhapsody*|10.[[0-4]][[,.]]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[[5-9]]*|UNSET,darwin2*|10.1[[1-9]][[,.]]*|1[[1-9]].*[[,.]]* )
+ AC_MSG_NOTICE([@rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)])
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+ ])
+
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_automatic, $1)=yes
@@ -1056,13 +1095,21 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
_LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
_LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
m4_if([$1], [CXX],
[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
_LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
],[])
@@ -4265,6 +4312,7 @@ _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
[Compiler flag to prevent dynamic linking])
])# _LT_COMPILER_PIC
+_LT_TAGVAR(enable_darwin_at_rpath, $1)=no
# _LT_LINKER_SHLIBS([TAGNAME])
# ----------------------------
@@ -6504,7 +6552,6 @@ fi # test "$_lt_caught_CXX_error" != yes
AC_LANG_POP
])# _LT_LANG_CXX_CONFIG
-
# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
# ---------------------------------
# Figure out "hidden" library dependencies from verbose
diff --git a/libvtv/configure b/libvtv/configure
index 917557103e9..a7889161c50 100755
--- a/libvtv/configure
+++ b/libvtv/configure
@@ -640,6 +640,8 @@ VTV_CYGMIN_FALSE
VTV_CYGMIN_TRUE
XCFLAGS
libtool_VERSION
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -797,6 +799,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_cet
with_gcc_major_version_only
'
@@ -1446,6 +1449,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-cet enable Intel CET in target libraries [default=auto]
Optional Packages:
@@ -8786,7 +8792,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10491,6 +10497,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10508,9 +10557,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12316,7 +12369,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12319 "configure"
+#line 12372 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12422,7 +12475,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12425 "configure"
+#line 12478 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13298,6 +13351,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13315,12 +13411,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15714,6 +15818,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=1:0:0
@@ -16059,6 +16171,10 @@ if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${VTV_CYGMIN_TRUE}" && test -z "${VTV_CYGMIN_FALSE}"; then
as_fn_error $? "conditional \"VTV_CYGMIN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libvtv/configure.ac b/libvtv/configure.ac
index f3b937e4b10..50aaadbb3a3 100644
--- a/libvtv/configure.ac
+++ b/libvtv/configure.ac
@@ -153,6 +153,7 @@ AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=1:0:0
diff --git a/lto-plugin/configure b/lto-plugin/configure
index 37c44d04a0d..28f5dd79cd7 100755
--- a/lto-plugin/configure
+++ b/lto-plugin/configure
@@ -634,6 +634,8 @@ LTLIBOBJS
LIBOBJS
target_noncanonical
lt_host_flags
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
OTOOL64
OTOOL
LIPO
@@ -788,6 +790,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
'
ac_precious_vars='build_alias
host_alias
@@ -1434,6 +1437,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -8657,7 +8663,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10363,6 +10369,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10380,9 +10429,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12188,7 +12241,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12191 "configure"
+#line 12244 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12294,7 +12347,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12297 "configure"
+#line 12350 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12531,6 +12584,14 @@ CC="$lt_save_CC"
# Only expand once:
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
@@ -12777,6 +12838,10 @@ if test -z "${LTO_PLUGIN_USE_SYMVER_SUN_TRUE}" && test -z "${LTO_PLUGIN_USE_SYMV
as_fn_error $? "conditional \"LTO_PLUGIN_USE_SYMVER_SUN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/lto-plugin/configure.ac b/lto-plugin/configure.ac
index 84f2a60b480..c051b8c6283 100644
--- a/lto-plugin/configure.ac
+++ b/lto-plugin/configure.ac
@@ -121,6 +121,7 @@ fi
AC_SUBST(ac_lto_plugin_extra_ldflags)
AM_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
ACX_LT_HOST_FLAGS
AC_SUBST(target_noncanonical)
AC_TYPE_INT64_T
diff --git a/zlib/configure b/zlib/configure
index 273ac36647d..92c462d04c6 100755
--- a/zlib/configure
+++ b/zlib/configure
@@ -641,6 +641,8 @@ TARGET_LIBRARY_FALSE
TARGET_LIBRARY_TRUE
toolexeclibdir
toolexecdir
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
CPP
OTOOL64
OTOOL
@@ -778,6 +780,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
with_toolexeclibdir
enable_host_shared
enable_host_pie
@@ -1422,6 +1425,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-host-shared build host code as shared libraries
--enable-host-pie build host code as PIE
@@ -6976,7 +6982,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -8955,6 +8961,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -8972,9 +9021,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -10801,7 +10854,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10804 "configure"
+#line 10857 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10907,7 +10960,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10910 "configure"
+#line 10963 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11144,6 +11197,14 @@ CC="$lt_save_CC"
# Only expand once:
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
# Find CPP now so that any conditional tests below won't do it and
# thereby make the resulting definitions conditional.
@@ -11790,6 +11851,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${TARGET_LIBRARY_TRUE}" && test -z "${TARGET_LIBRARY_FALSE}"; then
as_fn_error $? "conditional \"TARGET_LIBRARY\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/zlib/configure.ac b/zlib/configure.ac
index adf7aad4e51..9501cdfea85 100644
--- a/zlib/configure.ac
+++ b/zlib/configure.ac
@@ -64,6 +64,7 @@ GCC_CET_FLAGS(CET_FLAGS)
AC_SUBST(CET_FLAGS)
AC_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
# Find CPP now so that any conditional tests below won't do it and
# thereby make the resulting definitions conditional.
--
2.39.2 (Apple Git-143)
[-- Attachment #4: 0003-Darwin-rpaths-Add-with-darwin-extra-rpath.patch --]
[-- Type: application/octet-stream, Size: 6093 bytes --]
From 2348525bb5fb18d486ad0738fd7939fca26df797 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Sat, 28 May 2022 10:16:27 +0100
Subject: [PATCH 3/5] Darwin, rpaths: Add --with-darwin-extra-rpath.
This is provided to allow distributions to add a single additional
runpath to allow for cases where the installed GCC library directories
are then symlinked to a common dirctory outside of any of the GCC
installations.
For example:
/opt/distro/lib:
libgfortran.dylib -> /opt/distro/lib/gcc-11.3/lib/libgfortran.dylib
So that libraries which are designed to be found in the runpath we would then
add --with-darwin-add-rpath=/opt/distro/lib to the configure line.
This patch makes the configuration a little more forgiving of using
--disable-darwin-at-rpath (although for platform versions >= 10.11 this will
result in misconfigured target libraries).
gcc/ChangeLog:
* configure.ac: Add --with-darwin-extra-rpath option.
* config/darwin.h: Handle DARWIN_EXTRA_RPATH.
* config.in: Regenerate.
* configure: Regenerate.
---
gcc/config.in | 13 +++++++++++++
gcc/config/darwin.h | 14 ++++++++++++++
gcc/configure | 28 ++++++++++++++++++++++++++--
gcc/configure.ac | 13 +++++++++++++
4 files changed, 66 insertions(+), 2 deletions(-)
diff --git a/gcc/config.in b/gcc/config.in
index 5cf51bc1b01..9bda18ab64b 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -49,6 +49,19 @@
#endif
+/* Specify a runpath directory, additional to those provided by the compiler
+ */
+#ifndef USED_FOR_TARGET
+#undef DARWIN_ADD_RPATH
+#endif
+
+
+/* Should add an extra runpath directory */
+#ifndef USED_FOR_TARGET
+#undef DARWIN_DO_EXTRA_RPATH
+#endif
+
+
/* Define to enable the use of a default assembler. */
#ifndef USED_FOR_TARGET
#undef DEFAULT_ASSEMBLER
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 1b6920f4c92..ede8c1d8dbb 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -321,6 +321,19 @@ extern GTY(()) int darwin_ms_struct;
%:version-compare(>= 10.11 mmacosx-version-min= -lemutls_w) "
#endif
+/* We might elect to add a path even when this compiler does not use embedded
+ run paths, so that we can use libraries from an alternate compiler that is
+ using embedded runpaths. */
+#if DARWIN_DO_EXTRA_RPATH
+# define DARWIN_EXTRA_RPATH \
+"%{!r:%{!nostdlib:%{!nodefaultrpaths:\
+ %:version-compare(>= 10.5 mmacosx-version-min= -rpath) \
+ %:version-compare(>= 10.5 mmacosx-version-min= " DARWIN_ADD_RPATH ") \
+ }}}"
+#else
+# define DARWIN_EXTRA_RPATH ""
+#endif
+
#define SUBSUBTARGET_OVERRIDE_OPTIONS \
do { \
darwin_override_options (); \
@@ -415,6 +428,7 @@ extern GTY(()) int darwin_ms_struct;
DARWIN_NOPIE_SPEC \
DARWIN_RDYNAMIC \
DARWIN_NOCOMPACT_UNWIND \
+ DARWIN_EXTRA_RPATH \
DARWIN_RPATH_LINK \
"}}}}}}} %<pie %<no-pie %<rdynamic %<X %<rpath %<nodefaultrpaths "
diff --git a/gcc/configure b/gcc/configure
index eaa1a189583..13472fcfc3c 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1009,6 +1009,7 @@ with_pic
enable_fast_install
enable_libtool_lock
enable_darwin_at_rpath
+with_darwin_extra_rpath
enable_ld
enable_gold
with_plugin_ld
@@ -1870,6 +1871,9 @@ Optional Packages:
--with-pic try to use only PIC/non-PIC objects [default=use
both]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
+ --with-darwin-extra-rpath=[ARG]
+ Specify a runpath directory, additional to those
+ provided by the compiler
--with-plugin-ld=[ARG] specify the plugin linker
--with-glibc-version=M.N
assume GCC used with glibc version M.N or later
@@ -19939,7 +19943,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19942 "configure"
+#line 19946 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -20045,7 +20049,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 20048 "configure"
+#line 20052 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -23373,6 +23377,26 @@ else
ENABLE_DARWIN_AT_RPATH_FALSE=
fi
+DARWIN_DO_EXTRA_RPATH=0
+
+# Check whether --with-darwin-extra-rpath was given.
+if test "${with_darwin_extra_rpath+set}" = set; then :
+ withval=$with_darwin_extra_rpath; if test x"$withval" != x; then
+ DARWIN_ADD_RPATH="$withval"
+ DARWIN_DO_EXTRA_RPATH=1
+ fi
+fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define DARWIN_DO_EXTRA_RPATH $DARWIN_DO_EXTRA_RPATH
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define DARWIN_ADD_RPATH "$DARWIN_ADD_RPATH"
+_ACEOF
+
# Identify the assembler which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the assembler
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 80e31229408..84175a5d7ce 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2600,6 +2600,19 @@ AC_SUBST(objdir)
AC_SUBST(enable_fast_install)
AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+DARWIN_DO_EXTRA_RPATH=0
+AC_ARG_WITH(darwin-extra-rpath,
+[AS_HELP_STRING(
+ [[--with-darwin-extra-rpath=[ARG]]],
+ [Specify a runpath directory, additional to those provided by the compiler])],
+[if test x"$withval" != x; then
+ DARWIN_ADD_RPATH="$withval"
+ DARWIN_DO_EXTRA_RPATH=1
+ fi])
+AC_DEFINE_UNQUOTED(DARWIN_DO_EXTRA_RPATH, $DARWIN_DO_EXTRA_RPATH,
+ [Should add an extra runpath directory])
+AC_DEFINE_UNQUOTED(DARWIN_ADD_RPATH, "$DARWIN_ADD_RPATH",
+ [Specify a runpath directory, additional to those provided by the compiler])
# Identify the assembler which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the assembler
--
2.39.2 (Apple Git-143)
[-- Attachment #5: 0004-Testsuite-allow-non-installed-testing-on-darwin.patch --]
[-- Type: application/octet-stream, Size: 12763 bytes --]
From 0415173d58e7df3683dbd92d5d92003c8200a4b0 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Fri, 16 Apr 2021 20:01:40 +0100
Subject: [PATCH 4/5] Testsuite: allow non-installed testing on darwin
DYLD_LIBRARY_PATH is now removed from the environment for all system
tools, including the shell. Adapt the testsuite and pass the right
options to allow testing, even when the compiler and libraries have not
been installed.
gcc/ChangeLog:
* Makefile.in: set ENABLE_DARWIN_AT_RPATH in site.tmp.
gcc/testsuite/ChangeLog:
* gfortran.dg/coarray/caf.exp: Correctly set
libatomic flags.
* gfortran.dg/dg.exp: Likewise.
* lib/asan-dg.exp: Set correct -B flags.
* lib/atomic-dg.exp: Likewise.
* lib/target-libpath.exp: Handle ENABLE_DARWIN_AT_RPATH.
libatomic/ChangeLog:
* testsuite/lib/libatomic.exp: Pass correct flags on darwin.
libffi/ChangeLog:
* testsuite/lib/libffi.exp: Likewise.
libitm/ChangeLog:
* testsuite/lib/libitm.exp: Likewise.
* testsuite/libitm.c++/c++.exp: Likewise.
---
gcc/Makefile.in | 3 +++
gcc/testsuite/gfortran.dg/coarray/caf.exp | 16 +++++++++---
gcc/testsuite/gfortran.dg/dg.exp | 32 ++++++++++++++++++++---
gcc/testsuite/lib/asan-dg.exp | 2 +-
gcc/testsuite/lib/atomic-dg.exp | 2 +-
gcc/testsuite/lib/target-libpath.exp | 23 +++++++++++++---
libatomic/testsuite/lib/libatomic.exp | 8 ++++--
libffi/testsuite/lib/libffi.exp | 11 +++++---
libitm/testsuite/lib/libitm.exp | 1 +
libitm/testsuite/libitm.c++/c++.exp | 4 ++-
10 files changed, 84 insertions(+), 18 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 60ba2916457..023dba2159c 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -4209,6 +4209,9 @@ site.exp: ./config.status Makefile
echo "set COMPAT_OPTIONS \"$(COMPAT_OPTIONS)\"" >> ./site.tmp; \
else true; \
fi
+ @if test "x@enable_darwin_at_rpath@" = "xyes" ; then \
+ echo "set ENABLE_DARWIN_AT_RPATH 1" >> ./site.tmp; \
+ fi
@echo "## All variables above are generated by configure. Do Not Edit ##" >> ./site.tmp
@cat ./site.tmp > site.exp
@cat site.bak | sed \
diff --git a/gcc/testsuite/gfortran.dg/coarray/caf.exp b/gcc/testsuite/gfortran.dg/coarray/caf.exp
index d232be2fa90..a10b17a78d0 100644
--- a/gcc/testsuite/gfortran.dg/coarray/caf.exp
+++ b/gcc/testsuite/gfortran.dg/coarray/caf.exp
@@ -28,6 +28,7 @@
# Load procedures from common libraries.
load_lib gfortran-dg.exp
+load_lib atomic-dg.exp
# If a testcase doesn't have special options, use these.
global DEFAULT_FFLAGS
@@ -47,6 +48,7 @@ global gfortran_test_path
global gfortran_aux_module_flags
set gfortran_test_path $srcdir/$subdir
set gfortran_aux_module_flags $DEFAULT_FFLAGS
+
proc dg-compile-aux-modules { args } {
global gfortran_test_path
global gfortran_aux_module_flags
@@ -71,7 +73,15 @@ proc dg-compile-aux-modules { args } {
# Add -latomic only where supported. Assume built-in support elsewhere.
set maybe_atomic_lib ""
if [check_effective_target_libatomic_available] {
- set maybe_atomic_lib "-latomic"
+ if ![is_remote host] {
+ if [info exists TOOL_OPTIONS] {
+ set maybe_atomic_lib "[atomic_link_flags [get_multilibs ${TOOL_OPTIONS}]]"
+ } else {
+ set maybe_atomic_lib "[atomic_link_flags [get_multilibs]]"
+ }
+ }
+ set t [get_multilibs]
+ puts "maybe al $maybe_atomic_lib ml $t"
}
# Main loop.
@@ -97,14 +107,14 @@ foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ]]
foreach flags $option_list {
verbose "Testing $nshort (single), $flags" 1
set gfortran_aux_module_flags "-fcoarray=single $flags"
- dg-test $test "-fcoarray=single $flags $maybe_atomic_lib" ""
+ dg-test $test "-fcoarray=single $flags" $maybe_atomic_lib
cleanup-modules ""
}
foreach flags $option_list {
verbose "Testing $nshort (libcaf_single), $flags" 1
set gfortran_aux_module_flags "-fcoarray=lib $flags -lcaf_single"
- dg-test $test "-fcoarray=lib $flags -lcaf_single $maybe_atomic_lib" ""
+ dg-test $test "-fcoarray=lib $flags -lcaf_single" $maybe_atomic_lib
cleanup-modules ""
}
}
diff --git a/gcc/testsuite/gfortran.dg/dg.exp b/gcc/testsuite/gfortran.dg/dg.exp
index ee2760327dc..73541ea7301 100644
--- a/gcc/testsuite/gfortran.dg/dg.exp
+++ b/gcc/testsuite/gfortran.dg/dg.exp
@@ -18,6 +18,7 @@
# Load support procs.
load_lib gfortran-dg.exp
+load_lib atomic-dg.exp
# If a testcase doesn't have special options, use these.
global DEFAULT_FFLAGS
@@ -53,13 +54,38 @@ proc dg-compile-aux-modules { args } {
}
}
+# coarray tests might need libatomic. Assume that it is either not needed or
+# provided by builtins if it's not available.
+set maybe_atomic_lib ""
+if [check_effective_target_libatomic_available] {
+ if ![is_remote host] {
+ if [info exists TOOL_OPTIONS] {
+ set maybe_atomic_lib "[atomic_link_flags [get_multilibs ${TOOL_OPTIONS}]]"
+ } else {
+ set maybe_atomic_lib "[atomic_link_flags [get_multilibs]]"
+ }
+ } else {
+ set maybe_atomic_lib ""
+ }
+ set t [get_multilibs]
+ puts "dg set al $maybe_atomic_lib ml $t"
+}
+
+set all_flags $DEFAULT_FFLAGS
+if { $maybe_atomic_lib != "" } {
+ foreach f $maybe_atomic_lib {
+ lappend all_flags $f
+ }
+}
+
+puts "revised FFLAGS $all_flags"
+
# Main loop.
gfortran-dg-runtest [lsort \
- [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ] ] "" $DEFAULT_FFLAGS
+ [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ] ] "" $all_flags
gfortran-dg-runtest [lsort \
- [glob -nocomplain $srcdir/$subdir/g77/*.\[fF\] ] ] "" $DEFAULT_FFLAGS
-
+ [glob -nocomplain $srcdir/$subdir/g77/*.\[fF\] ] ] "" $all_flags
# All done.
dg-finish
diff --git a/gcc/testsuite/lib/asan-dg.exp b/gcc/testsuite/lib/asan-dg.exp
index 35e60eaaed5..157b60908d6 100644
--- a/gcc/testsuite/lib/asan-dg.exp
+++ b/gcc/testsuite/lib/asan-dg.exp
@@ -78,7 +78,7 @@ proc asan_link_flags_1 { paths lib } {
|| [file exists "${gccpath}/libsanitizer/${lib}/.libs/lib${lib}.${shlib_ext}"] } {
append flags " -B${gccpath}/libsanitizer/ "
append flags " -B${gccpath}/libsanitizer/${lib}/ "
- append flags " -L${gccpath}/libsanitizer/${lib}/.libs "
+ append flags " -B${gccpath}/libsanitizer/${lib}/.libs "
append ld_library_path ":${gccpath}/libsanitizer/${lib}/.libs"
}
} else {
diff --git a/gcc/testsuite/lib/atomic-dg.exp b/gcc/testsuite/lib/atomic-dg.exp
index 1589acd8eaf..ce1799cef2d 100644
--- a/gcc/testsuite/lib/atomic-dg.exp
+++ b/gcc/testsuite/lib/atomic-dg.exp
@@ -33,7 +33,7 @@ proc atomic_link_flags { paths } {
if { [file exists "${gccpath}/libatomic/.libs/libatomic.a"]
|| [file exists "${gccpath}/libatomic/.libs/libatomic.${shlib_ext}"] } {
append flags " -B${gccpath}/libatomic/ "
- append flags " -L${gccpath}/libatomic/.libs"
+ append flags " -B${gccpath}/libatomic/.libs"
append ld_library_path ":${gccpath}/libatomic/.libs"
}
} else {
diff --git a/gcc/testsuite/lib/target-libpath.exp b/gcc/testsuite/lib/target-libpath.exp
index 6d530fb4af6..36b64dd4550 100644
--- a/gcc/testsuite/lib/target-libpath.exp
+++ b/gcc/testsuite/lib/target-libpath.exp
@@ -67,6 +67,7 @@ proc set_ld_library_path_env_vars { } {
global orig_dyld_library_path
global orig_path
global orig_gcc_exec_prefix
+ global ENABLE_DARWIN_AT_RPATH
global env
# Save the original GCC_EXEC_PREFIX.
@@ -133,6 +134,7 @@ proc set_ld_library_path_env_vars { } {
#
# Doing this is somewhat of a hack as ld_library_path gets repeated in
# SHLIB_PATH and LD_LIBRARY_PATH when unix_load sets these variables.
+ if { ![istarget *-*-darwin*] } {
if { $orig_ld_library_path_saved } {
setenv LD_LIBRARY_PATH "$ld_library_path:$orig_ld_library_path"
} else {
@@ -166,10 +168,22 @@ proc set_ld_library_path_env_vars { } {
} else {
setenv LD_LIBRARY_PATH_64 "$ld_library_path"
}
- if { $orig_dyld_library_path_saved } {
- setenv DYLD_LIBRARY_PATH "$ld_library_path:$orig_dyld_library_path"
- } else {
- setenv DYLD_LIBRARY_PATH "$ld_library_path"
+ }
+ if { [istarget *-*-darwin*] } {
+ if { [info exists ENABLE_DARWIN_AT_RPATH] || [istarget *-*-darwin1\[5-9\]*]
+ || [istarget *-*-darwin20*] } {
+ # Either we are not using DYLD_LIBRARY_PATH or we're on a version of the
+ # OS for which it is not passed through system exes.
+ if [info exists env(DYLD_LIBRARY_PATH)] {
+ unsetenv DYLD_LIBRARY_PATH
+ }
+ } else {
+ if { $orig_dyld_library_path_saved } {
+ setenv DYLD_LIBRARY_PATH "$ld_library_path:$orig_dyld_library_path"
+ } else {
+ setenv DYLD_LIBRARY_PATH "$ld_library_path"
+ }
+ }
}
if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } {
if { $orig_path_saved } {
@@ -179,6 +193,7 @@ proc set_ld_library_path_env_vars { } {
}
}
+ verbose -log "set paths"
verbose -log "LD_LIBRARY_PATH=[getenv LD_LIBRARY_PATH]"
verbose -log "LD_RUN_PATH=[getenv LD_RUN_PATH]"
verbose -log "SHLIB_PATH=[getenv SHLIB_PATH]"
diff --git a/libatomic/testsuite/lib/libatomic.exp b/libatomic/testsuite/lib/libatomic.exp
index 10f38475bc8..c6d645e9ae3 100644
--- a/libatomic/testsuite/lib/libatomic.exp
+++ b/libatomic/testsuite/lib/libatomic.exp
@@ -148,11 +148,15 @@ proc libatomic_init { args } {
if { $blddir != "" } {
lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/"
lappend ALWAYS_CFLAGS "additional_flags=-I${blddir}"
- lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs"
+ if [istarget *-*-darwin*] {
+ lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/.libs"
+ } else {
+ lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs"
+ }
}
lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/.."
- if [istarget *-*-darwin*] {
+ if [istarget *-*-darwin\[89\]*] {
lappend ALWAYS_CFLAGS "additional_flags=-shared-libgcc"
}
diff --git a/libffi/testsuite/lib/libffi.exp b/libffi/testsuite/lib/libffi.exp
index 15d3d5ebd73..611f5177c7a 100644
--- a/libffi/testsuite/lib/libffi.exp
+++ b/libffi/testsuite/lib/libffi.exp
@@ -337,8 +337,13 @@ proc libffi-init { args } {
verbose "libffi_dir $libffi_dir"
if { $libffi_dir != "" } {
set libffi_dir [file dirname ${libffi_dir}]
- set libffi_link_flags "-L${libffi_dir}/.libs"
- lappend libffi_link_flags "-L${blddircxx}/src/.libs"
+ if [istarget *-*-darwin*] {
+ set libffi_link_flags "-B${libffi_dir}/.libs"
+ lappend libffi_link_flags "-B${blddircxx}/src/.libs"
+ } else {
+ set libffi_link_flags "-L${libffi_dir}/.libs"
+ lappend libffi_link_flags "-L${blddircxx}/src/.libs"
+ }
}
set_ld_library_path_env_vars
@@ -382,7 +387,7 @@ proc libffi_target_compile { source dest type options } {
# Darwin needs a stack execution allowed flag.
if { [istarget "*-*-darwin9*"] || [istarget "*-*-darwin1*"]
- || [istarget "*-*-darwin2*"] } {
+ || [istarget "x86_64-*-darwin2*"] } {
lappend options "additional_flags=-Wl,-allow_stack_execute"
lappend options "additional_flags=-Wl,-search_paths_first"
}
diff --git a/libitm/testsuite/lib/libitm.exp b/libitm/testsuite/lib/libitm.exp
index da918d1ee8d..61bbfa0c923 100644
--- a/libitm/testsuite/lib/libitm.exp
+++ b/libitm/testsuite/lib/libitm.exp
@@ -159,6 +159,7 @@ proc libitm_init { args } {
}
if [istarget *-*-darwin*] {
+ lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/.libs"
lappend ALWAYS_CFLAGS "additional_flags=-shared-libgcc"
}
diff --git a/libitm/testsuite/libitm.c++/c++.exp b/libitm/testsuite/libitm.c++/c++.exp
index de45e7e5480..1b0ead05fee 100644
--- a/libitm/testsuite/libitm.c++/c++.exp
+++ b/libitm/testsuite/libitm.c++/c++.exp
@@ -56,8 +56,10 @@ if { $lang_test_file_found } {
# Gather a list of all tests.
set tests [lsort [glob -nocomplain $srcdir/$subdir/*.C]]
+ set stdcxxadder ""
if { $blddir != "" } {
set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
+ set stdcxxadder "-B ${blddir}/${lang_library_path}"
} else {
set ld_library_path "$always_ld_library_path"
}
@@ -72,7 +74,7 @@ if { $lang_test_file_found } {
}
# Main loop.
- dg-runtest $tests "" $libstdcxx_includes
+ dg-runtest $tests $stdcxxadder $libstdcxx_includes
}
# All done.
--
2.39.2 (Apple Git-143)
[-- Attachment #6: 0005-Doc-document-the-new-Darwin-options.patch --]
[-- Type: application/octet-stream, Size: 2774 bytes --]
From be8676410ab15a6e6cce300ce617d1f5259dcabf Mon Sep 17 00:00:00 2001
From: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Date: Thu, 24 Aug 2023 13:22:28 +0200
Subject: [PATCH 5/5] Doc: document the new Darwin options
gcc/ChangeLog:
* doc/invoke.texi: Document the new -nodefaultrpaths option.
* doc/install.texi: Document the new --with-darwin-extra-rpath
option.
---
gcc/doc/install.texi | 6 ++++++
gcc/doc/invoke.texi | 10 +++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index e099cd0b568..a388e1f12e0 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -1808,6 +1808,12 @@ particularly useful if you intend to use several versions of GCC in
parallel. The default is @samp{yes} for @samp{libada}, and @samp{no} for
the remaining libraries.
+@item --with-darwin-extra-rpath
+This is provided to allow distributions to add a single additional
+runpath on Darwin / macOS systems. This allows for cases where the
+installed GCC library directories are then symlinked to a common
+directory outside of the GCC installation.
+
@item @anchor{WithAixSoname}--with-aix-soname=@samp{aix}, @samp{svr4} or @samp{both}
Traditional AIX shared library versioning (versioned @code{Shared Object}
files as members of unversioned @code{Archive Library} files named
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index a32dabf0405..778d82ecd2b 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -920,7 +920,7 @@ Objective-C and Objective-C++ Dialects}.
-iframework
-image_base -init -install_name -keep_private_externs
-multi_module -multiply_defined -multiply_defined_unused
--noall_load -no_dead_strip_inits_and_terms
+-noall_load -no_dead_strip_inits_and_terms -nodefaultrpaths
-nofixprebinding -nomultidefs -noprebind -noseglinkedit
-pagezero_size -prebind -prebind_all_twolevel_modules
-private_bundle -read_only_relocs -sectalign
@@ -24269,6 +24269,14 @@ an executable when linking, using the Darwin @file{libtool} command.
This causes GCC's output file to have the @samp{ALL} subtype, instead of
one controlled by the @option{-mcpu} or @option{-march} option.
+@opindex nodefaultrpaths
+@item -nodefaultrpaths
+Do not add default run paths for the compiler library directories to
+executables, modules or dynamic libraries. On macOS 10.5 and later,
+the embedded runpath is added by default unless the user adds
+@option{-nodefaultrpaths} to the link line. Run paths are needed
+(and therefore enforced) to build on macOS version 10.11 or later.
+
@item -allowable_client @var{client_name}
@itemx -client_name
@itemx -compatibility_version
--
2.39.2 (Apple Git-143)
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-08-29 20:17 ` FX Coudert
@ 2023-09-12 17:52 ` FX Coudert
2023-09-20 13:52 ` FX Coudert
2023-10-21 5:27 ` Alexandre Oliva
1 sibling, 1 reply; 39+ messages in thread
From: FX Coudert @ 2023-09-12 17:52 UTC (permalink / raw)
To: GCC Patches
Cc: Joseph Myers, bonzini, neroden, aoliva, Ralf.Wildenhues, Iain Sandoe
[-- Attachment #1: Type: text/plain, Size: 1988 bytes --]
Hi build maintainers,
May I ping this series of patches for review? In particular, they allow to restore testing on darwin, which is currently broken with darwin >= 21, due to DYLD_LIBRARY_PATH being systematically removed from the environment by system tools.
It has been tested for two years on darwin, and would allow to restore regular regtesting on that target. It is a big step to help prevent bugs being undetected on this port.
The patchset was okayed from the driver point of view, but we need a build reviewer (or global reviewer) to okay those bits. Original presentation of the patches:
------
I’d like to post an updated and rebased version of Iain Sandoe’s patches for modern darwin, originally posted in November 2021: https://gcc.gnu.org/pipermail/gcc-patches/2021-November/584775.html
The rationale in that message is pretty much unchanged, and the patches have been since tested thoroughly on darwin (both Intel and ARM) for almost two years now. We have been shipping Iain’s branch (including these patches) since then in Homebrew and most other major distros of GCC on Darwin. So I think it’s been very thoroughly tested.
The main comment that arose from review in the previous incarnation was the need to at least offer the libtool part of the patch to upstream, in order to reduce in the long term the divergence between our version and upstream. I have done so in https://savannah.gnu.org/patch/index.php?10385
(I would also note that I have offered other suggestions of small snippets that could be upstream in libtool for darwin, but have not received much feedback for now: https://savannah.gnu.org/patch/?10371)
------
Thanks,
FX
> Le 29 août 2023 à 22:17, FX Coudert <fxcoudert@gmail.com> a écrit :
>
>> I think a build machinery review is needed.
>
> Thanks. CC’ing the relevant maintainers for review of the build part.
> The driver part and the darwin-specific part are already okayed.
>
> FX
[-- Attachment #2: 0001-Driver-Provide-a-spec-to-insert-rpaths-for-compiler-.patch --]
[-- Type: application/octet-stream, Size: 3952 bytes --]
From ff84f0b0d2971bc589a52c416d0ca6f292f75458 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Thu, 20 Dec 2018 09:00:38 +0000
Subject: [PATCH 1/5] Driver: Provide a spec to insert rpaths for compiler lib
dirs.
This provides a spec to insert "-rpath DDD" for each DDD corresponding
to a compiler startfile directory. This allows a target to use @rpath
as the install path for libraries, and have the compiler provide the
necessary rpath to handle this.
Embed real paths, not relative ones.
We embed a runpath for every path in which libraries might be found. This
change ensures that we embed the actual real path and not a relative one from
the compiler's version-specific directory.
e.g.
/opt/distro/gcc-11-3Dr0/lib
instead of:
/opt/distro/gcc-11-3Dr0/lib/gcc/x86_64-apple-darwin19/11.3.0/../../..
This ensures that if we install, for example, 11.4.0 (and delete the 11.3.0
installation) exes built by 11.3 would continue to function (providing, of course
that 11.4 does not bump any SO names).
gcc/ChangeLog:
* gcc.cc (RUNPATH_OPTION): New.
(do_spec_1): Provide '%P' as a spec to insert rpaths for
each compiler startfile path.
---
gcc/gcc.cc | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index fdfac0b4fe4..7c6e4879a31 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -579,6 +579,7 @@ or with constant text in a single argument.
%l process LINK_SPEC as a spec.
%L process LIB_SPEC as a spec.
%M Output multilib_os_dir.
+ %P Output a RUNPATH_OPTION for each directory in startfile_prefixes.
%G process LIBGCC_SPEC as a spec.
%R Output the concatenation of target_system_root and
target_sysroot_suffix.
@@ -1182,6 +1183,10 @@ proper position among the other output files. */
# define SYSROOT_HEADERS_SUFFIX_SPEC ""
#endif
+#ifndef RUNPATH_OPTION
+# define RUNPATH_OPTION "-rpath"
+#endif
+
static const char *asm_debug = ASM_DEBUG_SPEC;
static const char *asm_debug_option = ASM_DEBUG_OPTION_SPEC;
static const char *cpp_spec = CPP_SPEC;
@@ -5925,6 +5930,7 @@ struct spec_path_info {
size_t append_len;
bool omit_relative;
bool separate_options;
+ bool realpaths;
};
static void *
@@ -5934,6 +5940,16 @@ spec_path (char *path, void *data)
size_t len = 0;
char save = 0;
+ /* The path must exist; we want to resolve it to the realpath so that this
+ can be embedded as a runpath. */
+ if (info->realpaths)
+ path = lrealpath (path);
+
+ /* However, if we failed to resolve it - perhaps because there was a bogus
+ -B option on the command line, then punt on this entry. */
+ if (!path)
+ return NULL;
+
if (info->omit_relative && !IS_ABSOLUTE_PATH (path))
return NULL;
@@ -6165,6 +6181,22 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
info.omit_relative = false;
#endif
info.separate_options = false;
+ info.realpaths = false;
+
+ for_each_path (&startfile_prefixes, true, 0, spec_path, &info);
+ }
+ break;
+
+ case 'P':
+ {
+ struct spec_path_info info;
+
+ info.option = RUNPATH_OPTION;
+ info.append_len = 0;
+ info.omit_relative = false;
+ info.separate_options = true;
+ /* We want to embed the actual paths that have the libraries. */
+ info.realpaths = true;
for_each_path (&startfile_prefixes, true, 0, spec_path, &info);
}
@@ -6491,6 +6523,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
info.append_len = strlen (info.append);
info.omit_relative = false;
info.separate_options = true;
+ info.realpaths = false;
for_each_path (&include_prefixes, false, info.append_len,
spec_path, &info);
--
2.39.2 (Apple Git-143)
[-- Attachment #3: 0002-Darwin-Allow-for-configuring-Darwin-to-use-embedded-.patch --]
[-- Type: application/octet-stream, Size: 279683 bytes --]
From 5259260cf3bfc6cec7a3f0e5caeecfbc6bf00778 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Sun, 28 Mar 2021 14:48:17 +0100
Subject: [PATCH 2/5] Darwin: Allow for configuring Darwin to use embedded
runpath.
Recent Darwin versions place contraints on the use of run paths
specified in environment variables. This breaks some assumptions
in the GCC build.
This change allows the user to configure a Darwin build to use
'@rpath/libraryname.dylib' in library names and then to add an
embedded runpath to executables (and libraries with dependents).
The embedded runpath is added by default unless the user adds
'-nodefaultrpaths' to the link line.
For an installed compiler, it means that any executable built with
that compiler will reference the runtimes installed with the
compiler (equivalent to hard-coding the library path into the name
of the library).
During build-time configurations any "-B" entries will be added to
the runpath thus the newly-built libraries will be found by exes.
Since the install name is set in libtool, that decision needs to be
available here (but might also cause dependent ones in Makefiles,
so we need to export a conditional).
This facility is not available for Darwin 8 or earlier, however the
existing environment variable runpath does work there.
We default this on for systems where the external DYLD_LIBRARY_PATH
does not work and off for Darwin 8 or earlier. For systems that can
use either method, if the value is unset, we use the default (which
is currently DYLD_LIBRARY_PATH).
ChangeLog:
* configure: Regenerate.
* configure.ac: Do not add default runpaths to GCC exes
when we are building -static-libstdc++/-static-libgcc (the
default).
* libtool.m4: Add 'enable-darwin-at-runpath'. Act on the
enable flag to alter Darwin libraries to use @rpath names.
gcc/ChangeLog:
* aclocal.m4: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
* config/darwin.h: Handle Darwin rpaths.
* config/darwin.opt: Handle Darwin rpaths.
* Makefile.in: Handle Darwin rpaths.
gcc/ada/ChangeLog:
* gcc-interface/Makefile.in: Handle Darwin rpaths.
gcc/jit/ChangeLog:
* Make-lang.in: Handle Darwin rpaths.
libatomic/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libbacktrace/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libcc1/ChangeLog:
* configure: Regenerate.
libffi/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
libgcc/ChangeLog:
* config/t-slibgcc-darwin: Generate libgcc_s
with an @rpath name.
* config.host: Handle Darwin rpaths.
libgfortran/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths
libgm2/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* aclocal.m4: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
* libm2cor/Makefile.am: Handle Darwin rpaths.
* libm2cor/Makefile.in: Regenerate.
* libm2iso/Makefile.am: Handle Darwin rpaths.
* libm2iso/Makefile.in: Regenerate.
* libm2log/Makefile.am: Handle Darwin rpaths.
* libm2log/Makefile.in: Regenerate.
* libm2min/Makefile.am: Handle Darwin rpaths.
* libm2min/Makefile.in: Regenerate.
* libm2pim/Makefile.am: Handle Darwin rpaths.
* libm2pim/Makefile.in: Regenerate.
libgomp/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths
libitm/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libobjc/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libphobos/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
* libdruntime/Makefile.am: Handle Darwin rpaths.
* libdruntime/Makefile.in: Regenerate.
* src/Makefile.am: Handle Darwin rpaths.
* src/Makefile.in: Regenerate.
libquadmath/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libsanitizer/ChangeLog:
* asan/Makefile.am: Handle Darwin rpaths.
* asan/Makefile.in: Regenerate.
* configure: Regenerate.
* hwasan/Makefile.am: Handle Darwin rpaths.
* hwasan/Makefile.in: Regenerate.
* lsan/Makefile.am: Handle Darwin rpaths.
* lsan/Makefile.in: Regenerate.
* tsan/Makefile.am: Handle Darwin rpaths.
* tsan/Makefile.in: Regenerate.
* ubsan/Makefile.am: Handle Darwin rpaths.
* ubsan/Makefile.in: Regenerate.
libssp/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libstdc++-v3/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
* src/Makefile.am: Handle Darwin rpaths.
* src/Makefile.in: Regenerate.
libvtv/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
lto-plugin/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
zlib/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
---
configure | 14 ++
configure.ac | 14 ++
gcc/Makefile.in | 11 +-
gcc/aclocal.m4 | 50 +++++++
gcc/ada/gcc-interface/Makefile.in | 5 +-
gcc/config/darwin.h | 32 ++++-
gcc/config/darwin.opt | 4 +
gcc/configure | 133 ++++++++++++++++--
gcc/configure.ac | 2 +
gcc/jit/Make-lang.in | 2 +-
libatomic/Makefile.am | 7 +-
libatomic/Makefile.in | 7 +-
libatomic/configure | 76 ++++++++++-
libatomic/configure.ac | 2 +
libbacktrace/configure | 76 ++++++++++-
libbacktrace/configure.ac | 2 +
libcc1/configure | 118 ++++++++++++++--
libffi/Makefile.am | 7 +-
libffi/Makefile.in | 6 +-
libffi/configure | 132 ++++++++++++++++--
libffi/configure.ac | 1 +
libffi/doc/version.texi | 4 +-
libgcc/config.host | 23 +++-
libgcc/config/t-darwin-rpath | 2 +
libgcc/config/t-slibgcc-darwin | 28 ++--
libgfortran/Makefile.am | 7 +-
libgfortran/Makefile.in | 28 ++--
libgfortran/configure | 131 ++++++++++++++++--
libgfortran/configure.ac | 6 +-
libgm2/Makefile.am | 9 +-
libgm2/Makefile.in | 15 +-
libgm2/aclocal.m4 | 10 +-
libgm2/configure | 145 ++++++++++++++++++--
libgm2/configure.ac | 6 +-
libgm2/libm2cor/Makefile.am | 4 +
libgm2/libm2cor/Makefile.in | 17 ++-
libgm2/libm2iso/Makefile.am | 4 +
libgm2/libm2iso/Makefile.in | 17 ++-
libgm2/libm2log/Makefile.am | 3 +
libgm2/libm2log/Makefile.in | 17 ++-
libgm2/libm2min/Makefile.am | 3 +
libgm2/libm2min/Makefile.in | 17 ++-
libgm2/libm2pim/Makefile.am | 3 +
libgm2/libm2pim/Makefile.in | 17 ++-
libgo/configure | 18 ++-
libgo/configure.ac | 1 +
libgomp/Makefile.am | 7 +-
libgomp/Makefile.in | 5 +-
libgomp/configure | 126 ++++++++++++++++-
libgomp/configure.ac | 1 +
libitm/Makefile.am | 7 +-
libitm/Makefile.in | 7 +-
libitm/configure | 132 ++++++++++++++++--
libitm/configure.ac | 1 +
libobjc/configure | 112 ++++++++++++---
libobjc/configure.ac | 36 +++--
libphobos/configure | 126 ++++++++++++++++-
libphobos/configure.ac | 1 +
libphobos/libdruntime/Makefile.am | 5 +-
libphobos/libdruntime/Makefile.in | 3 +-
libphobos/src/Makefile.am | 5 +-
libphobos/src/Makefile.in | 3 +-
libquadmath/Makefile.am | 7 +-
libquadmath/Makefile.in | 5 +-
libquadmath/configure | 218 +++++++++++++++++++++++++++++-
libquadmath/configure.ac | 3 +
libsanitizer/asan/Makefile.am | 7 +-
libsanitizer/asan/Makefile.in | 7 +-
libsanitizer/configure | 133 ++++++++++++++++--
libsanitizer/configure.ac | 2 +
libsanitizer/hwasan/Makefile.am | 6 +-
libsanitizer/hwasan/Makefile.in | 5 +-
libsanitizer/lsan/Makefile.am | 8 +-
libsanitizer/lsan/Makefile.in | 8 +-
libsanitizer/tsan/Makefile.am | 6 +-
libsanitizer/tsan/Makefile.in | 5 +-
libsanitizer/ubsan/Makefile.am | 7 +-
libsanitizer/ubsan/Makefile.in | 7 +-
libssp/Makefile.am | 6 +-
libssp/Makefile.in | 5 +-
libssp/configure | 76 ++++++++++-
libssp/configure.ac | 2 +
libstdc++-v3/configure | 144 ++++++++++++++++++--
libstdc++-v3/configure.ac | 1 +
libstdc++-v3/src/Makefile.am | 7 +-
libstdc++-v3/src/Makefile.in | 5 +-
libtool.m4 | 57 +++++++-
libvtv/configure | 132 ++++++++++++++++--
libvtv/configure.ac | 1 +
lto-plugin/configure | 75 +++++++++-
lto-plugin/configure.ac | 1 +
zlib/configure | 75 +++++++++-
zlib/configure.ac | 1 +
93 files changed, 2556 insertions(+), 279 deletions(-)
create mode 100644 libgcc/config/t-darwin-rpath
diff --git a/configure b/configure
index 28f0913bdd4..28e25bf7162 100755
--- a/configure
+++ b/configure
@@ -8492,6 +8492,20 @@ else
fi
fi
+case $target in
+ *-darwin2* | *-darwin1[56789]*)
+ # For these versions, we default to using embedded rpaths.
+ if test "x$enable_darwin_at_rpath" != "xno"; then
+ poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths"
+ fi
+ ;;
+ *-darwin*)
+ # For these versions, we only use embedded rpaths on demand.
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths"
+ fi
+ ;;
+esac
# GCC GRAPHITE dependency isl.
diff --git a/configure.ac b/configure.ac
index 5d25dc864c3..49c237bb8b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1855,6 +1855,20 @@ AC_ARG_WITH(boot-ldflags,
if test "$poststage1_libs" = ""; then
poststage1_ldflags="-static-libstdc++ -static-libgcc"
fi])
+case $target in
+ *-darwin2* | *-darwin1[[56789]]*)
+ # For these versions, we default to using embedded rpaths.
+ if test "x$enable_darwin_at_rpath" != "xno"; then
+ poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths"
+ fi
+ ;;
+ *-darwin*)
+ # For these versions, we only use embedded rpaths on demand.
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths"
+ fi
+ ;;
+esac
AC_SUBST(poststage1_ldflags)
# GCC GRAPHITE dependency isl.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 78779546459..60ba2916457 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1193,6 +1193,8 @@ LANG_MAKEFRAGS = @all_lang_makefrags@
# Used by gcc/jit/Make-lang.in
LD_VERSION_SCRIPT_OPTION = @ld_version_script_option@
LD_SONAME_OPTION = @ld_soname_option@
+@ENABLE_DARWIN_AT_RPATH_TRUE@DARWIN_RPATH = @rpath
+@ENABLE_DARWIN_AT_RPATH_FALSE@DARWIN_RPATH = ${libdir}
# Flags to pass to recursive makes.
# CC is set by configure.
@@ -2014,9 +2016,12 @@ cs-tconfig.h: Makefile
$(SHELL) $(srcdir)/mkconfig.sh tconfig.h
cs-tm.h: Makefile
- TARGET_CPU_DEFAULT="$(target_cpu_default)" \
- HEADERS="$(tm_include_list)" DEFINES="$(tm_defines)" \
- $(SHELL) $(srcdir)/mkconfig.sh tm.h
+@ENABLE_DARWIN_AT_RPATH_FALSE@ TARGET_CPU_DEFAULT="$(target_cpu_default)" \
+@ENABLE_DARWIN_AT_RPATH_FALSE@ HEADERS="$(tm_include_list)" DEFINES="$(tm_defines)" \
+@ENABLE_DARWIN_AT_RPATH_FALSE@ $(SHELL) $(srcdir)/mkconfig.sh tm.h
+@ENABLE_DARWIN_AT_RPATH_TRUE@ TARGET_CPU_DEFAULT="$(target_cpu_default)" \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ HEADERS="$(tm_include_list)" DEFINES="$(tm_defines) DARWIN_AT_RPATH=1" \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ $(SHELL) $(srcdir)/mkconfig.sh tm.h
cs-tm_p.h: Makefile
TARGET_CPU_DEFAULT="" \
diff --git a/gcc/aclocal.m4 b/gcc/aclocal.m4
index 6be36df5190..126e09bbcd1 100644
--- a/gcc/aclocal.m4
+++ b/gcc/aclocal.m4
@@ -12,6 +12,56 @@
# PARTICULAR PURPOSE.
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ([2.52])dnl
+ m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 2006-2017 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# --------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
m4_include([../libtool.m4])
m4_include([../ltoptions.m4])
m4_include([../ltsugar.m4])
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index b5243a24a8f..ad7cf5072e5 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -794,12 +794,15 @@ gnatlib-shared-darwin:
$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
$(SO_OPTS) \
-Wl,-install_name,@rpath/libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
- $(MISCLIB)
+ -nodefaultrpaths -Wl,-rpath,@loader_path/,-rpath,@loader_path/.. \
+ -Wl,-rpath,@loader_path/../../../../ $(MISCLIB)
cd $(RTSDIR); $(GCC_FOR_ADA_RTS) -dynamiclib $(PICFLAG_FOR_TARGET) \
-o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
$(GNATRTL_TASKING_OBJS) \
$(SO_OPTS) \
-Wl,-install_name,@rpath/libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ -nodefaultrpaths -Wl,-rpath,@loader_path/,-rpath,@loader_path/.. \
+ -Wl,-rpath,@loader_path/../../../../ \
$(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
cd $(RTSDIR); $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
libgnat$(soext)
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index e0e8672a455..1b6920f4c92 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -309,6 +309,18 @@ extern GTY(()) int darwin_ms_struct;
#define DARWIN_CC1_SPEC \
"%<dynamic %<dynamiclib %<force_cpusubtype_ALL %<multiply_defined* "
+/* When we are using embedded runpaths DARWIN_AT_RPATH is set. */
+#if DARWIN_AT_RPATH
+# define DARWIN_RPATH_LINK \
+"%{!r:%{!nostdlib:%{!nodefaultrpaths:%(darwin_rpaths)}}}"
+# define DARWIN_SHARED_LIBGCC "-lgcc_s.1.1"
+#else
+# define DARWIN_RPATH_LINK ""
+# define DARWIN_SHARED_LIBGCC \
+"%:version-compare(!> 10.11 mmacosx-version-min= -lgcc_s.1.1) \
+ %:version-compare(>= 10.11 mmacosx-version-min= -lemutls_w) "
+#endif
+
#define SUBSUBTARGET_OVERRIDE_OPTIONS \
do { \
darwin_override_options (); \
@@ -403,7 +415,8 @@ extern GTY(()) int darwin_ms_struct;
DARWIN_NOPIE_SPEC \
DARWIN_RDYNAMIC \
DARWIN_NOCOMPACT_UNWIND \
- "}}}}}}} %<pie %<no-pie %<rdynamic %<X %<rpath "
+ DARWIN_RPATH_LINK \
+ "}}}}}}} %<pie %<no-pie %<rdynamic %<X %<rpath %<nodefaultrpaths "
/* Spec that controls whether the debug linker is run automatically for
a link step. This needs to be done if there is a source file on the
@@ -518,8 +531,7 @@ extern GTY(()) int darwin_ms_struct;
%:version-compare(!> 10.6 mmacosx-version-min= -lgcc_eh) \
%:version-compare(>= 10.6 mmacosx-version-min= -lemutls_w); \
shared-libgcc|fexceptions|fobjc-exceptions|fgnu-runtime: \
- %:version-compare(!> 10.11 mmacosx-version-min= -lgcc_s.1.1) \
- %:version-compare(>= 10.11 mmacosx-version-min= -lemutls_w) \
+ " DARWIN_SHARED_LIBGCC " \
%:version-compare(!> 10.3.9 mmacosx-version-min= -lgcc_eh) \
%:version-compare(>< 10.3.9 10.5 mmacosx-version-min= -lgcc_s.10.4) \
%:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5); \
@@ -554,7 +566,8 @@ extern GTY(()) int darwin_ms_struct;
{ "darwin_crt2", DARWIN_CRT2_SPEC }, \
{ "darwin_crt3", DARWIN_CRT3_SPEC }, \
{ "darwin_dylib1", DARWIN_DYLIB1_SPEC }, \
- { "darwin_bundle1", DARWIN_BUNDLE1_SPEC },
+ { "darwin_bundle1", DARWIN_BUNDLE1_SPEC }, \
+ { "darwin_rpaths", DARWIN_RPATH_SPEC },
#define DARWIN_CRT1_SPEC \
"%:version-compare(!> 10.5 mmacosx-version-min= -lcrt1.o) \
@@ -580,6 +593,17 @@ extern GTY(()) int darwin_ms_struct;
"%{!static:%:version-compare(< 10.6 mmacosx-version-min= -lbundle1.o) \
%{fgnu-tm: -lcrttms.o}}"
+#if DARWIN_AT_RPATH
+/* A default rpath, that picks up dependent libraries installed in the same
+ director as one being loaded. */
+#define DARWIN_RPATH_SPEC \
+ "%:version-compare(>= 10.5 mmacosx-version-min= -rpath) \
+ %:version-compare(>= 10.5 mmacosx-version-min= @loader_path) \
+ %P "
+#else
+#define DARWIN_RPATH_SPEC ""
+#endif
+
#ifdef HAVE_AS_MMACOSX_VERSION_MIN_OPTION
/* Emit macosx version (but only major). */
#define ASM_MMACOSX_VERSION_MIN_SPEC \
diff --git a/gcc/config/darwin.opt b/gcc/config/darwin.opt
index d655aaef2fb..ff624ffd82a 100644
--- a/gcc/config/darwin.opt
+++ b/gcc/config/darwin.opt
@@ -241,6 +241,10 @@ nodefaultexport
Driver RejectNegative
Do not add a default symbol exports to modules or dynamic libraries.
+nodefaultrpaths
+Driver RejectNegative
+Do not add default run paths (for the compiler library directories) to executables, modules or dynamic libraries.
+
nofixprebinding
Driver RejectNegative
(Obsolete after 10.3.9) Set MH_NOPREFIXBINDING, in an executable.
diff --git a/gcc/configure b/gcc/configure
index 07e8a64afbb..eaa1a189583 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -741,6 +741,8 @@ ORIGINAL_PLUGIN_LD_FOR_TARGET
gcc_cv_ld
ORIGINAL_AS_FOR_TARGET
gcc_cv_as
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_fast_install
objdir
OTOOL64
@@ -1006,6 +1008,7 @@ enable_static
with_pic
enable_fast_install
enable_libtool_lock
+enable_darwin_at_rpath
enable_ld
enable_gold
with_plugin_ld
@@ -1741,6 +1744,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-ld[=ARG] build ld [ARG={default,yes,no}]
--enable-gold[=ARG] build gold [ARG={default,yes,no}]
--enable-gnu-indirect-function
@@ -16356,7 +16362,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -18061,6 +18067,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -18078,9 +18127,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -19886,7 +19939,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19889 "configure"
+#line 19942 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -19992,7 +20045,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19995 "configure"
+#line 20048 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -20868,6 +20921,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -20885,12 +20981,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -23261,6 +23365,15 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# Identify the assembler which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the assembler
# which will be driven by the driver program.
@@ -32851,6 +32964,10 @@ LTLIBOBJS=$ac_ltlibobjs
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 62c31d8e02d..80e31229408 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2599,6 +2599,8 @@ AC_PROG_LIBTOOL
AC_SUBST(objdir)
AC_SUBST(enable_fast_install)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
# Identify the assembler which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the assembler
# which will be driven by the driver program.
diff --git a/gcc/jit/Make-lang.in b/gcc/jit/Make-lang.in
index a65f13853ae..3fd564a5932 100644
--- a/gcc/jit/Make-lang.in
+++ b/gcc/jit/Make-lang.in
@@ -59,7 +59,7 @@ LIBGCCJIT_AGE = 1
LIBGCCJIT_BASENAME = libgccjit
LIBGCCJIT_SONAME = \
- ${libdir}/$(LIBGCCJIT_BASENAME).$(LIBGCCJIT_VERSION_NUM).dylib
+ $(DARWIN_RPATH)/$(LIBGCCJIT_BASENAME).$(LIBGCCJIT_VERSION_NUM).dylib
LIBGCCJIT_FILENAME = $(LIBGCCJIT_BASENAME).$(LIBGCCJIT_VERSION_NUM).dylib
LIBGCCJIT_LINKER_NAME = $(LIBGCCJIT_BASENAME).dylib
diff --git a/libatomic/Makefile.am b/libatomic/Makefile.am
index c6c8d81c56a..3bb32f32ebf 100644
--- a/libatomic/Makefile.am
+++ b/libatomic/Makefile.am
@@ -65,8 +65,13 @@ libatomic_version_script =
libatomic_version_dep =
endif
libatomic_version_info = -version-info $(libtool_VERSION)
+if ENABLE_DARWIN_AT_RPATH
+libatomic_darwin_rpath = -Wc,-nodefaultrpaths
+libatomic_darwin_rpath += -Wl,-rpath,@loader_path
+endif
-libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) $(lt_host_flags)
+libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) \
+ $(lt_host_flags) $(libatomic_darwin_rpath)
libatomic_la_SOURCES = gload.c gstore.c gcas.c gexch.c glfree.c lock.c init.c \
fenv.c fence.c flag.c
diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in
index 83efe7d2694..4164199cf9d 100644
--- a/libatomic/Makefile.in
+++ b/libatomic/Makefile.in
@@ -416,7 +416,12 @@ noinst_LTLIBRARIES = libatomic_convenience.la
@LIBAT_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@libatomic_version_dep = $(top_srcdir)/libatomic.map
@LIBAT_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@libatomic_version_dep = libatomic.map-sun
libatomic_version_info = -version-info $(libtool_VERSION)
-libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) $(lt_host_flags)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libatomic_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) \
+ $(lt_host_flags) $(libatomic_darwin_rpath)
+
libatomic_la_SOURCES = gload.c gstore.c gcas.c gexch.c glfree.c lock.c \
init.c fenv.c fence.c flag.c $(am__append_2)
SIZEOBJS = load store cas exch fadd fsub fand fior fxor fnand tas
diff --git a/libatomic/configure b/libatomic/configure
index 57f320753e1..dc5f4bca65e 100755
--- a/libatomic/configure
+++ b/libatomic/configure
@@ -658,6 +658,8 @@ OPT_LDFLAGS
SECTION_LDFLAGS
enable_aarch64_lse
libtool_VERSION
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
@@ -802,6 +804,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
enable_symvers
enable_werror
@@ -1451,6 +1454,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -7604,7 +7610,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9577,6 +9583,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9594,9 +9643,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11402,7 +11455,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11405 "configure"
+#line 11458 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11508,7 +11561,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11511 "configure"
+#line 11564 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11793,6 +11846,15 @@ fi
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=3:0:2
@@ -15920,6 +15982,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${LIBAT_BUILD_VERSIONED_SHLIB_TRUE}" && test -z "${LIBAT_BUILD_VERSIONED_SHLIB_FALSE}"; then
as_fn_error $? "conditional \"LIBAT_BUILD_VERSIONED_SHLIB\" was never defined.
diff --git a/libatomic/configure.ac b/libatomic/configure.ac
index 318b605a1d7..6919d212ae5 100644
--- a/libatomic/configure.ac
+++ b/libatomic/configure.ac
@@ -155,6 +155,8 @@ AC_SUBST(enable_shared)
AC_SUBST(enable_static)
AM_MAINTAINER_MODE
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=3:0:2
AC_SUBST(libtool_VERSION)
diff --git a/libbacktrace/configure b/libbacktrace/configure
index c3e7b884e36..0ccc060901d 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -681,6 +681,8 @@ PIC_FLAG
WARN_FLAGS
EXTRA_FLAGS
BACKTRACE_FILE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
OTOOL64
OTOOL
LIPO
@@ -805,6 +807,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_largefile
enable_cet
enable_werror
@@ -1453,6 +1456,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--disable-largefile omit support for large files
--enable-cet enable Intel CET in target libraries [default=auto]
--disable-werror disable building with -Werror
@@ -8048,7 +8054,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9754,6 +9760,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9771,9 +9820,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11579,7 +11632,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11582 "configure"
+#line 11635 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11685,7 +11738,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11688 "configure"
+#line 11741 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11924,6 +11977,15 @@ CC="$lt_save_CC"
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# Check whether --enable-largefile was given.
if test "${enable_largefile+set}" = set; then :
enableval=$enable_largefile;
@@ -14486,6 +14548,10 @@ if test -z "${HAVE_DWZ_TRUE}" && test -z "${HAVE_DWZ_FALSE}"; then
as_fn_error $? "conditional \"HAVE_DWZ\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${HAVE_ELF_TRUE}" && test -z "${HAVE_ELF_FALSE}"; then
as_fn_error $? "conditional \"HAVE_ELF\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac
index 72ff2b30053..71cd50f8cdf 100644
--- a/libbacktrace/configure.ac
+++ b/libbacktrace/configure.ac
@@ -84,6 +84,8 @@ AM_CONDITIONAL(HAVE_DWZ, test "$DWZ" != "")
LT_INIT
AM_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
AC_SYS_LARGEFILE
backtrace_supported=yes
diff --git a/libcc1/configure b/libcc1/configure
index 2a914a0bfc8..ea689a353c8 100755
--- a/libcc1/configure
+++ b/libcc1/configure
@@ -787,6 +787,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_cet
with_gcc_major_version_only
enable_werror_always
@@ -1439,6 +1440,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-cet enable Intel CET in host libraries [default=auto]
--enable-werror-always enable -Werror despite compiler version
--enable-plugin enable plugin support
@@ -7309,7 +7313,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9014,6 +9018,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9031,9 +9078,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -10839,7 +10890,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10842 "configure"
+#line 10893 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10945,7 +10996,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10948 "configure"
+#line 10999 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12227,6 +12278,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -12244,12 +12338,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
diff --git a/libffi/Makefile.am b/libffi/Makefile.am
index 2259ddb75f9..2c5b74df9ee 100644
--- a/libffi/Makefile.am
+++ b/libffi/Makefile.am
@@ -214,7 +214,12 @@ libffi.map: $(top_srcdir)/libffi.map.in
$(COMPILE) -D$(TARGET) -DGENERATE_LIBFFI_MAP \
-E -x assembler-with-cpp -o $@ $(top_srcdir)/libffi.map.in
-libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS)
+if ENABLE_DARWIN_AT_RPATH
+libffi_darwin_rpath = -Wl,-rpath,@loader_path
+endif
+libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) \
+ $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS) \
+ $(libffi_darwin_rpath)
libffi_la_DEPENDENCIES = $(libffi_la_LIBADD) $(libffi_version_dep)
AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
diff --git a/libffi/Makefile.in b/libffi/Makefile.in
index 1d936b5c8a5..71469f7d632 100644
--- a/libffi/Makefile.in
+++ b/libffi/Makefile.in
@@ -597,7 +597,11 @@ AM_CFLAGS = -Wall -g -fexceptions $(CET_FLAGS) $(am__append_2)
@LIBFFI_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBFFI_BUILD_VERSIONED_SHLIB_TRUE@libffi_version_dep = libffi.map
@LIBFFI_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBFFI_BUILD_VERSIONED_SHLIB_TRUE@libffi_version_dep = libffi.map-sun
libffi_version_info = -version-info `grep -v '^\#' $(srcdir)/libtool-version`
-libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libffi_darwin_rpath = -Wl,-rpath,@loader_path
+libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) \
+ $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS) \
+ $(libffi_darwin_rpath)
+
libffi_la_DEPENDENCIES = $(libffi_la_LIBADD) $(libffi_version_dep)
AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
AM_CCASFLAGS = $(AM_CPPFLAGS) $(CET_FLAGS)
diff --git a/libffi/configure b/libffi/configure
index 9eac9c907bf..29054551f7e 100755
--- a/libffi/configure
+++ b/libffi/configure
@@ -667,6 +667,8 @@ MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
READELF
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
CXXCPP
CPP
OTOOL64
@@ -810,6 +812,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
enable_pax_emutramp
enable_debug
@@ -1465,6 +1468,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -7835,7 +7841,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9809,6 +9815,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9826,9 +9875,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11634,7 +11687,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11637 "configure"
+#line 11690 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11740,7 +11793,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11743 "configure"
+#line 11796 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12616,6 +12669,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -12633,12 +12729,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15008,6 +15112,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# Only expand once:
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}readelf", so it can be a program name with args.
@@ -17153,6 +17265,10 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libffi/configure.ac b/libffi/configure.ac
index 014d89d0423..716f20ae313 100644
--- a/libffi/configure.ac
+++ b/libffi/configure.ac
@@ -55,6 +55,7 @@ AC_SUBST(CET_FLAGS)
AM_PROG_AS
AM_PROG_CC_C_O
AC_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
AC_CHECK_TOOL(READELF, readelf)
diff --git a/libffi/doc/version.texi b/libffi/doc/version.texi
index f2b741e87e4..6261b21fec9 100644
--- a/libffi/doc/version.texi
+++ b/libffi/doc/version.texi
@@ -1,4 +1,4 @@
-@set UPDATED 27 June 2021
-@set UPDATED-MONTH June 2021
+@set UPDATED 31 August 2022
+@set UPDATED-MONTH August 2022
@set EDITION 3.4.2
@set VERSION 3.4.2
diff --git a/libgcc/config.host b/libgcc/config.host
index c94d69d84b7..d40cf55acb6 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -233,7 +233,6 @@ case ${host} in
;;
esac
tmake_file="$tmake_file t-slibgcc-darwin"
- # newer toolsets produce warnings when building for unsupported versions.
case ${host} in
*-*-darwin1[89]* | *-*-darwin2* )
tmake_file="t-darwin-min-8 $tmake_file"
@@ -251,6 +250,28 @@ case ${host} in
echo "Warning: libgcc configured to support macOS 10.5" 1>&2
;;
esac
+ # We are not using libtool to build the libs here, so we need to replicate
+ # a little of the logic around setting Darwin rpaths. Setting an explicit
+ # yes or no is honoured, otherwise we choose a suitable default.
+ # Sadly, this has to be kept in line with the rules in libtool.m4.
+ # This make fragment will override the setting in t-slibgcc-darwin so it
+ # must appear after it.
+ if test "x$enable_darwin_at_rpath" = "x"; then
+ echo "enable_darwin_at_rpath is unset" 1>&2
+ case ${host} in
+ *-darwin[45678]*) ;;
+ *-darwin9* | *-darwin1[01234]*) ;; # We might default these on later.
+ *-darwin*)
+ echo "but is needed after macOS 10.11 (setting it on)" 1>&2
+ enable_darwin_at_rpath=yes
+ ;;
+ esac
+ else
+ echo "enable_darwin_at_rpath is '$enable_darwin_at_rpath'" 1>&2
+ fi
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ tmake_file="$tmake_file t-darwin-rpath "
+ fi
extra_parts="crt3.o libd10-uwfef.a crttms.o crttme.o libemutls_w.a"
;;
*-*-dragonfly*)
diff --git a/libgcc/config/t-darwin-rpath b/libgcc/config/t-darwin-rpath
new file mode 100644
index 00000000000..e73d7f378b0
--- /dev/null
+++ b/libgcc/config/t-darwin-rpath
@@ -0,0 +1,2 @@
+# Use @rpath and add a search path to exes and dylibs that depend on this.
+SHLIB_RPATH = @rpath
diff --git a/libgcc/config/t-slibgcc-darwin b/libgcc/config/t-slibgcc-darwin
index cb0cbbdb1c5..da4886848e8 100644
--- a/libgcc/config/t-slibgcc-darwin
+++ b/libgcc/config/t-slibgcc-darwin
@@ -1,4 +1,4 @@
-# Build a shared libgcc library with the darwin linker.
+# Build a shared libgcc library able to use embedded runpaths.
SHLIB_SOVERSION = 1.1
SHLIB_SO_MINVERSION = 1
@@ -6,7 +6,6 @@ SHLIB_VERSTRING = -compatibility_version $(SHLIB_SO_MINVERSION) \
-current_version $(SHLIB_SOVERSION)
SHLIB_EXT = .dylib
SHLIB_LC = -lSystem
-SHLIB_INSTALL_DIR = $(slibdir)
SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
SHLIB_MKMAP_OPTS = -v leading_underscore=1
@@ -23,11 +22,16 @@ SHLIB_SONAME = @shlib_base_name@$(SHLIB_EXT)
# subdir. The code under MULTIBUILDTOP combines these into a single FAT
# library, that is what we eventually install.
+# When enable_darwin_at_rpath is true, use @rpath instead of $(slibdir) for
+# this and dylibs that depend on this. So this def must come first and be
+# overridden in a make fragment that depends on the rpath setting.
+SHLIB_RPATH = $(slibdir)
+
SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) $(LDFLAGS) -dynamiclib -nodefaultlibs \
- -install_name $(SHLIB_INSTALL_DIR)/$(SHLIB_INSTALL_NAME) \
+ -install_name $(SHLIB_RPATH)/$(SHLIB_INSTALL_NAME) \
-single_module -o $(SHLIB_DIR)/$(SHLIB_SONAME) \
-Wl,-exported_symbols_list,$(SHLIB_MAP) \
- $(SHLIB_VERSTRING) \
+ $(SHLIB_VERSTRING) -nodefaultrpaths \
@multilib_flags@ @shlib_objs@ $(SHLIB_LC)
# we do our own thing
@@ -63,9 +67,9 @@ EHS_INSTNAME = libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT)
libgcc_ehs$(SHLIB_EXT): $(LIBEHSOBJS) $(extra-parts)
mkdir -p $(MULTIDIR)
$(CC) $(LIBGCC2_CFLAGS) $(LDFLAGS) -dynamiclib -nodefaultlibs \
- -install_name $(SHLIB_INSTALL_DIR)/$(EHS_INSTNAME) \
+ -install_name $(SHLIB_RPATH)/$(EHS_INSTNAME) \
-o $(MULTIDIR)/libgcc_ehs$(SHLIB_EXT) $(SHLIB_VERSTRING) \
- $(LIBEHSOBJS) $(SHLIB_LC)
+ -nodefaultrpaths $(LIBEHSOBJS) $(SHLIB_LC)
all: libgcc_ehs$(SHLIB_EXT)
@@ -122,12 +126,12 @@ libgcc_s.1.dylib: all-multi libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT) \
cp ../$${mlib}/libgcc/$${mlib}/libgcc_ehs$(SHLIB_EXT) \
./libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} || exit 1 ; \
arch=`$(LIPO) -info libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} | sed -e 's/.*:\ //'` ; \
- $(CC) -arch $${arch} -nodefaultlibs -dynamiclib \
+ $(CC) -arch $${arch} -nodefaultlibs -dynamiclib -nodefaultrpaths \
-o libgcc_s.1$(SHLIB_EXT)_T_$${mlib} \
-Wl,-reexport_library,libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} \
-Wl,-reexport_library,libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} \
- -install_name $(SHLIB_INSTALL_DIR)/libgcc_s.1.dylib \
- -compatibility_version 1 -current_version 1 ; \
+ -install_name $(SHLIB_RPATH)/libgcc_s.1.dylib \
+ -compatibility_version 1 -current_version 1.1 ; \
done
$(LIPO) -output libgcc_s.1$(SHLIB_EXT) -create libgcc_s.1$(SHLIB_EXT)_T*
rm libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T*
@@ -141,13 +145,13 @@ libgcc_s.1.dylib: all-multi libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)
cp ../$${mlib}/libgcc/$${mlib}/libgcc_s$(SHLIB_EXT) \
./libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} || exit 1 ; \
arch=`$(LIPO) -info libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} | sed -e 's/.*:\ //'` ; \
- $(CC) -arch $${arch} -nodefaultlibs -dynamiclib \
+ $(CC) -arch $${arch} -nodefaultlibs -dynamiclib -nodefaultrpaths \
-o libgcc_s.1$(SHLIB_EXT)_T_$${mlib} \
-Wl,-reexport_library,libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} \
-lSystem \
-Wl,-reexported_symbols_list,$(srcdir)/config/darwin-unwind.ver \
- -install_name $(SHLIB_INSTALL_DIR)/libgcc_s.1.dylib \
- -compatibility_version 1 -current_version 1 ; \
+ -install_name $(SHLIB_RPATH)/libgcc_s.1.dylib \
+ -compatibility_version 1 -current_version 1.1 ; \
done
$(LIPO) -output libgcc_s.1$(SHLIB_EXT) -create libgcc_s.1$(SHLIB_EXT)_T*
rm libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T*
diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am
index 9fab07c9a50..9f8a4f69863 100644
--- a/libgfortran/Makefile.am
+++ b/libgfortran/Makefile.am
@@ -37,6 +37,11 @@ else
version_arg =
version_dep =
endif
+extra_darwin_ldflags_libgfortran = @extra_ldflags_libgfortran@
+if ENABLE_DARWIN_AT_RPATH
+extra_darwin_ldflags_libgfortran += -Wc,-nodefaultrpaths
+extra_darwin_ldflags_libgfortran += -Wl,-rpath,@loader_path
+endif
gfor_c_HEADERS = ISO_Fortran_binding.h
gfor_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
@@ -50,7 +55,7 @@ libgfortran_la_LINK = $(LINK) $(libgfortran_la_LDFLAGS)
libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
$(LTLDFLAGS) $(LIBQUADLIB) ../libbacktrace/libbacktrace.la \
$(HWCAP_LDFLAGS) \
- $(LIBM) $(extra_ldflags_libgfortran) \
+ $(LIBM) $(extra_darwin_ldflags_libgfortran) \
$(version_arg) -Wc,-shared-libgcc
libgfortran_la_DEPENDENCIES = $(version_dep) libgfortran.spec $(LIBQUADLIB_DEP)
diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in
index e8627f9a4bc..30d1dc56da7 100644
--- a/libgfortran/Makefile.in
+++ b/libgfortran/Makefile.in
@@ -91,8 +91,10 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-@LIBGFOR_MINIMAL_TRUE@am__append_1 = -DLIBGFOR_MINIMAL
-@LIBGFOR_MINIMAL_FALSE@am__append_2 = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+@LIBGFOR_MINIMAL_TRUE@am__append_2 = -DLIBGFOR_MINIMAL
+@LIBGFOR_MINIMAL_FALSE@am__append_3 = \
@LIBGFOR_MINIMAL_FALSE@io/close.c \
@LIBGFOR_MINIMAL_FALSE@io/file_pos.c \
@LIBGFOR_MINIMAL_FALSE@io/format.c \
@@ -110,7 +112,7 @@ target_triplet = @target@
@LIBGFOR_MINIMAL_FALSE@io/fbuf.c \
@LIBGFOR_MINIMAL_FALSE@io/async.c
-@LIBGFOR_MINIMAL_FALSE@am__append_3 = \
+@LIBGFOR_MINIMAL_FALSE@am__append_4 = \
@LIBGFOR_MINIMAL_FALSE@intrinsics/access.c \
@LIBGFOR_MINIMAL_FALSE@intrinsics/c99_functions.c \
@LIBGFOR_MINIMAL_FALSE@intrinsics/chdir.c \
@@ -143,9 +145,9 @@ target_triplet = @target@
@LIBGFOR_MINIMAL_FALSE@intrinsics/umask.c \
@LIBGFOR_MINIMAL_FALSE@intrinsics/unlink.c
-@IEEE_SUPPORT_TRUE@am__append_4 = ieee/ieee_helper.c
-@LIBGFOR_MINIMAL_TRUE@am__append_5 = runtime/minimal.c
-@LIBGFOR_MINIMAL_FALSE@am__append_6 = \
+@IEEE_SUPPORT_TRUE@am__append_5 = ieee/ieee_helper.c
+@LIBGFOR_MINIMAL_TRUE@am__append_6 = runtime/minimal.c
+@LIBGFOR_MINIMAL_FALSE@am__append_7 = \
@LIBGFOR_MINIMAL_FALSE@runtime/backtrace.c \
@LIBGFOR_MINIMAL_FALSE@runtime/convert_char.c \
@LIBGFOR_MINIMAL_FALSE@runtime/environ.c \
@@ -584,7 +586,7 @@ AMTAR = @AMTAR@
# Some targets require additional compiler options for IEEE compatibility.
AM_CFLAGS = @AM_CFLAGS@ -fcx-fortran-rules $(SECTION_FLAGS) \
- $(IEEE_FLAGS) $(am__append_1)
+ $(IEEE_FLAGS) $(am__append_2)
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ $(IEEE_FLAGS)
AR = @AR@
@@ -743,6 +745,8 @@ gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
@LIBGFOR_USE_SYMVER_FALSE@version_dep =
@LIBGFOR_USE_SYMVER_GNU_TRUE@@LIBGFOR_USE_SYMVER_TRUE@version_dep = gfortran.ver
@LIBGFOR_USE_SYMVER_SUN_TRUE@@LIBGFOR_USE_SYMVER_TRUE@version_dep = gfortran.ver-sun gfortran.ver
+extra_darwin_ldflags_libgfortran = @extra_ldflags_libgfortran@ \
+ $(am__append_1)
gfor_c_HEADERS = ISO_Fortran_binding.h
gfor_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) \
@@ -754,7 +758,7 @@ libgfortran_la_LINK = $(LINK) $(libgfortran_la_LDFLAGS)
libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
$(LTLDFLAGS) $(LIBQUADLIB) ../libbacktrace/libbacktrace.la \
$(HWCAP_LDFLAGS) \
- $(LIBM) $(extra_ldflags_libgfortran) \
+ $(LIBM) $(extra_darwin_ldflags_libgfortran) \
$(version_arg) -Wc,-shared-libgcc
libgfortran_la_DEPENDENCIES = $(version_dep) libgfortran.spec $(LIBQUADLIB_DEP)
@@ -775,7 +779,7 @@ AM_CPPFLAGS = -iquote$(srcdir)/io -I$(srcdir)/$(MULTISRCTOP)../gcc \
-I$(MULTIBUILDTOP)../libbacktrace \
-I../libbacktrace
-gfor_io_src = io/size_from_kind.c $(am__append_2)
+gfor_io_src = io/size_from_kind.c $(am__append_3)
gfor_io_headers = \
io/io.h \
io/fbuf.h \
@@ -797,7 +801,7 @@ gfor_helper_src = intrinsics/associated.c intrinsics/abort.c \
intrinsics/selected_int_kind.f90 \
intrinsics/selected_real_kind.f90 intrinsics/trigd.c \
intrinsics/unpack_generic.c runtime/in_pack_generic.c \
- runtime/in_unpack_generic.c $(am__append_3) $(am__append_4)
+ runtime/in_unpack_generic.c $(am__append_4) $(am__append_5)
@IEEE_SUPPORT_TRUE@gfor_ieee_helper_src = ieee/ieee_helper.c
@IEEE_SUPPORT_FALSE@gfor_ieee_src =
@IEEE_SUPPORT_TRUE@gfor_ieee_src = \
@@ -806,8 +810,8 @@ gfor_helper_src = intrinsics/associated.c intrinsics/abort.c \
@IEEE_SUPPORT_TRUE@ieee/ieee_features.F90
gfor_src = runtime/bounds.c runtime/compile_options.c runtime/memory.c \
- runtime/string.c runtime/select.c $(am__append_5) \
- $(am__append_6)
+ runtime/string.c runtime/select.c $(am__append_6) \
+ $(am__append_7)
i_all_c = \
$(srcdir)/generated/all_l1.c \
$(srcdir)/generated/all_l2.c \
diff --git a/libgfortran/configure b/libgfortran/configure
index cd176b04a14..774dd52fc95 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -654,6 +654,8 @@ extra_ldflags_libgfortran
ac_ct_FC
FCFLAGS
FC
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -819,6 +821,7 @@ enable_static
with_pic
enable_fast_install
enable_libtool_lock
+enable_darwin_at_rpath
enable_largefile
enable_libquadmath_support
with_gcc_major_version_only
@@ -1473,6 +1476,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--disable-largefile omit support for large files
--disable-libquadmath-support
disable libquadmath support for Fortran
@@ -9243,7 +9249,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10953,6 +10959,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10970,9 +11019,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12799,7 +12852,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12802 "configure"
+#line 12855 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12905,7 +12958,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12908 "configure"
+#line 12961 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13307,6 +13360,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
#AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10
# We need gfortran to compile parts of the library
@@ -14950,6 +15011,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_FC=no
hardcode_direct_FC=no
hardcode_automatic_FC=yes
@@ -14967,9 +15071,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_FC="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_FC="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -16242,9 +16350,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# extra LD Flags which are required for targets
+extra_ldflags_libgfortran=
case "${host}" in
- *-darwin*)
- # Darwin needs -single_module when linking libgfortran
+ *-*-darwin[4567]*)
+ # Earlier Darwin needs -single_module when linking libgfortran
extra_ldflags_libgfortran=-Wl,-single_module
;;
esac
@@ -31601,6 +31710,10 @@ if test -z "${HAVE_HWCAP_TRUE}" && test -z "${HAVE_HWCAP_FALSE}"; then
as_fn_error $? "conditional \"HAVE_HWCAP\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${IEEE_SUPPORT_TRUE}" && test -z "${IEEE_SUPPORT_FALSE}"; then
as_fn_error $? "conditional \"IEEE_SUPPORT\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index 8bd2af966c8..46585a3ee14 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -269,6 +269,7 @@ LT_LIB_M
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
#AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10
# We need gfortran to compile parts of the library
@@ -277,9 +278,10 @@ FC="$GFORTRAN"
AC_PROG_FC(gfortran)
# extra LD Flags which are required for targets
+extra_ldflags_libgfortran=
case "${host}" in
- *-darwin*)
- # Darwin needs -single_module when linking libgfortran
+ *-*-darwin[[4567]]*)
+ # Earlier Darwin needs -single_module when linking libgfortran
extra_ldflags_libgfortran=-Wl,-single_module
;;
esac
diff --git a/libgm2/Makefile.am b/libgm2/Makefile.am
index 95df3ed7a30..aa35e747c9a 100644
--- a/libgm2/Makefile.am
+++ b/libgm2/Makefile.am
@@ -46,6 +46,12 @@ SUBDIRS = libm2min libm2log libm2cor libm2iso libm2pim
GM2_BUILDDIR := $(shell pwd)
gm2_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
+if ENABLE_DARWIN_AT_RPATH
+DARWIN_AT_RPATH=yes
+else
+DARWIN_AT_RPATH=yes
+endif
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
# friends when we are called from the top level Makefile.
@@ -91,7 +97,8 @@ AM_MAKEFLAGS = \
"WERROR=$(WERROR)" \
"TARGET_LIB_PATH=$(TARGET_LIB_PATH)" \
"TARGET_LIB_PATH_libgm2=$(TARGET_LIB_PATH_libgm2)" \
- "LIBTOOL=$(GM2_BUILDDIR)/libtool"
+ "LIBTOOL=$(GM2_BUILDDIR)/libtool" \
+ "DARWIN_AT_RPATH=$(DARWIN_AT_RPATH)"
# Subdir rules rely on $(FLAGS_TO_PASS)
FLAGS_TO_PASS = $(AM_MAKEFLAGS)
diff --git a/libgm2/Makefile.in b/libgm2/Makefile.in
index c0396791f48..e8fa4aa52dc 100644
--- a/libgm2/Makefile.in
+++ b/libgm2/Makefile.in
@@ -90,15 +90,15 @@ host_triplet = @host@
target_triplet = @target@
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
@@ -343,6 +343,8 @@ GM2_SRC = $(GCC_DIR)/m2
SUBDIRS = libm2min libm2log libm2cor libm2iso libm2pim
GM2_BUILDDIR := $(shell pwd)
gm2_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
+@ENABLE_DARWIN_AT_RPATH_FALSE@DARWIN_AT_RPATH = yes
+@ENABLE_DARWIN_AT_RPATH_TRUE@DARWIN_AT_RPATH = yes
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
@@ -389,7 +391,8 @@ AM_MAKEFLAGS = \
"WERROR=$(WERROR)" \
"TARGET_LIB_PATH=$(TARGET_LIB_PATH)" \
"TARGET_LIB_PATH_libgm2=$(TARGET_LIB_PATH_libgm2)" \
- "LIBTOOL=$(GM2_BUILDDIR)/libtool"
+ "LIBTOOL=$(GM2_BUILDDIR)/libtool" \
+ "DARWIN_AT_RPATH=$(DARWIN_AT_RPATH)"
# Subdir rules rely on $(FLAGS_TO_PASS)
diff --git a/libgm2/aclocal.m4 b/libgm2/aclocal.m4
index c352303012d..832065fbb9b 100644
--- a/libgm2/aclocal.m4
+++ b/libgm2/aclocal.m4
@@ -1187,14 +1187,14 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
-m4_include([../libtool.m4])
-m4_include([../ltoptions.m4])
-m4_include([../ltsugar.m4])
-m4_include([../ltversion.m4])
-m4_include([../lt~obsolete.m4])
m4_include([../config/acx.m4])
m4_include([../config/depstand.m4])
m4_include([../config/lead-dot.m4])
m4_include([../config/multi.m4])
m4_include([../config/no-executables.m4])
m4_include([../config/override.m4])
+m4_include([../libtool.m4])
+m4_include([../ltoptions.m4])
+m4_include([../ltsugar.m4])
+m4_include([../ltversion.m4])
+m4_include([../lt~obsolete.m4])
diff --git a/libgm2/configure b/libgm2/configure
index 072d584544e..d55a7f4a74b 100755
--- a/libgm2/configure
+++ b/libgm2/configure
@@ -649,6 +649,8 @@ GM2_FOR_TARGET
CC_FOR_BUILD
enable_static
enable_shared
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
CXXCPP
OTOOL64
OTOOL
@@ -805,6 +807,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
with_gcc_major_version_only
'
ac_precious_vars='build_alias
@@ -1455,6 +1458,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -6569,10 +6575,6 @@ fi
-enable_dlopen=yes
-
-
-
case `pwd` in
*\ * | *\ *)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
@@ -9181,7 +9183,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9229,6 +9231,8 @@ done
+ enable_dlopen=no
+
enable_win32_dll=no
@@ -10892,6 +10896,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10909,9 +10956,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12738,7 +12789,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12741 "configure"
+#line 12792 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12844,7 +12895,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12847 "configure"
+#line 12898 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13726,6 +13777,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13743,12 +13837,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -16122,6 +16224,21 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+enable_dlopen=yes
+
+
+
+
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
+
if test "${multilib}" = "yes"; then
@@ -20310,6 +20427,10 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${BUILD_PIMLIB_TRUE}" && test -z "${BUILD_PIMLIB_FALSE}"; then
as_fn_error $? "conditional \"BUILD_PIMLIB\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgm2/configure.ac b/libgm2/configure.ac
index 92e76c9346c..5701b95878b 100644
--- a/libgm2/configure.ac
+++ b/libgm2/configure.ac
@@ -212,8 +212,12 @@ AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
AC_PROG_MAKE_SET
AC_PROG_INSTALL
-AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
+LT_INIT
+AC_LIBTOOL_DLOPEN
+
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
diff --git a/libgm2/libm2cor/Makefile.am b/libgm2/libm2cor/Makefile.am
index 48de40c22dd..e50c7a2ef55 100644
--- a/libgm2/libm2cor/Makefile.am
+++ b/libgm2/libm2cor/Makefile.am
@@ -123,6 +123,10 @@ libm2cor_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2cor_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2cor_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
+
libm2cor_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2cor_la_link_flags)
BUILT_SOURCES = SYSTEM.def
CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2cor/Makefile.in b/libgm2/libm2cor/Makefile.in
index 3b0b40fea60..cc8a3fa73ed 100644
--- a/libgm2/libm2cor/Makefile.in
+++ b/libgm2/libm2cor/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@BUILD_CORLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2cor
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -468,8 +469,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_CORLIB_TRUE@ -fm2-pathname=m2iso -I$(GM2_SRC)/gm2-libs-iso \
@BUILD_CORLIB_TRUE@ -fm2-g -g -Wreturn-type -fcase -fm2-prefix=m2cor
-@BUILD_CORLIB_TRUE@@TARGET_DARWIN_FALSE@libm2cor_la_link_flags =
-@BUILD_CORLIB_TRUE@@TARGET_DARWIN_TRUE@libm2cor_la_link_flags = -Wl,-undefined,dynamic_lookup
+@BUILD_CORLIB_TRUE@@TARGET_DARWIN_FALSE@libm2cor_la_link_flags = \
+@BUILD_CORLIB_TRUE@@TARGET_DARWIN_FALSE@ $(am__append_1)
+@BUILD_CORLIB_TRUE@@TARGET_DARWIN_TRUE@libm2cor_la_link_flags = -Wl,-undefined,dynamic_lookup \
+@BUILD_CORLIB_TRUE@@TARGET_DARWIN_TRUE@ $(am__append_1)
@BUILD_CORLIB_TRUE@libm2cor_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2cor_la_link_flags)
@BUILD_CORLIB_TRUE@BUILT_SOURCES = SYSTEM.def
@BUILD_CORLIB_TRUE@CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2iso/Makefile.am b/libgm2/libm2iso/Makefile.am
index 1386f156cab..4d8e897266f 100644
--- a/libgm2/libm2iso/Makefile.am
+++ b/libgm2/libm2iso/Makefile.am
@@ -197,6 +197,10 @@ libm2iso_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2iso_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2iso_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
+
libm2iso_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2iso_la_link_flags)
CLEANFILES = SYSTEM.def
BUILT_SOURCES = SYSTEM.def
diff --git a/libgm2/libm2iso/Makefile.in b/libgm2/libm2iso/Makefile.in
index b939581b7c1..08563adfe78 100644
--- a/libgm2/libm2iso/Makefile.in
+++ b/libgm2/libm2iso/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@BUILD_ISOLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2iso
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -569,8 +570,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_ISOLIB_TRUE@ -fm2-pathname=m2pim -I$(GM2_SRC)/gm2-libs \
@BUILD_ISOLIB_TRUE@ -fiso -fextended-opaque -fm2-g -g -Wreturn-type -fcase -fm2-prefix=m2iso
-@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_FALSE@libm2iso_la_link_flags =
-@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_TRUE@libm2iso_la_link_flags = -Wl,-undefined,dynamic_lookup
+@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_FALSE@libm2iso_la_link_flags = \
+@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_FALSE@ $(am__append_1)
+@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_TRUE@libm2iso_la_link_flags = -Wl,-undefined,dynamic_lookup \
+@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_TRUE@ $(am__append_1)
@BUILD_ISOLIB_TRUE@libm2iso_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2iso_la_link_flags)
@BUILD_ISOLIB_TRUE@CLEANFILES = SYSTEM.def
@BUILD_ISOLIB_TRUE@BUILT_SOURCES = SYSTEM.def
diff --git a/libgm2/libm2log/Makefile.am b/libgm2/libm2log/Makefile.am
index a15747fd245..3b7609ee5c1 100644
--- a/libgm2/libm2log/Makefile.am
+++ b/libgm2/libm2log/Makefile.am
@@ -142,6 +142,9 @@ libm2log_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2log_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2log_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
libm2log_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2log_la_link_flags)
BUILT_SOURCES = ../libm2pim/SYSTEM.def
diff --git a/libgm2/libm2log/Makefile.in b/libgm2/libm2log/Makefile.in
index ba34a6b445a..fa12a386c55 100644
--- a/libgm2/libm2log/Makefile.in
+++ b/libgm2/libm2log/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@BUILD_LOGLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2log
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -477,8 +478,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_LOGLIB_TRUE@ -fm2-pathname=m2iso -I$(GM2_SRC)/gm2-libs-iso \
@BUILD_LOGLIB_TRUE@ -Wreturn-type -fcase -fm2-prefix=m2log
-@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_FALSE@libm2log_la_link_flags =
-@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_TRUE@libm2log_la_link_flags = -Wl,-undefined,dynamic_lookup
+@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_FALSE@libm2log_la_link_flags = \
+@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_FALSE@ $(am__append_1)
+@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_TRUE@libm2log_la_link_flags = -Wl,-undefined,dynamic_lookup \
+@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_TRUE@ $(am__append_1)
@BUILD_LOGLIB_TRUE@libm2log_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2log_la_link_flags)
@BUILD_LOGLIB_TRUE@BUILT_SOURCES = ../libm2pim/SYSTEM.def
@BUILD_LOGLIB_TRUE@M2LIBDIR = /m2/m2log/
diff --git a/libgm2/libm2min/Makefile.am b/libgm2/libm2min/Makefile.am
index 1ff160028f6..21411769505 100644
--- a/libgm2/libm2min/Makefile.am
+++ b/libgm2/libm2min/Makefile.am
@@ -113,6 +113,9 @@ libm2min_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2min_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2min_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
libm2min_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2min_la_link_flags)
BUILT_SOURCES = SYSTEM.def
CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2min/Makefile.in b/libgm2/libm2min/Makefile.in
index 9ead8397fd0..73af6568b88 100644
--- a/libgm2/libm2min/Makefile.in
+++ b/libgm2/libm2min/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2min
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -441,8 +442,10 @@ libm2min_la_M2FLAGS = \
-fm2-pathname=m2pim -I$(GM2_SRC)/gm2-libs -fno-exceptions \
-fno-m2-plugin -fno-scaffold-dynamic -fno-scaffold-main -fm2-prefix=m2min
-@TARGET_DARWIN_FALSE@libm2min_la_link_flags =
-@TARGET_DARWIN_TRUE@libm2min_la_link_flags = -Wl,-undefined,dynamic_lookup
+@TARGET_DARWIN_FALSE@libm2min_la_link_flags = $(am__append_1)
+@TARGET_DARWIN_TRUE@libm2min_la_link_flags = \
+@TARGET_DARWIN_TRUE@ -Wl,-undefined,dynamic_lookup \
+@TARGET_DARWIN_TRUE@ $(am__append_1)
libm2min_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2min_la_link_flags)
BUILT_SOURCES = SYSTEM.def
CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2pim/Makefile.am b/libgm2/libm2pim/Makefile.am
index ebfeba1ac1d..e777a60c077 100644
--- a/libgm2/libm2pim/Makefile.am
+++ b/libgm2/libm2pim/Makefile.am
@@ -175,6 +175,9 @@ libm2pim_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2pim_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2pim_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
libm2pim_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2pim_la_link_flags)
BUILT_SOURCES = SYSTEM.def
CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2pim/Makefile.in b/libgm2/libm2pim/Makefile.in
index 660488f9692..54414058bc5 100644
--- a/libgm2/libm2pim/Makefile.in
+++ b/libgm2/libm2pim/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@BUILD_PIMLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2pim
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -538,8 +539,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_PIMLIB_TRUE@ -fm2-pathname=m2iso -I$(GM2_SRC)/gm2-libs-iso \
@BUILD_PIMLIB_TRUE@ -fm2-g -g -Wreturn-type -fcase -fm2-prefix=m2pim
-@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_FALSE@libm2pim_la_link_flags =
-@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_TRUE@libm2pim_la_link_flags = -Wl,-undefined,dynamic_lookup
+@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_FALSE@libm2pim_la_link_flags = \
+@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_FALSE@ $(am__append_1)
+@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_TRUE@libm2pim_la_link_flags = -Wl,-undefined,dynamic_lookup \
+@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_TRUE@ $(am__append_1)
@BUILD_PIMLIB_TRUE@libm2pim_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2pim_la_link_flags)
@BUILD_PIMLIB_TRUE@BUILT_SOURCES = SYSTEM.def
@BUILD_PIMLIB_TRUE@CLEANFILES = SYSTEM.def
diff --git a/libgo/configure b/libgo/configure
index a607dbff68e..72d46c3eec3 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -708,6 +708,8 @@ glibgo_toolexecdir
WERROR
WARN_FLAGS
CC_FOR_BUILD
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
CPP
@@ -11544,7 +11546,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11547 "configure"
+#line 11549 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11650,7 +11652,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11653 "configure"
+#line 11655 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13779,6 +13781,14 @@ CC="$lt_save_CC"
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
CC_FOR_BUILD=${CC_FOR_BUILD:-gcc}
@@ -16386,6 +16396,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${USE_LIBFFI_TRUE}" && test -z "${USE_LIBFFI_FALSE}"; then
as_fn_error $? "conditional \"USE_LIBFFI\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgo/configure.ac b/libgo/configure.ac
index a59aa091d1d..6f1ac32660b 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -53,6 +53,7 @@ AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
CC_FOR_BUILD=${CC_FOR_BUILD:-gcc}
AC_SUBST(CC_FOR_BUILD)
diff --git a/libgomp/Makefile.am b/libgomp/Makefile.am
index 428f7a9dab5..ceb8c910abd 100644
--- a/libgomp/Makefile.am
+++ b/libgomp/Makefile.am
@@ -53,9 +53,14 @@ else
libgomp_version_script =
libgomp_version_dep =
endif
+
libgomp_version_info = -version-info $(libtool_VERSION)
+if ENABLE_DARWIN_AT_RPATH
+libgomp_darwin_rpath = -Wc,-nodefaultrpaths
+libgomp_darwin_rpath += -Wl,-rpath,@loader_path
+endif
libgomp_la_LDFLAGS = $(libgomp_version_info) $(libgomp_version_script) \
- $(lt_host_flags)
+ $(lt_host_flags) $(libgomp_darwin_rpath)
libgomp_la_LIBADD =
libgomp_la_DEPENDENCIES = $(libgomp_version_dep)
libgomp_la_LINK = $(LINK) $(libgomp_la_LDFLAGS)
diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
index 3ef05e6a3cb..2467250215e 100644
--- a/libgomp/Makefile.in
+++ b/libgomp/Makefile.in
@@ -535,8 +535,11 @@ nodist_toolexeclib_HEADERS = libgomp.spec
@LIBGOMP_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgomp_version_dep = libgomp.ver
@LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgomp_version_dep = libgomp.ver-sun
libgomp_version_info = -version-info $(libtool_VERSION)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libgomp_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
libgomp_la_LDFLAGS = $(libgomp_version_info) $(libgomp_version_script) \
- $(lt_host_flags)
+ $(lt_host_flags) $(libgomp_darwin_rpath)
libgomp_la_LIBADD = $(DL_LIBS)
libgomp_la_DEPENDENCIES = $(libgomp_version_dep)
diff --git a/libgomp/configure b/libgomp/configure
index a12b30f1b0f..7c103cf37f1 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -683,6 +683,8 @@ CXX
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -822,6 +824,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
enable_linux_futex
enable_tls
@@ -1477,6 +1480,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -7618,7 +7624,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9591,6 +9597,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9608,9 +9657,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11416,7 +11469,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11419 "configure"
+#line 11472 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11522,7 +11575,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11525 "configure"
+#line 11578 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11783,6 +11836,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
@@ -13469,6 +13530,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_FC=no
hardcode_direct_FC=no
hardcode_automatic_FC=yes
@@ -13486,9 +13590,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_FC="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_FC="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -17130,6 +17238,10 @@ if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then
as_fn_error $? "conditional \"BUILD_INFO\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index 1aad83a79da..8c941cddd2f 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -148,6 +148,7 @@ AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
AM_MAINTAINER_MODE
diff --git a/libitm/Makefile.am b/libitm/Makefile.am
index 3f31ad30556..a25317b07fe 100644
--- a/libitm/Makefile.am
+++ b/libitm/Makefile.am
@@ -54,7 +54,12 @@ libitm_version_info = -version-info $(libtool_VERSION)
# want or need libstdc++.
libitm_la_DEPENDENCIES = $(libitm_version_dep)
libitm_la_LINK = $(LINK) $(libitm_la_LDFLAGS)
-libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script)
+if ENABLE_DARWIN_AT_RPATH
+libitm_darwin_rpath = -Wc,-nodefaultrpaths
+libitm_darwin_rpath += -Wl,-rpath,@loader_path
+endif
+libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script) \
+ $(libitm_darwin_rpath)
libitm_la_SOURCES = \
aatree.cc alloc.cc alloc_c.cc alloc_cpp.cc barrier.cc beginend.cc \
diff --git a/libitm/Makefile.in b/libitm/Makefile.in
index 7c51fe02511..9f0691018a9 100644
--- a/libitm/Makefile.in
+++ b/libitm/Makefile.in
@@ -480,7 +480,12 @@ libitm_version_info = -version-info $(libtool_VERSION)
# want or need libstdc++.
libitm_la_DEPENDENCIES = $(libitm_version_dep)
libitm_la_LINK = $(LINK) $(libitm_la_LDFLAGS)
-libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libitm_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script) \
+ $(libitm_darwin_rpath)
+
libitm_la_SOURCES = aatree.cc alloc.cc alloc_c.cc alloc_cpp.cc \
barrier.cc beginend.cc clone.cc eh_cpp.cc local.cc query.cc \
retry.cc rwlock.cc useraction.cc util.cc sjlj.S tls.cc \
diff --git a/libitm/configure b/libitm/configure
index 02e8de7896b..9ba7fb03a57 100755
--- a/libitm/configure
+++ b/libitm/configure
@@ -660,6 +660,8 @@ libtool_VERSION
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
CXXCPP
@@ -809,6 +811,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
enable_linux_futex
enable_tls
@@ -1461,6 +1464,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -8279,7 +8285,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10253,6 +10259,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10270,9 +10319,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12078,7 +12131,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12081 "configure"
+#line 12134 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12184,7 +12237,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12187 "configure"
+#line 12240 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13060,6 +13113,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13077,12 +13173,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15454,6 +15558,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
@@ -18212,6 +18324,10 @@ if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then
as_fn_error $? "conditional \"BUILD_INFO\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libitm/configure.ac b/libitm/configure.ac
index 892a24caa85..dded4d387be 100644
--- a/libitm/configure.ac
+++ b/libitm/configure.ac
@@ -156,6 +156,7 @@ AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes")
AM_PROG_LIBTOOL
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
AM_MAINTAINER_MODE
diff --git a/libobjc/configure b/libobjc/configure
index 752f6fdfebd..68172549137 100755
--- a/libobjc/configure
+++ b/libobjc/configure
@@ -636,6 +636,9 @@ OBJC_BOEHM_GC_LIBS
OBJC_BOEHM_GC_INCLUDES
OBJC_BOEHM_GC
OBJC_GCFLAGS
+extra_ldflags_libobjc
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
SET_MAKE
CPP
OTOOL64
@@ -667,7 +670,6 @@ RANLIB
AR
AS
XCFLAGS
-extra_ldflags_libobjc
lt_host_flags
OBJEXT
EXEEXT
@@ -755,6 +757,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_tls
enable_objc_gc
with_target_bdw_gc
@@ -1392,6 +1395,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-tls Use thread-local storage [default=yes]
--enable-objc-gc enable use of Boehm's garbage collector with the GNU
Objective-C runtime
@@ -3431,17 +3437,6 @@ esac
-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
-
# Add CET specific flags if CET is enabled
@@ -7011,7 +7006,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -8988,6 +8983,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9005,9 +9043,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -10834,7 +10876,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10837 "configure"
+#line 10879 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10940,7 +10982,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10943 "configure"
+#line 10985 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11212,6 +11254,38 @@ $as_echo "no" >&6; }
fi
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
+# 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
+
+
# -------
# Headers
# -------
@@ -11953,6 +12027,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/libobjc/configure.ac b/libobjc/configure.ac
index 9bd7d59d597..cb21ebbfcc7 100644
--- a/libobjc/configure.ac
+++ b/libobjc/configure.ac
@@ -148,17 +148,6 @@ m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
# 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)
@@ -183,6 +172,31 @@ AM_PROG_CC_C_O
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
# -------
diff --git a/libphobos/configure b/libphobos/configure
index b7276d95010..25b13bdd93e 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -707,6 +707,8 @@ get_gcc_base_ver
phobos_compiler_shared_flag
phobos_compiler_pic_flag
phobos_lt_pic_flag
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
OTOOL64
@@ -838,6 +840,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
with_gcc_major_version_only
enable_werror
with_libatomic
@@ -1490,6 +1493,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-werror turns on -Werror [default=no]
--enable-version-specific-runtime-libs
Specify that runtime libraries should be installed
@@ -8282,7 +8288,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9987,6 +9993,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10004,9 +10053,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11812,7 +11865,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11815 "configure"
+#line 11868 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11918,7 +11971,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11921 "configure"
+#line 11974 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13443,6 +13496,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_D=no
hardcode_direct_D=no
hardcode_automatic_D=yes
@@ -13460,9 +13556,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_D="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_D="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_D="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_D="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_D="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_D="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -14064,6 +14164,14 @@ CFLAGS=$lt_save_CFLAGS
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
# libtool variables for Phobos shared and position-independent compiles.
#
@@ -15877,6 +15985,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${DRUNTIME_CPU_AARCH64_TRUE}" && test -z "${DRUNTIME_CPU_AARCH64_FALSE}"; then
as_fn_error $? "conditional \"DRUNTIME_CPU_AARCH64\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libphobos/configure.ac b/libphobos/configure.ac
index 3b2e6df5d5c..bb669675ce0 100644
--- a/libphobos/configure.ac
+++ b/libphobos/configure.ac
@@ -93,6 +93,7 @@ AM_PROG_LIBTOOL
WITH_LOCAL_DRUNTIME([LT_LANG([D])], [])
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
# libtool variables for Phobos shared and position-independent compiles.
#
diff --git a/libphobos/libdruntime/Makefile.am b/libphobos/libdruntime/Makefile.am
index 832a0524ab3..b78bcdd203f 100644
--- a/libphobos/libdruntime/Makefile.am
+++ b/libphobos/libdruntime/Makefile.am
@@ -128,8 +128,11 @@ ALL_DRUNTIME_SOURCES = $(DRUNTIME_DSOURCES) $(DRUNTIME_CSOURCES) \
toolexeclib_LTLIBRARIES = libgdruntime.la
libgdruntime_la_SOURCES = $(ALL_DRUNTIME_SOURCES)
libgdruntime_la_LIBTOOLFLAGS =
+if ENABLE_DARWIN_AT_RPATH
+libgdruntime_darwin_rpath = -Wl,-rpath,@loader_path
+endif
libgdruntime_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../src,-Bgcc \
- -version-info $(libtool_VERSION)
+ -version-info $(libtool_VERSION) $(libgdruntime_darwin_rpath)
libgdruntime_la_LIBADD = $(LIBATOMIC) $(LIBBACKTRACE)
libgdruntime_la_DEPENDENCIES = $(DRTSTUFF)
# Also override library link commands: This is not strictly
diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in
index 61a2a770888..4d62985349b 100644
--- a/libphobos/libdruntime/Makefile.in
+++ b/libphobos/libdruntime/Makefile.in
@@ -813,8 +813,9 @@ ALL_DRUNTIME_SOURCES = $(DRUNTIME_DSOURCES) $(DRUNTIME_CSOURCES) \
toolexeclib_LTLIBRARIES = libgdruntime.la
libgdruntime_la_SOURCES = $(ALL_DRUNTIME_SOURCES)
libgdruntime_la_LIBTOOLFLAGS =
+@ENABLE_DARWIN_AT_RPATH_TRUE@libgdruntime_darwin_rpath = -Wl,-rpath,@loader_path
libgdruntime_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../src,-Bgcc \
- -version-info $(libtool_VERSION)
+ -version-info $(libtool_VERSION) $(libgdruntime_darwin_rpath)
libgdruntime_la_LIBADD = $(LIBATOMIC) $(LIBBACKTRACE)
libgdruntime_la_DEPENDENCIES = $(DRTSTUFF)
diff --git a/libphobos/src/Makefile.am b/libphobos/src/Makefile.am
index 6474fca5eb5..f6521ed5860 100644
--- a/libphobos/src/Makefile.am
+++ b/libphobos/src/Makefile.am
@@ -44,8 +44,11 @@ toolexeclib_DATA = libgphobos.spec
toolexeclib_LTLIBRARIES = libgphobos.la
libgphobos_la_SOURCES = $(ALL_PHOBOS_SOURCES)
libgphobos_la_LIBTOOLFLAGS =
+if ENABLE_DARWIN_AT_RPATH
+libgphobos_darwin_rpath = -Wl,-rpath,@loader_path
+endif
libgphobos_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../libdruntime/gcc \
- -version-info $(libtool_VERSION)
+ -version-info $(libtool_VERSION) $(libgphobos_darwin_rpath)
if ENABLE_LIBDRUNTIME_ONLY
libgphobos_la_LIBADD = ../libdruntime/libgdruntime_convenience.la
else
diff --git a/libphobos/src/Makefile.in b/libphobos/src/Makefile.in
index a6229587e7b..cc3358b437e 100644
--- a/libphobos/src/Makefile.in
+++ b/libphobos/src/Makefile.in
@@ -529,8 +529,9 @@ toolexeclib_DATA = libgphobos.spec
toolexeclib_LTLIBRARIES = libgphobos.la
libgphobos_la_SOURCES = $(ALL_PHOBOS_SOURCES)
libgphobos_la_LIBTOOLFLAGS =
+@ENABLE_DARWIN_AT_RPATH_TRUE@libgphobos_darwin_rpath = -Wl,-rpath,@loader_path
libgphobos_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../libdruntime/gcc \
- -version-info $(libtool_VERSION)
+ -version-info $(libtool_VERSION) $(libgphobos_darwin_rpath)
@ENABLE_LIBDRUNTIME_ONLY_FALSE@libgphobos_la_LIBADD = \
@ENABLE_LIBDRUNTIME_ONLY_FALSE@ ../libdruntime/libgdruntime_convenience.la $(LIBZ)
diff --git a/libquadmath/Makefile.am b/libquadmath/Makefile.am
index 35dffb46f6e..0d02c95e738 100644
--- a/libquadmath/Makefile.am
+++ b/libquadmath/Makefile.am
@@ -36,8 +36,13 @@ endif
toolexeclib_LTLIBRARIES = libquadmath.la
libquadmath_la_LIBADD =
+
+if ENABLE_DARWIN_AT_RPATH
+libquadmath_darwin_rpath = -Wc,-nodefaultrpaths
+libquadmath_darwin_rpath += -Wl,-rpath,@loader_path
+endif
libquadmath_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
- $(version_arg) $(lt_host_flags) -lm
+ $(version_arg) $(lt_host_flags) $(LIBM) $(libquadmath_darwin_rpath)
libquadmath_la_DEPENDENCIES = $(version_dep) $(libquadmath_la_LIBADD)
nodist_libsubinclude_HEADERS = quadmath.h quadmath_weak.h
diff --git a/libquadmath/Makefile.in b/libquadmath/Makefile.in
index 8c011212258..068af559457 100644
--- a/libquadmath/Makefile.in
+++ b/libquadmath/Makefile.in
@@ -355,6 +355,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
+LIBM = @LIBM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
@@ -463,8 +464,10 @@ AUTOMAKE_OPTIONS = foreign info-in-builddir
@BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_SUN_TRUE@@LIBQUAD_USE_SYMVER_TRUE@version_dep = quadmath.map-sun
@BUILD_LIBQUADMATH_TRUE@toolexeclib_LTLIBRARIES = libquadmath.la
@BUILD_LIBQUADMATH_TRUE@libquadmath_la_LIBADD =
+@BUILD_LIBQUADMATH_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@libquadmath_darwin_rpath = -Wc,-nodefaultrpaths \
+@BUILD_LIBQUADMATH_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
@BUILD_LIBQUADMATH_TRUE@libquadmath_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
-@BUILD_LIBQUADMATH_TRUE@ $(version_arg) $(lt_host_flags) -lm
+@BUILD_LIBQUADMATH_TRUE@ $(version_arg) $(lt_host_flags) $(LIBM) $(libquadmath_darwin_rpath)
@BUILD_LIBQUADMATH_TRUE@libquadmath_la_DEPENDENCIES = $(version_dep) $(libquadmath_la_LIBADD)
@BUILD_LIBQUADMATH_TRUE@nodist_libsubinclude_HEADERS = quadmath.h quadmath_weak.h
diff --git a/libquadmath/configure b/libquadmath/configure
index 0b145a644c3..5bd9a070fdc 100755
--- a/libquadmath/configure
+++ b/libquadmath/configure
@@ -644,11 +644,14 @@ LIBQUAD_USE_SYMVER_GNU_FALSE
LIBQUAD_USE_SYMVER_GNU_TRUE
LIBQUAD_USE_SYMVER_FALSE
LIBQUAD_USE_SYMVER_TRUE
+LIBM
toolexeclibdir
toolexecdir
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -785,6 +788,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
with_toolexeclibdir
enable_symvers
@@ -1435,6 +1439,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -7310,7 +7317,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9022,6 +9029,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9039,9 +9089,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -10868,7 +10922,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10871 "configure"
+#line 10925 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10974,7 +11028,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10977 "configure"
+#line 11031 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11235,6 +11289,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
@@ -12199,6 +12261,148 @@ esac
+LIBM=
+case $host in
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+ # These system don't have libm, or don't need it
+ ;;
+*-ncr-sysv4.3*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mwvalidcheckl in -lmw" >&5
+$as_echo_n "checking for _mwvalidcheckl in -lmw... " >&6; }
+if ${ac_cv_lib_mw__mwvalidcheckl+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lmw $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char _mwvalidcheckl ();
+int
+main ()
+{
+return _mwvalidcheckl ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_mw__mwvalidcheckl=yes
+else
+ ac_cv_lib_mw__mwvalidcheckl=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mw__mwvalidcheckl" >&5
+$as_echo "$ac_cv_lib_mw__mwvalidcheckl" >&6; }
+if test "x$ac_cv_lib_mw__mwvalidcheckl" = xyes; then :
+ LIBM="-lmw"
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
+$as_echo_n "checking for cos in -lm... " >&6; }
+if ${ac_cv_lib_m_cos+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char cos ();
+int
+main ()
+{
+return cos ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_cos=yes
+else
+ ac_cv_lib_m_cos=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
+$as_echo "$ac_cv_lib_m_cos" >&6; }
+if test "x$ac_cv_lib_m_cos" = xyes; then :
+ LIBM="$LIBM -lm"
+fi
+
+ ;;
+*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
+$as_echo_n "checking for cos in -lm... " >&6; }
+if ${ac_cv_lib_m_cos+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char cos ();
+int
+main ()
+{
+return cos ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_cos=yes
+else
+ ac_cv_lib_m_cos=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
+$as_echo "$ac_cv_lib_m_cos" >&6; }
+if test "x$ac_cv_lib_m_cos" = xyes; then :
+ LIBM="-lm"
+fi
+
+ ;;
+esac
+
+
+
for ac_header in fenv.h langinfo.h locale.h wchar.h wctype.h limits.h ctype.h printf.h errno.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
@@ -13459,6 +13663,10 @@ if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then
as_fn_error $? "conditional \"BUILD_INFO\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libquadmath/configure.ac b/libquadmath/configure.ac
index eec4084a45f..94a3f2179e9 100644
--- a/libquadmath/configure.ac
+++ b/libquadmath/configure.ac
@@ -59,6 +59,7 @@ AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
AM_MAINTAINER_MODE
@@ -121,6 +122,8 @@ esac
AC_SUBST(toolexecdir)
AC_SUBST(toolexeclibdir)
+AC_CHECK_LIBM
+
AC_CHECK_HEADERS(fenv.h langinfo.h locale.h wchar.h wctype.h limits.h ctype.h printf.h errno.h)
LIBQUAD_CHECK_MATH_H_SIGNGAM
diff --git a/libsanitizer/asan/Makefile.am b/libsanitizer/asan/Makefile.am
index 4f802f723d6..223d3e07816 100644
--- a/libsanitizer/asan/Makefile.am
+++ b/libsanitizer/asan/Makefile.am
@@ -60,7 +60,12 @@ libasan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
libasan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libasan)
+if ENABLE_DARWIN_AT_RPATH
+libasan_darwin_rpath = -Wc,-nodefaultrpaths
+libasan_darwin_rpath += -Wl,-rpath,@loader_path
+endif
+libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libasan) $(libasan_darwin_rpath)
libasan_preinit.o: asan_preinit.o
cp $< $@
diff --git a/libsanitizer/asan/Makefile.in b/libsanitizer/asan/Makefile.in
index 7833a9a4c3f..e88e5e0b0a7 100644
--- a/libsanitizer/asan/Makefile.in
+++ b/libsanitizer/asan/Makefile.in
@@ -465,7 +465,12 @@ libasan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(top_builddir)/lsan/libsanitizer_lsan.la $(am__append_2) \
$(am__append_3) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libasan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libasan_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libasan) $(libasan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
diff --git a/libsanitizer/configure b/libsanitizer/configure
index 0805d254fe5..2edd5c37ce7 100755
--- a/libsanitizer/configure
+++ b/libsanitizer/configure
@@ -666,6 +666,8 @@ LSAN_SUPPORTED_FALSE
LSAN_SUPPORTED_TRUE
TSAN_SUPPORTED_FALSE
TSAN_SUPPORTED_TRUE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
CXXCPP
@@ -817,6 +819,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_werror
with_gcc_major_version_only
enable_cet
@@ -1471,6 +1474,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--disable-werror disable building with -Werror
--enable-cet enable Intel CET in target libraries [default=auto]
@@ -8891,7 +8897,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10596,6 +10602,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10613,9 +10662,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12421,7 +12474,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12424 "configure"
+#line 12477 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12527,7 +12580,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12530 "configure"
+#line 12583 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13403,6 +13456,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13420,12 +13516,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15845,6 +15949,15 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
@@ -17243,6 +17356,10 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${TSAN_SUPPORTED_TRUE}" && test -z "${TSAN_SUPPORTED_FALSE}"; then
as_fn_error $? "conditional \"TSAN_SUPPORTED\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libsanitizer/configure.ac b/libsanitizer/configure.ac
index 04cd8910ed6..5906c8d4887 100644
--- a/libsanitizer/configure.ac
+++ b/libsanitizer/configure.ac
@@ -85,6 +85,8 @@ esac
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
AC_CHECK_SIZEOF([void *])
if test "${multilib}" = "yes"; then
diff --git a/libsanitizer/hwasan/Makefile.am b/libsanitizer/hwasan/Makefile.am
index bb7f8fa0b7b..653fc8c4720 100644
--- a/libsanitizer/hwasan/Makefile.am
+++ b/libsanitizer/hwasan/Makefile.am
@@ -47,7 +47,11 @@ libhwasan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
libhwasan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libhwasan)
+if ENABLE_DARWIN_AT_RPATH
+libhwasan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
+libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libhwasan) $(libhwasan_darwin_rpath)
libhwasan_preinit.o: hwasan_preinit.o
cp $< $@
diff --git a/libsanitizer/hwasan/Makefile.in b/libsanitizer/hwasan/Makefile.in
index 58bc26b44b9..87971fd3374 100644
--- a/libsanitizer/hwasan/Makefile.in
+++ b/libsanitizer/hwasan/Makefile.in
@@ -447,7 +447,10 @@ libhwasan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(top_builddir)/lsan/libsanitizer_lsan.la $(am__append_1) \
$(am__append_2) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libhwasan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libhwasan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/
+libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libhwasan) $(libhwasan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
diff --git a/libsanitizer/lsan/Makefile.am b/libsanitizer/lsan/Makefile.am
index 6ff28ff5eea..7701b0e18cf 100644
--- a/libsanitizer/lsan/Makefile.am
+++ b/libsanitizer/lsan/Makefile.am
@@ -41,8 +41,12 @@ if LIBBACKTRACE_SUPPORTED
liblsan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
liblsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_liblsan)
-
+if ENABLE_DARWIN_AT_RPATH
+liblsan_darwin_rpath = -Wc,-nodefaultrpaths
+liblsan_darwin_rpath += -Wl,-rpath,@loader_path
+endif
+liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_liblsan) $(liblsan_darwin_rpath)
liblsan_preinit.o: lsan_preinit.o
cp $< $@
diff --git a/libsanitizer/lsan/Makefile.in b/libsanitizer/lsan/Makefile.in
index d8fd4ee9557..078edf01fda 100644
--- a/libsanitizer/lsan/Makefile.in
+++ b/libsanitizer/lsan/Makefile.in
@@ -413,7 +413,12 @@ liblsan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(top_builddir)/interception/libinterception.la \
$(am__append_1) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_liblsan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@liblsan_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_liblsan) $(liblsan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
@@ -788,7 +793,6 @@ uninstall-am: uninstall-nodist_toolexeclibHEADERS \
.PRECIOUS: Makefile
-
liblsan_preinit.o: lsan_preinit.o
cp $< $@
diff --git a/libsanitizer/tsan/Makefile.am b/libsanitizer/tsan/Makefile.am
index da80743da9d..01290b0313d 100644
--- a/libsanitizer/tsan/Makefile.am
+++ b/libsanitizer/tsan/Makefile.am
@@ -57,7 +57,11 @@ libtsan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
libtsan_la_DEPENDENCIES +=$(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
libtsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libtsan)
+if ENABLE_DARWIN_AT_RPATH
+libtsan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
+libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libtsan) $(libtsan_darwin_rpath)
libtsan_preinit.o: tsan_preinit.o
cp $< $@
diff --git a/libsanitizer/tsan/Makefile.in b/libsanitizer/tsan/Makefile.in
index 36498832bb8..95011584bcb 100644
--- a/libsanitizer/tsan/Makefile.in
+++ b/libsanitizer/tsan/Makefile.in
@@ -464,7 +464,10 @@ libtsan_la_DEPENDENCIES = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(top_builddir)/interception/libinterception.la \
$(TSAN_TARGET_DEPENDENT_OBJECTS) $(am__append_2)
-libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libtsan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libtsan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/
+libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libtsan) $(libtsan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
diff --git a/libsanitizer/ubsan/Makefile.am b/libsanitizer/ubsan/Makefile.am
index d480f26adc0..7769b3437e4 100644
--- a/libsanitizer/ubsan/Makefile.am
+++ b/libsanitizer/ubsan/Makefile.am
@@ -36,7 +36,12 @@ if LIBBACKTRACE_SUPPORTED
libubsan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
libubsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libubsan)
+if ENABLE_DARWIN_AT_RPATH
+libubsan_darwin_rpath = -Wc,-nodefaultrpaths
+libubsan_darwin_rpath += -Wl,-rpath,@loader_path
+endif
+libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libubsan) $(libubsan_darwin_rpath)
# Use special rules for files that require RTTI support.
ubsan_handlers_cxx.% ubsan_type_hash.% ubsan_type_hash_itanium.% : AM_CXXFLAGS += -frtti
diff --git a/libsanitizer/ubsan/Makefile.in b/libsanitizer/ubsan/Makefile.in
index 92a8e387fd7..7e51480e970 100644
--- a/libsanitizer/ubsan/Makefile.in
+++ b/libsanitizer/ubsan/Makefile.in
@@ -400,7 +400,12 @@ libubsan_la_SOURCES = $(ubsan_files)
libubsan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(am__append_1) $(am__append_2) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libubsan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libubsan_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libubsan) $(libubsan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
diff --git a/libssp/Makefile.am b/libssp/Makefile.am
index 1636e43b369..f7ed2aa6043 100644
--- a/libssp/Makefile.am
+++ b/libssp/Makefile.am
@@ -49,8 +49,12 @@ libssp_la_SOURCES = \
vsnprintf-chk.c vsprintf-chk.c
libssp_la_LIBADD =
libssp_la_DEPENDENCIES = $(version_dep) $(libssp_la_LIBADD)
+if ENABLE_DARWIN_AT_RPATH
+libssp_darwin_rpath = -Wc,-nodefaultrpaths
+libssp_darwin_rpath += -Wl,-rpath,@loader_path
+endif
libssp_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
- $(version_arg) $(lt_host_flags)
+ $(version_arg) $(lt_host_flags) $(libssp_darwin_rpath)
libssp_nonshared_la_SOURCES = \
ssp-local.c
diff --git a/libssp/Makefile.in b/libssp/Makefile.in
index bc8a0dc2b28..1cf86361b96 100644
--- a/libssp/Makefile.in
+++ b/libssp/Makefile.in
@@ -376,8 +376,11 @@ libssp_la_SOURCES = \
libssp_la_LIBADD =
libssp_la_DEPENDENCIES = $(version_dep) $(libssp_la_LIBADD)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libssp_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
libssp_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
- $(version_arg) $(lt_host_flags)
+ $(version_arg) $(lt_host_flags) $(libssp_darwin_rpath)
libssp_nonshared_la_SOURCES = \
ssp-local.c
diff --git a/libssp/configure b/libssp/configure
index 7f8b8fdf99d..a31b69f306e 100755
--- a/libssp/configure
+++ b/libssp/configure
@@ -636,6 +636,8 @@ LIBOBJS
get_gcc_base_ver
toolexeclibdir
toolexecdir
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -781,6 +783,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
with_toolexeclibdir
with_gcc_major_version_only
'
@@ -1426,6 +1429,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -7496,7 +7502,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9208,6 +9214,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9225,9 +9274,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11054,7 +11107,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11057 "configure"
+#line 11110 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11160,7 +11213,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11163 "configure"
+#line 11216 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11438,6 +11491,15 @@ fi
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# Calculate toolexeclibdir
# Also toolexecdir, though it's only used in toolexeclibdir
case ${version_specific_libs} in
@@ -11647,6 +11709,10 @@ if test -z "${LIBSSP_USE_SYMVER_SUN_TRUE}" && test -z "${LIBSSP_USE_SYMVER_SUN_F
as_fn_error $? "conditional \"LIBSSP_USE_SYMVER_SUN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/libssp/configure.ac b/libssp/configure.ac
index f30f81c54f6..90778e2355d 100644
--- a/libssp/configure.ac
+++ b/libssp/configure.ac
@@ -165,6 +165,8 @@ AC_SUBST(enable_static)
GCC_WITH_TOOLEXECLIBDIR
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
# Calculate toolexeclibdir
# Also toolexecdir, though it's only used in toolexeclibdir
case ${version_specific_libs} in
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index c4da56c3042..b2b121a0936 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -789,6 +789,8 @@ GLIBCXX_HOSTED_TRUE
glibcxx_compiler_shared_flag
glibcxx_compiler_pic_flag
glibcxx_lt_pic_flag
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -924,6 +926,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_hosted_libstdcxx
enable_libstdcxx_hosted
enable_libstdcxx_verbose
@@ -1615,6 +1618,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--disable-hosted-libstdcxx
only build freestanding C++ runtime support
--disable-libstdcxx-hosted
@@ -8539,7 +8545,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10379,6 +10385,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10396,9 +10445,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12225,7 +12278,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12228 "configure"
+#line 12281 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12331,7 +12384,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12334 "configure"
+#line 12387 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13213,6 +13266,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13230,12 +13326,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15632,6 +15736,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
if test "$enable_vtable_verify" = yes; then
predep_objects_CXX="${predep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_start.o"
@@ -16055,7 +16167,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; }
# Fake what AC_TRY_COMPILE does.
cat > conftest.$ac_ext << EOF
-#line 16058 "configure"
+#line 16170 "configure"
int main()
{
typedef bool atomic_type;
@@ -16090,7 +16202,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16093 "configure"
+#line 16205 "configure"
int main()
{
typedef short atomic_type;
@@ -16125,7 +16237,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16128 "configure"
+#line 16240 "configure"
int main()
{
// NB: _Atomic_word not necessarily int.
@@ -16161,7 +16273,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16164 "configure"
+#line 16276 "configure"
int main()
{
typedef long long atomic_type;
@@ -16317,7 +16429,7 @@ $as_echo "mutex" >&6; }
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 16320 "configure"
+#line 16432 "configure"
int main()
{
_Decimal32 d1;
@@ -16359,7 +16471,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 16362 "configure"
+#line 16474 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
@@ -74906,6 +75018,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${GLIBCXX_HOSTED_TRUE}" && test -z "${GLIBCXX_HOSTED_FALSE}"; then
as_fn_error $? "conditional \"GLIBCXX_HOSTED\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index fc0f2522027..80e573e690f 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -108,6 +108,7 @@ AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
if test "$enable_vtable_verify" = yes; then
predep_objects_CXX="${predep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_start.o"
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index 5b9af41cdb9..925137c2ccc 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -152,8 +152,13 @@ libstdc___la_DEPENDENCIES = \
$(top_builddir)/src/c++17/libc++17convenience.la \
$(top_builddir)/src/c++20/libc++20convenience.la
+if ENABLE_DARWIN_AT_RPATH
+libstdc___darwin_rpath = -Wc,-nodefaultrpaths
+libstdc___darwin_rpath += -Wl,-rpath,@loader_path
+endif
+
libstdc___la_LDFLAGS = \
- -version-info $(libtool_VERSION) ${version_arg} -lm
+ -version-info $(libtool_VERSION) ${version_arg} -lm $(libstdc___darwin_rpath)
libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) $(lt_host_flags)
diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
index f42d957af36..0ce75f30708 100644
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -560,8 +560,11 @@ libstdc___la_DEPENDENCIES = \
$(top_builddir)/src/c++17/libc++17convenience.la \
$(top_builddir)/src/c++20/libc++20convenience.la
+@ENABLE_DARWIN_AT_RPATH_TRUE@libstdc___darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
libstdc___la_LDFLAGS = \
- -version-info $(libtool_VERSION) ${version_arg} -lm
+ -version-info $(libtool_VERSION) ${version_arg} -lm $(libstdc___darwin_rpath)
libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) $(lt_host_flags)
@GLIBCXX_LDBL_ALT128_COMPAT_FALSE@@GLIBCXX_LDBL_COMPAT_TRUE@LTCXXCOMPILE64 = $(LTCXXCOMPILE)
diff --git a/libtool.m4 b/libtool.m4
index e36fdd3c0e2..7f8ae26db62 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -1005,7 +1005,7 @@ _LT_EOF
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[[89]]*|UNSET,*-darwin[[12]][[0123456789]]*)
+ UNSET,*-darwin[[89]]*|UNSET,*-darwin[[12]][[0-9]]*)
;;
10.[[012]][[,.]]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -1039,6 +1039,45 @@ _LT_EOF
m4_defun([_LT_DARWIN_LINKER_FEATURES],
[
m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ AC_ARG_ENABLE([darwin-at-rpath],
+ AS_HELP_STRING([--enable-darwin-at-rpath],
+ [install libraries with @rpath/library-name, requires rpaths to be added to executables]),
+ [if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[[4-8]]*|UNSET,rhapsody*|10.[[0-4]][[,.]]*)
+ AC_MSG_WARN([Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)])
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi],
+ [case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[[4-8]]*|UNSET,rhapsody*|10.[[0-4]][[,.]]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[[5-9]]*|UNSET,darwin2*|10.1[[1-9]][[,.]]*|1[[1-9]].*[[,.]]* )
+ AC_MSG_NOTICE([@rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)])
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+ ])
+
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_automatic, $1)=yes
@@ -1056,13 +1095,21 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
_LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
_LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
m4_if([$1], [CXX],
[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
_LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
],[])
@@ -4265,6 +4312,7 @@ _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
[Compiler flag to prevent dynamic linking])
])# _LT_COMPILER_PIC
+_LT_TAGVAR(enable_darwin_at_rpath, $1)=no
# _LT_LINKER_SHLIBS([TAGNAME])
# ----------------------------
@@ -6504,7 +6552,6 @@ fi # test "$_lt_caught_CXX_error" != yes
AC_LANG_POP
])# _LT_LANG_CXX_CONFIG
-
# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
# ---------------------------------
# Figure out "hidden" library dependencies from verbose
diff --git a/libvtv/configure b/libvtv/configure
index 917557103e9..a7889161c50 100755
--- a/libvtv/configure
+++ b/libvtv/configure
@@ -640,6 +640,8 @@ VTV_CYGMIN_FALSE
VTV_CYGMIN_TRUE
XCFLAGS
libtool_VERSION
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -797,6 +799,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_cet
with_gcc_major_version_only
'
@@ -1446,6 +1449,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-cet enable Intel CET in target libraries [default=auto]
Optional Packages:
@@ -8786,7 +8792,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10491,6 +10497,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10508,9 +10557,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12316,7 +12369,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12319 "configure"
+#line 12372 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12422,7 +12475,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12425 "configure"
+#line 12478 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13298,6 +13351,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13315,12 +13411,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15714,6 +15818,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=1:0:0
@@ -16059,6 +16171,10 @@ if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${VTV_CYGMIN_TRUE}" && test -z "${VTV_CYGMIN_FALSE}"; then
as_fn_error $? "conditional \"VTV_CYGMIN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libvtv/configure.ac b/libvtv/configure.ac
index f3b937e4b10..50aaadbb3a3 100644
--- a/libvtv/configure.ac
+++ b/libvtv/configure.ac
@@ -153,6 +153,7 @@ AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=1:0:0
diff --git a/lto-plugin/configure b/lto-plugin/configure
index 37c44d04a0d..28f5dd79cd7 100755
--- a/lto-plugin/configure
+++ b/lto-plugin/configure
@@ -634,6 +634,8 @@ LTLIBOBJS
LIBOBJS
target_noncanonical
lt_host_flags
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
OTOOL64
OTOOL
LIPO
@@ -788,6 +790,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
'
ac_precious_vars='build_alias
host_alias
@@ -1434,6 +1437,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -8657,7 +8663,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10363,6 +10369,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10380,9 +10429,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12188,7 +12241,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12191 "configure"
+#line 12244 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12294,7 +12347,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12297 "configure"
+#line 12350 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12531,6 +12584,14 @@ CC="$lt_save_CC"
# Only expand once:
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
@@ -12777,6 +12838,10 @@ if test -z "${LTO_PLUGIN_USE_SYMVER_SUN_TRUE}" && test -z "${LTO_PLUGIN_USE_SYMV
as_fn_error $? "conditional \"LTO_PLUGIN_USE_SYMVER_SUN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/lto-plugin/configure.ac b/lto-plugin/configure.ac
index 84f2a60b480..c051b8c6283 100644
--- a/lto-plugin/configure.ac
+++ b/lto-plugin/configure.ac
@@ -121,6 +121,7 @@ fi
AC_SUBST(ac_lto_plugin_extra_ldflags)
AM_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
ACX_LT_HOST_FLAGS
AC_SUBST(target_noncanonical)
AC_TYPE_INT64_T
diff --git a/zlib/configure b/zlib/configure
index 273ac36647d..92c462d04c6 100755
--- a/zlib/configure
+++ b/zlib/configure
@@ -641,6 +641,8 @@ TARGET_LIBRARY_FALSE
TARGET_LIBRARY_TRUE
toolexeclibdir
toolexecdir
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
CPP
OTOOL64
OTOOL
@@ -778,6 +780,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
with_toolexeclibdir
enable_host_shared
enable_host_pie
@@ -1422,6 +1425,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-host-shared build host code as shared libraries
--enable-host-pie build host code as PIE
@@ -6976,7 +6982,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -8955,6 +8961,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -8972,9 +9021,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -10801,7 +10854,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10804 "configure"
+#line 10857 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10907,7 +10960,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10910 "configure"
+#line 10963 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11144,6 +11197,14 @@ CC="$lt_save_CC"
# Only expand once:
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
# Find CPP now so that any conditional tests below won't do it and
# thereby make the resulting definitions conditional.
@@ -11790,6 +11851,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${TARGET_LIBRARY_TRUE}" && test -z "${TARGET_LIBRARY_FALSE}"; then
as_fn_error $? "conditional \"TARGET_LIBRARY\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/zlib/configure.ac b/zlib/configure.ac
index adf7aad4e51..9501cdfea85 100644
--- a/zlib/configure.ac
+++ b/zlib/configure.ac
@@ -64,6 +64,7 @@ GCC_CET_FLAGS(CET_FLAGS)
AC_SUBST(CET_FLAGS)
AC_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
# Find CPP now so that any conditional tests below won't do it and
# thereby make the resulting definitions conditional.
--
2.39.2 (Apple Git-143)
[-- Attachment #4: 0003-Darwin-rpaths-Add-with-darwin-extra-rpath.patch --]
[-- Type: application/octet-stream, Size: 6093 bytes --]
From 2348525bb5fb18d486ad0738fd7939fca26df797 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Sat, 28 May 2022 10:16:27 +0100
Subject: [PATCH 3/5] Darwin, rpaths: Add --with-darwin-extra-rpath.
This is provided to allow distributions to add a single additional
runpath to allow for cases where the installed GCC library directories
are then symlinked to a common dirctory outside of any of the GCC
installations.
For example:
/opt/distro/lib:
libgfortran.dylib -> /opt/distro/lib/gcc-11.3/lib/libgfortran.dylib
So that libraries which are designed to be found in the runpath we would then
add --with-darwin-add-rpath=/opt/distro/lib to the configure line.
This patch makes the configuration a little more forgiving of using
--disable-darwin-at-rpath (although for platform versions >= 10.11 this will
result in misconfigured target libraries).
gcc/ChangeLog:
* configure.ac: Add --with-darwin-extra-rpath option.
* config/darwin.h: Handle DARWIN_EXTRA_RPATH.
* config.in: Regenerate.
* configure: Regenerate.
---
gcc/config.in | 13 +++++++++++++
gcc/config/darwin.h | 14 ++++++++++++++
gcc/configure | 28 ++++++++++++++++++++++++++--
gcc/configure.ac | 13 +++++++++++++
4 files changed, 66 insertions(+), 2 deletions(-)
diff --git a/gcc/config.in b/gcc/config.in
index 5cf51bc1b01..9bda18ab64b 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -49,6 +49,19 @@
#endif
+/* Specify a runpath directory, additional to those provided by the compiler
+ */
+#ifndef USED_FOR_TARGET
+#undef DARWIN_ADD_RPATH
+#endif
+
+
+/* Should add an extra runpath directory */
+#ifndef USED_FOR_TARGET
+#undef DARWIN_DO_EXTRA_RPATH
+#endif
+
+
/* Define to enable the use of a default assembler. */
#ifndef USED_FOR_TARGET
#undef DEFAULT_ASSEMBLER
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 1b6920f4c92..ede8c1d8dbb 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -321,6 +321,19 @@ extern GTY(()) int darwin_ms_struct;
%:version-compare(>= 10.11 mmacosx-version-min= -lemutls_w) "
#endif
+/* We might elect to add a path even when this compiler does not use embedded
+ run paths, so that we can use libraries from an alternate compiler that is
+ using embedded runpaths. */
+#if DARWIN_DO_EXTRA_RPATH
+# define DARWIN_EXTRA_RPATH \
+"%{!r:%{!nostdlib:%{!nodefaultrpaths:\
+ %:version-compare(>= 10.5 mmacosx-version-min= -rpath) \
+ %:version-compare(>= 10.5 mmacosx-version-min= " DARWIN_ADD_RPATH ") \
+ }}}"
+#else
+# define DARWIN_EXTRA_RPATH ""
+#endif
+
#define SUBSUBTARGET_OVERRIDE_OPTIONS \
do { \
darwin_override_options (); \
@@ -415,6 +428,7 @@ extern GTY(()) int darwin_ms_struct;
DARWIN_NOPIE_SPEC \
DARWIN_RDYNAMIC \
DARWIN_NOCOMPACT_UNWIND \
+ DARWIN_EXTRA_RPATH \
DARWIN_RPATH_LINK \
"}}}}}}} %<pie %<no-pie %<rdynamic %<X %<rpath %<nodefaultrpaths "
diff --git a/gcc/configure b/gcc/configure
index eaa1a189583..13472fcfc3c 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1009,6 +1009,7 @@ with_pic
enable_fast_install
enable_libtool_lock
enable_darwin_at_rpath
+with_darwin_extra_rpath
enable_ld
enable_gold
with_plugin_ld
@@ -1870,6 +1871,9 @@ Optional Packages:
--with-pic try to use only PIC/non-PIC objects [default=use
both]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
+ --with-darwin-extra-rpath=[ARG]
+ Specify a runpath directory, additional to those
+ provided by the compiler
--with-plugin-ld=[ARG] specify the plugin linker
--with-glibc-version=M.N
assume GCC used with glibc version M.N or later
@@ -19939,7 +19943,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19942 "configure"
+#line 19946 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -20045,7 +20049,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 20048 "configure"
+#line 20052 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -23373,6 +23377,26 @@ else
ENABLE_DARWIN_AT_RPATH_FALSE=
fi
+DARWIN_DO_EXTRA_RPATH=0
+
+# Check whether --with-darwin-extra-rpath was given.
+if test "${with_darwin_extra_rpath+set}" = set; then :
+ withval=$with_darwin_extra_rpath; if test x"$withval" != x; then
+ DARWIN_ADD_RPATH="$withval"
+ DARWIN_DO_EXTRA_RPATH=1
+ fi
+fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define DARWIN_DO_EXTRA_RPATH $DARWIN_DO_EXTRA_RPATH
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define DARWIN_ADD_RPATH "$DARWIN_ADD_RPATH"
+_ACEOF
+
# Identify the assembler which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the assembler
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 80e31229408..84175a5d7ce 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2600,6 +2600,19 @@ AC_SUBST(objdir)
AC_SUBST(enable_fast_install)
AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+DARWIN_DO_EXTRA_RPATH=0
+AC_ARG_WITH(darwin-extra-rpath,
+[AS_HELP_STRING(
+ [[--with-darwin-extra-rpath=[ARG]]],
+ [Specify a runpath directory, additional to those provided by the compiler])],
+[if test x"$withval" != x; then
+ DARWIN_ADD_RPATH="$withval"
+ DARWIN_DO_EXTRA_RPATH=1
+ fi])
+AC_DEFINE_UNQUOTED(DARWIN_DO_EXTRA_RPATH, $DARWIN_DO_EXTRA_RPATH,
+ [Should add an extra runpath directory])
+AC_DEFINE_UNQUOTED(DARWIN_ADD_RPATH, "$DARWIN_ADD_RPATH",
+ [Specify a runpath directory, additional to those provided by the compiler])
# Identify the assembler which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the assembler
--
2.39.2 (Apple Git-143)
[-- Attachment #5: 0004-Testsuite-allow-non-installed-testing-on-darwin.patch --]
[-- Type: application/octet-stream, Size: 12763 bytes --]
From 0415173d58e7df3683dbd92d5d92003c8200a4b0 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Fri, 16 Apr 2021 20:01:40 +0100
Subject: [PATCH 4/5] Testsuite: allow non-installed testing on darwin
DYLD_LIBRARY_PATH is now removed from the environment for all system
tools, including the shell. Adapt the testsuite and pass the right
options to allow testing, even when the compiler and libraries have not
been installed.
gcc/ChangeLog:
* Makefile.in: set ENABLE_DARWIN_AT_RPATH in site.tmp.
gcc/testsuite/ChangeLog:
* gfortran.dg/coarray/caf.exp: Correctly set
libatomic flags.
* gfortran.dg/dg.exp: Likewise.
* lib/asan-dg.exp: Set correct -B flags.
* lib/atomic-dg.exp: Likewise.
* lib/target-libpath.exp: Handle ENABLE_DARWIN_AT_RPATH.
libatomic/ChangeLog:
* testsuite/lib/libatomic.exp: Pass correct flags on darwin.
libffi/ChangeLog:
* testsuite/lib/libffi.exp: Likewise.
libitm/ChangeLog:
* testsuite/lib/libitm.exp: Likewise.
* testsuite/libitm.c++/c++.exp: Likewise.
---
gcc/Makefile.in | 3 +++
gcc/testsuite/gfortran.dg/coarray/caf.exp | 16 +++++++++---
gcc/testsuite/gfortran.dg/dg.exp | 32 ++++++++++++++++++++---
gcc/testsuite/lib/asan-dg.exp | 2 +-
gcc/testsuite/lib/atomic-dg.exp | 2 +-
gcc/testsuite/lib/target-libpath.exp | 23 +++++++++++++---
libatomic/testsuite/lib/libatomic.exp | 8 ++++--
libffi/testsuite/lib/libffi.exp | 11 +++++---
libitm/testsuite/lib/libitm.exp | 1 +
libitm/testsuite/libitm.c++/c++.exp | 4 ++-
10 files changed, 84 insertions(+), 18 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 60ba2916457..023dba2159c 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -4209,6 +4209,9 @@ site.exp: ./config.status Makefile
echo "set COMPAT_OPTIONS \"$(COMPAT_OPTIONS)\"" >> ./site.tmp; \
else true; \
fi
+ @if test "x@enable_darwin_at_rpath@" = "xyes" ; then \
+ echo "set ENABLE_DARWIN_AT_RPATH 1" >> ./site.tmp; \
+ fi
@echo "## All variables above are generated by configure. Do Not Edit ##" >> ./site.tmp
@cat ./site.tmp > site.exp
@cat site.bak | sed \
diff --git a/gcc/testsuite/gfortran.dg/coarray/caf.exp b/gcc/testsuite/gfortran.dg/coarray/caf.exp
index d232be2fa90..a10b17a78d0 100644
--- a/gcc/testsuite/gfortran.dg/coarray/caf.exp
+++ b/gcc/testsuite/gfortran.dg/coarray/caf.exp
@@ -28,6 +28,7 @@
# Load procedures from common libraries.
load_lib gfortran-dg.exp
+load_lib atomic-dg.exp
# If a testcase doesn't have special options, use these.
global DEFAULT_FFLAGS
@@ -47,6 +48,7 @@ global gfortran_test_path
global gfortran_aux_module_flags
set gfortran_test_path $srcdir/$subdir
set gfortran_aux_module_flags $DEFAULT_FFLAGS
+
proc dg-compile-aux-modules { args } {
global gfortran_test_path
global gfortran_aux_module_flags
@@ -71,7 +73,15 @@ proc dg-compile-aux-modules { args } {
# Add -latomic only where supported. Assume built-in support elsewhere.
set maybe_atomic_lib ""
if [check_effective_target_libatomic_available] {
- set maybe_atomic_lib "-latomic"
+ if ![is_remote host] {
+ if [info exists TOOL_OPTIONS] {
+ set maybe_atomic_lib "[atomic_link_flags [get_multilibs ${TOOL_OPTIONS}]]"
+ } else {
+ set maybe_atomic_lib "[atomic_link_flags [get_multilibs]]"
+ }
+ }
+ set t [get_multilibs]
+ puts "maybe al $maybe_atomic_lib ml $t"
}
# Main loop.
@@ -97,14 +107,14 @@ foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ]]
foreach flags $option_list {
verbose "Testing $nshort (single), $flags" 1
set gfortran_aux_module_flags "-fcoarray=single $flags"
- dg-test $test "-fcoarray=single $flags $maybe_atomic_lib" ""
+ dg-test $test "-fcoarray=single $flags" $maybe_atomic_lib
cleanup-modules ""
}
foreach flags $option_list {
verbose "Testing $nshort (libcaf_single), $flags" 1
set gfortran_aux_module_flags "-fcoarray=lib $flags -lcaf_single"
- dg-test $test "-fcoarray=lib $flags -lcaf_single $maybe_atomic_lib" ""
+ dg-test $test "-fcoarray=lib $flags -lcaf_single" $maybe_atomic_lib
cleanup-modules ""
}
}
diff --git a/gcc/testsuite/gfortran.dg/dg.exp b/gcc/testsuite/gfortran.dg/dg.exp
index ee2760327dc..73541ea7301 100644
--- a/gcc/testsuite/gfortran.dg/dg.exp
+++ b/gcc/testsuite/gfortran.dg/dg.exp
@@ -18,6 +18,7 @@
# Load support procs.
load_lib gfortran-dg.exp
+load_lib atomic-dg.exp
# If a testcase doesn't have special options, use these.
global DEFAULT_FFLAGS
@@ -53,13 +54,38 @@ proc dg-compile-aux-modules { args } {
}
}
+# coarray tests might need libatomic. Assume that it is either not needed or
+# provided by builtins if it's not available.
+set maybe_atomic_lib ""
+if [check_effective_target_libatomic_available] {
+ if ![is_remote host] {
+ if [info exists TOOL_OPTIONS] {
+ set maybe_atomic_lib "[atomic_link_flags [get_multilibs ${TOOL_OPTIONS}]]"
+ } else {
+ set maybe_atomic_lib "[atomic_link_flags [get_multilibs]]"
+ }
+ } else {
+ set maybe_atomic_lib ""
+ }
+ set t [get_multilibs]
+ puts "dg set al $maybe_atomic_lib ml $t"
+}
+
+set all_flags $DEFAULT_FFLAGS
+if { $maybe_atomic_lib != "" } {
+ foreach f $maybe_atomic_lib {
+ lappend all_flags $f
+ }
+}
+
+puts "revised FFLAGS $all_flags"
+
# Main loop.
gfortran-dg-runtest [lsort \
- [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ] ] "" $DEFAULT_FFLAGS
+ [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ] ] "" $all_flags
gfortran-dg-runtest [lsort \
- [glob -nocomplain $srcdir/$subdir/g77/*.\[fF\] ] ] "" $DEFAULT_FFLAGS
-
+ [glob -nocomplain $srcdir/$subdir/g77/*.\[fF\] ] ] "" $all_flags
# All done.
dg-finish
diff --git a/gcc/testsuite/lib/asan-dg.exp b/gcc/testsuite/lib/asan-dg.exp
index 35e60eaaed5..157b60908d6 100644
--- a/gcc/testsuite/lib/asan-dg.exp
+++ b/gcc/testsuite/lib/asan-dg.exp
@@ -78,7 +78,7 @@ proc asan_link_flags_1 { paths lib } {
|| [file exists "${gccpath}/libsanitizer/${lib}/.libs/lib${lib}.${shlib_ext}"] } {
append flags " -B${gccpath}/libsanitizer/ "
append flags " -B${gccpath}/libsanitizer/${lib}/ "
- append flags " -L${gccpath}/libsanitizer/${lib}/.libs "
+ append flags " -B${gccpath}/libsanitizer/${lib}/.libs "
append ld_library_path ":${gccpath}/libsanitizer/${lib}/.libs"
}
} else {
diff --git a/gcc/testsuite/lib/atomic-dg.exp b/gcc/testsuite/lib/atomic-dg.exp
index 1589acd8eaf..ce1799cef2d 100644
--- a/gcc/testsuite/lib/atomic-dg.exp
+++ b/gcc/testsuite/lib/atomic-dg.exp
@@ -33,7 +33,7 @@ proc atomic_link_flags { paths } {
if { [file exists "${gccpath}/libatomic/.libs/libatomic.a"]
|| [file exists "${gccpath}/libatomic/.libs/libatomic.${shlib_ext}"] } {
append flags " -B${gccpath}/libatomic/ "
- append flags " -L${gccpath}/libatomic/.libs"
+ append flags " -B${gccpath}/libatomic/.libs"
append ld_library_path ":${gccpath}/libatomic/.libs"
}
} else {
diff --git a/gcc/testsuite/lib/target-libpath.exp b/gcc/testsuite/lib/target-libpath.exp
index 6d530fb4af6..36b64dd4550 100644
--- a/gcc/testsuite/lib/target-libpath.exp
+++ b/gcc/testsuite/lib/target-libpath.exp
@@ -67,6 +67,7 @@ proc set_ld_library_path_env_vars { } {
global orig_dyld_library_path
global orig_path
global orig_gcc_exec_prefix
+ global ENABLE_DARWIN_AT_RPATH
global env
# Save the original GCC_EXEC_PREFIX.
@@ -133,6 +134,7 @@ proc set_ld_library_path_env_vars { } {
#
# Doing this is somewhat of a hack as ld_library_path gets repeated in
# SHLIB_PATH and LD_LIBRARY_PATH when unix_load sets these variables.
+ if { ![istarget *-*-darwin*] } {
if { $orig_ld_library_path_saved } {
setenv LD_LIBRARY_PATH "$ld_library_path:$orig_ld_library_path"
} else {
@@ -166,10 +168,22 @@ proc set_ld_library_path_env_vars { } {
} else {
setenv LD_LIBRARY_PATH_64 "$ld_library_path"
}
- if { $orig_dyld_library_path_saved } {
- setenv DYLD_LIBRARY_PATH "$ld_library_path:$orig_dyld_library_path"
- } else {
- setenv DYLD_LIBRARY_PATH "$ld_library_path"
+ }
+ if { [istarget *-*-darwin*] } {
+ if { [info exists ENABLE_DARWIN_AT_RPATH] || [istarget *-*-darwin1\[5-9\]*]
+ || [istarget *-*-darwin20*] } {
+ # Either we are not using DYLD_LIBRARY_PATH or we're on a version of the
+ # OS for which it is not passed through system exes.
+ if [info exists env(DYLD_LIBRARY_PATH)] {
+ unsetenv DYLD_LIBRARY_PATH
+ }
+ } else {
+ if { $orig_dyld_library_path_saved } {
+ setenv DYLD_LIBRARY_PATH "$ld_library_path:$orig_dyld_library_path"
+ } else {
+ setenv DYLD_LIBRARY_PATH "$ld_library_path"
+ }
+ }
}
if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } {
if { $orig_path_saved } {
@@ -179,6 +193,7 @@ proc set_ld_library_path_env_vars { } {
}
}
+ verbose -log "set paths"
verbose -log "LD_LIBRARY_PATH=[getenv LD_LIBRARY_PATH]"
verbose -log "LD_RUN_PATH=[getenv LD_RUN_PATH]"
verbose -log "SHLIB_PATH=[getenv SHLIB_PATH]"
diff --git a/libatomic/testsuite/lib/libatomic.exp b/libatomic/testsuite/lib/libatomic.exp
index 10f38475bc8..c6d645e9ae3 100644
--- a/libatomic/testsuite/lib/libatomic.exp
+++ b/libatomic/testsuite/lib/libatomic.exp
@@ -148,11 +148,15 @@ proc libatomic_init { args } {
if { $blddir != "" } {
lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/"
lappend ALWAYS_CFLAGS "additional_flags=-I${blddir}"
- lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs"
+ if [istarget *-*-darwin*] {
+ lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/.libs"
+ } else {
+ lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs"
+ }
}
lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/.."
- if [istarget *-*-darwin*] {
+ if [istarget *-*-darwin\[89\]*] {
lappend ALWAYS_CFLAGS "additional_flags=-shared-libgcc"
}
diff --git a/libffi/testsuite/lib/libffi.exp b/libffi/testsuite/lib/libffi.exp
index 15d3d5ebd73..611f5177c7a 100644
--- a/libffi/testsuite/lib/libffi.exp
+++ b/libffi/testsuite/lib/libffi.exp
@@ -337,8 +337,13 @@ proc libffi-init { args } {
verbose "libffi_dir $libffi_dir"
if { $libffi_dir != "" } {
set libffi_dir [file dirname ${libffi_dir}]
- set libffi_link_flags "-L${libffi_dir}/.libs"
- lappend libffi_link_flags "-L${blddircxx}/src/.libs"
+ if [istarget *-*-darwin*] {
+ set libffi_link_flags "-B${libffi_dir}/.libs"
+ lappend libffi_link_flags "-B${blddircxx}/src/.libs"
+ } else {
+ set libffi_link_flags "-L${libffi_dir}/.libs"
+ lappend libffi_link_flags "-L${blddircxx}/src/.libs"
+ }
}
set_ld_library_path_env_vars
@@ -382,7 +387,7 @@ proc libffi_target_compile { source dest type options } {
# Darwin needs a stack execution allowed flag.
if { [istarget "*-*-darwin9*"] || [istarget "*-*-darwin1*"]
- || [istarget "*-*-darwin2*"] } {
+ || [istarget "x86_64-*-darwin2*"] } {
lappend options "additional_flags=-Wl,-allow_stack_execute"
lappend options "additional_flags=-Wl,-search_paths_first"
}
diff --git a/libitm/testsuite/lib/libitm.exp b/libitm/testsuite/lib/libitm.exp
index da918d1ee8d..61bbfa0c923 100644
--- a/libitm/testsuite/lib/libitm.exp
+++ b/libitm/testsuite/lib/libitm.exp
@@ -159,6 +159,7 @@ proc libitm_init { args } {
}
if [istarget *-*-darwin*] {
+ lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/.libs"
lappend ALWAYS_CFLAGS "additional_flags=-shared-libgcc"
}
diff --git a/libitm/testsuite/libitm.c++/c++.exp b/libitm/testsuite/libitm.c++/c++.exp
index de45e7e5480..1b0ead05fee 100644
--- a/libitm/testsuite/libitm.c++/c++.exp
+++ b/libitm/testsuite/libitm.c++/c++.exp
@@ -56,8 +56,10 @@ if { $lang_test_file_found } {
# Gather a list of all tests.
set tests [lsort [glob -nocomplain $srcdir/$subdir/*.C]]
+ set stdcxxadder ""
if { $blddir != "" } {
set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
+ set stdcxxadder "-B ${blddir}/${lang_library_path}"
} else {
set ld_library_path "$always_ld_library_path"
}
@@ -72,7 +74,7 @@ if { $lang_test_file_found } {
}
# Main loop.
- dg-runtest $tests "" $libstdcxx_includes
+ dg-runtest $tests $stdcxxadder $libstdcxx_includes
}
# All done.
--
2.39.2 (Apple Git-143)
[-- Attachment #6: 0005-Doc-document-the-new-Darwin-options.patch --]
[-- Type: application/octet-stream, Size: 2774 bytes --]
From be8676410ab15a6e6cce300ce617d1f5259dcabf Mon Sep 17 00:00:00 2001
From: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Date: Thu, 24 Aug 2023 13:22:28 +0200
Subject: [PATCH 5/5] Doc: document the new Darwin options
gcc/ChangeLog:
* doc/invoke.texi: Document the new -nodefaultrpaths option.
* doc/install.texi: Document the new --with-darwin-extra-rpath
option.
---
gcc/doc/install.texi | 6 ++++++
gcc/doc/invoke.texi | 10 +++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index e099cd0b568..a388e1f12e0 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -1808,6 +1808,12 @@ particularly useful if you intend to use several versions of GCC in
parallel. The default is @samp{yes} for @samp{libada}, and @samp{no} for
the remaining libraries.
+@item --with-darwin-extra-rpath
+This is provided to allow distributions to add a single additional
+runpath on Darwin / macOS systems. This allows for cases where the
+installed GCC library directories are then symlinked to a common
+directory outside of the GCC installation.
+
@item @anchor{WithAixSoname}--with-aix-soname=@samp{aix}, @samp{svr4} or @samp{both}
Traditional AIX shared library versioning (versioned @code{Shared Object}
files as members of unversioned @code{Archive Library} files named
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index a32dabf0405..778d82ecd2b 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -920,7 +920,7 @@ Objective-C and Objective-C++ Dialects}.
-iframework
-image_base -init -install_name -keep_private_externs
-multi_module -multiply_defined -multiply_defined_unused
--noall_load -no_dead_strip_inits_and_terms
+-noall_load -no_dead_strip_inits_and_terms -nodefaultrpaths
-nofixprebinding -nomultidefs -noprebind -noseglinkedit
-pagezero_size -prebind -prebind_all_twolevel_modules
-private_bundle -read_only_relocs -sectalign
@@ -24269,6 +24269,14 @@ an executable when linking, using the Darwin @file{libtool} command.
This causes GCC's output file to have the @samp{ALL} subtype, instead of
one controlled by the @option{-mcpu} or @option{-march} option.
+@opindex nodefaultrpaths
+@item -nodefaultrpaths
+Do not add default run paths for the compiler library directories to
+executables, modules or dynamic libraries. On macOS 10.5 and later,
+the embedded runpath is added by default unless the user adds
+@option{-nodefaultrpaths} to the link line. Run paths are needed
+(and therefore enforced) to build on macOS version 10.11 or later.
+
@item -allowable_client @var{client_name}
@itemx -client_name
@itemx -compatibility_version
--
2.39.2 (Apple Git-143)
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-09-12 17:52 ` FX Coudert
@ 2023-09-20 13:52 ` FX Coudert
2023-10-08 13:07 ` Nathanael Nerode
0 siblings, 1 reply; 39+ messages in thread
From: FX Coudert @ 2023-09-20 13:52 UTC (permalink / raw)
To: GCC Patches
Cc: Joseph Myers, bonzini, neroden, aoliva, Ralf.Wildenhues, Iain Sandoe
[-- Attachment #1: Type: text/plain, Size: 2384 bytes --]
ping**2 for a build maintainer or global maintainer to review, please
It restores testing on darwin >= 21, which is not currently working
If no maintainer is available to review build system, could I get guidance on how to proceed further?
Thanks,
FX
> Le 12 sept. 2023 à 19:52, FX Coudert <fxcoudert@gmail.com> a écrit :
>
> Hi build maintainers,
>
> May I ping this series of patches for review? In particular, they allow to restore testing on darwin, which is currently broken with darwin >= 21, due to DYLD_LIBRARY_PATH being systematically removed from the environment by system tools.
>
> It has been tested for two years on darwin, and would allow to restore regular regtesting on that target. It is a big step to help prevent bugs being undetected on this port.
>
> The patchset was okayed from the driver point of view, but we need a build reviewer (or global reviewer) to okay those bits. Original presentation of the patches:
>
> ------
> I’d like to post an updated and rebased version of Iain Sandoe’s patches for modern darwin, originally posted in November 2021: https://gcc.gnu.org/pipermail/gcc-patches/2021-November/584775.html
>
> The rationale in that message is pretty much unchanged, and the patches have been since tested thoroughly on darwin (both Intel and ARM) for almost two years now. We have been shipping Iain’s branch (including these patches) since then in Homebrew and most other major distros of GCC on Darwin. So I think it’s been very thoroughly tested.
>
> The main comment that arose from review in the previous incarnation was the need to at least offer the libtool part of the patch to upstream, in order to reduce in the long term the divergence between our version and upstream. I have done so in https://savannah.gnu.org/patch/index.php?10385
>
> (I would also note that I have offered other suggestions of small snippets that could be upstream in libtool for darwin, but have not received much feedback for now: https://savannah.gnu.org/patch/?10371)
> ------
>
>
> Thanks,
> FX
>
>
>
>> Le 29 août 2023 à 22:17, FX Coudert <fxcoudert@gmail.com> a écrit :
>>
>>> I think a build machinery review is needed.
>>
>> Thanks. CC’ing the relevant maintainers for review of the build part.
>> The driver part and the darwin-specific part are already okayed.
>>
>> FX
[-- Attachment #2: 0001-Driver-Provide-a-spec-to-insert-rpaths-for-compiler-.patch --]
[-- Type: application/octet-stream, Size: 3952 bytes --]
From ff84f0b0d2971bc589a52c416d0ca6f292f75458 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Thu, 20 Dec 2018 09:00:38 +0000
Subject: [PATCH 1/5] Driver: Provide a spec to insert rpaths for compiler lib
dirs.
This provides a spec to insert "-rpath DDD" for each DDD corresponding
to a compiler startfile directory. This allows a target to use @rpath
as the install path for libraries, and have the compiler provide the
necessary rpath to handle this.
Embed real paths, not relative ones.
We embed a runpath for every path in which libraries might be found. This
change ensures that we embed the actual real path and not a relative one from
the compiler's version-specific directory.
e.g.
/opt/distro/gcc-11-3Dr0/lib
instead of:
/opt/distro/gcc-11-3Dr0/lib/gcc/x86_64-apple-darwin19/11.3.0/../../..
This ensures that if we install, for example, 11.4.0 (and delete the 11.3.0
installation) exes built by 11.3 would continue to function (providing, of course
that 11.4 does not bump any SO names).
gcc/ChangeLog:
* gcc.cc (RUNPATH_OPTION): New.
(do_spec_1): Provide '%P' as a spec to insert rpaths for
each compiler startfile path.
---
gcc/gcc.cc | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index fdfac0b4fe4..7c6e4879a31 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -579,6 +579,7 @@ or with constant text in a single argument.
%l process LINK_SPEC as a spec.
%L process LIB_SPEC as a spec.
%M Output multilib_os_dir.
+ %P Output a RUNPATH_OPTION for each directory in startfile_prefixes.
%G process LIBGCC_SPEC as a spec.
%R Output the concatenation of target_system_root and
target_sysroot_suffix.
@@ -1182,6 +1183,10 @@ proper position among the other output files. */
# define SYSROOT_HEADERS_SUFFIX_SPEC ""
#endif
+#ifndef RUNPATH_OPTION
+# define RUNPATH_OPTION "-rpath"
+#endif
+
static const char *asm_debug = ASM_DEBUG_SPEC;
static const char *asm_debug_option = ASM_DEBUG_OPTION_SPEC;
static const char *cpp_spec = CPP_SPEC;
@@ -5925,6 +5930,7 @@ struct spec_path_info {
size_t append_len;
bool omit_relative;
bool separate_options;
+ bool realpaths;
};
static void *
@@ -5934,6 +5940,16 @@ spec_path (char *path, void *data)
size_t len = 0;
char save = 0;
+ /* The path must exist; we want to resolve it to the realpath so that this
+ can be embedded as a runpath. */
+ if (info->realpaths)
+ path = lrealpath (path);
+
+ /* However, if we failed to resolve it - perhaps because there was a bogus
+ -B option on the command line, then punt on this entry. */
+ if (!path)
+ return NULL;
+
if (info->omit_relative && !IS_ABSOLUTE_PATH (path))
return NULL;
@@ -6165,6 +6181,22 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
info.omit_relative = false;
#endif
info.separate_options = false;
+ info.realpaths = false;
+
+ for_each_path (&startfile_prefixes, true, 0, spec_path, &info);
+ }
+ break;
+
+ case 'P':
+ {
+ struct spec_path_info info;
+
+ info.option = RUNPATH_OPTION;
+ info.append_len = 0;
+ info.omit_relative = false;
+ info.separate_options = true;
+ /* We want to embed the actual paths that have the libraries. */
+ info.realpaths = true;
for_each_path (&startfile_prefixes, true, 0, spec_path, &info);
}
@@ -6491,6 +6523,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
info.append_len = strlen (info.append);
info.omit_relative = false;
info.separate_options = true;
+ info.realpaths = false;
for_each_path (&include_prefixes, false, info.append_len,
spec_path, &info);
--
2.39.2 (Apple Git-143)
[-- Attachment #3: 0002-Darwin-Allow-for-configuring-Darwin-to-use-embedded-.patch --]
[-- Type: application/octet-stream, Size: 279683 bytes --]
From 5259260cf3bfc6cec7a3f0e5caeecfbc6bf00778 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Sun, 28 Mar 2021 14:48:17 +0100
Subject: [PATCH 2/5] Darwin: Allow for configuring Darwin to use embedded
runpath.
Recent Darwin versions place contraints on the use of run paths
specified in environment variables. This breaks some assumptions
in the GCC build.
This change allows the user to configure a Darwin build to use
'@rpath/libraryname.dylib' in library names and then to add an
embedded runpath to executables (and libraries with dependents).
The embedded runpath is added by default unless the user adds
'-nodefaultrpaths' to the link line.
For an installed compiler, it means that any executable built with
that compiler will reference the runtimes installed with the
compiler (equivalent to hard-coding the library path into the name
of the library).
During build-time configurations any "-B" entries will be added to
the runpath thus the newly-built libraries will be found by exes.
Since the install name is set in libtool, that decision needs to be
available here (but might also cause dependent ones in Makefiles,
so we need to export a conditional).
This facility is not available for Darwin 8 or earlier, however the
existing environment variable runpath does work there.
We default this on for systems where the external DYLD_LIBRARY_PATH
does not work and off for Darwin 8 or earlier. For systems that can
use either method, if the value is unset, we use the default (which
is currently DYLD_LIBRARY_PATH).
ChangeLog:
* configure: Regenerate.
* configure.ac: Do not add default runpaths to GCC exes
when we are building -static-libstdc++/-static-libgcc (the
default).
* libtool.m4: Add 'enable-darwin-at-runpath'. Act on the
enable flag to alter Darwin libraries to use @rpath names.
gcc/ChangeLog:
* aclocal.m4: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
* config/darwin.h: Handle Darwin rpaths.
* config/darwin.opt: Handle Darwin rpaths.
* Makefile.in: Handle Darwin rpaths.
gcc/ada/ChangeLog:
* gcc-interface/Makefile.in: Handle Darwin rpaths.
gcc/jit/ChangeLog:
* Make-lang.in: Handle Darwin rpaths.
libatomic/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libbacktrace/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libcc1/ChangeLog:
* configure: Regenerate.
libffi/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
libgcc/ChangeLog:
* config/t-slibgcc-darwin: Generate libgcc_s
with an @rpath name.
* config.host: Handle Darwin rpaths.
libgfortran/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths
libgm2/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* aclocal.m4: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
* libm2cor/Makefile.am: Handle Darwin rpaths.
* libm2cor/Makefile.in: Regenerate.
* libm2iso/Makefile.am: Handle Darwin rpaths.
* libm2iso/Makefile.in: Regenerate.
* libm2log/Makefile.am: Handle Darwin rpaths.
* libm2log/Makefile.in: Regenerate.
* libm2min/Makefile.am: Handle Darwin rpaths.
* libm2min/Makefile.in: Regenerate.
* libm2pim/Makefile.am: Handle Darwin rpaths.
* libm2pim/Makefile.in: Regenerate.
libgomp/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths
libitm/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libobjc/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libphobos/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
* libdruntime/Makefile.am: Handle Darwin rpaths.
* libdruntime/Makefile.in: Regenerate.
* src/Makefile.am: Handle Darwin rpaths.
* src/Makefile.in: Regenerate.
libquadmath/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libsanitizer/ChangeLog:
* asan/Makefile.am: Handle Darwin rpaths.
* asan/Makefile.in: Regenerate.
* configure: Regenerate.
* hwasan/Makefile.am: Handle Darwin rpaths.
* hwasan/Makefile.in: Regenerate.
* lsan/Makefile.am: Handle Darwin rpaths.
* lsan/Makefile.in: Regenerate.
* tsan/Makefile.am: Handle Darwin rpaths.
* tsan/Makefile.in: Regenerate.
* ubsan/Makefile.am: Handle Darwin rpaths.
* ubsan/Makefile.in: Regenerate.
libssp/ChangeLog:
* Makefile.am: Handle Darwin rpaths.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
libstdc++-v3/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
* src/Makefile.am: Handle Darwin rpaths.
* src/Makefile.in: Regenerate.
libvtv/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
lto-plugin/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
zlib/ChangeLog:
* configure: Regenerate.
* configure.ac: Handle Darwin rpaths.
---
configure | 14 ++
configure.ac | 14 ++
gcc/Makefile.in | 11 +-
gcc/aclocal.m4 | 50 +++++++
gcc/ada/gcc-interface/Makefile.in | 5 +-
gcc/config/darwin.h | 32 ++++-
gcc/config/darwin.opt | 4 +
gcc/configure | 133 ++++++++++++++++--
gcc/configure.ac | 2 +
gcc/jit/Make-lang.in | 2 +-
libatomic/Makefile.am | 7 +-
libatomic/Makefile.in | 7 +-
libatomic/configure | 76 ++++++++++-
libatomic/configure.ac | 2 +
libbacktrace/configure | 76 ++++++++++-
libbacktrace/configure.ac | 2 +
libcc1/configure | 118 ++++++++++++++--
libffi/Makefile.am | 7 +-
libffi/Makefile.in | 6 +-
libffi/configure | 132 ++++++++++++++++--
libffi/configure.ac | 1 +
libffi/doc/version.texi | 4 +-
libgcc/config.host | 23 +++-
libgcc/config/t-darwin-rpath | 2 +
libgcc/config/t-slibgcc-darwin | 28 ++--
libgfortran/Makefile.am | 7 +-
libgfortran/Makefile.in | 28 ++--
libgfortran/configure | 131 ++++++++++++++++--
libgfortran/configure.ac | 6 +-
libgm2/Makefile.am | 9 +-
libgm2/Makefile.in | 15 +-
libgm2/aclocal.m4 | 10 +-
libgm2/configure | 145 ++++++++++++++++++--
libgm2/configure.ac | 6 +-
libgm2/libm2cor/Makefile.am | 4 +
libgm2/libm2cor/Makefile.in | 17 ++-
libgm2/libm2iso/Makefile.am | 4 +
libgm2/libm2iso/Makefile.in | 17 ++-
libgm2/libm2log/Makefile.am | 3 +
libgm2/libm2log/Makefile.in | 17 ++-
libgm2/libm2min/Makefile.am | 3 +
libgm2/libm2min/Makefile.in | 17 ++-
libgm2/libm2pim/Makefile.am | 3 +
libgm2/libm2pim/Makefile.in | 17 ++-
libgo/configure | 18 ++-
libgo/configure.ac | 1 +
libgomp/Makefile.am | 7 +-
libgomp/Makefile.in | 5 +-
libgomp/configure | 126 ++++++++++++++++-
libgomp/configure.ac | 1 +
libitm/Makefile.am | 7 +-
libitm/Makefile.in | 7 +-
libitm/configure | 132 ++++++++++++++++--
libitm/configure.ac | 1 +
libobjc/configure | 112 ++++++++++++---
libobjc/configure.ac | 36 +++--
libphobos/configure | 126 ++++++++++++++++-
libphobos/configure.ac | 1 +
libphobos/libdruntime/Makefile.am | 5 +-
libphobos/libdruntime/Makefile.in | 3 +-
libphobos/src/Makefile.am | 5 +-
libphobos/src/Makefile.in | 3 +-
libquadmath/Makefile.am | 7 +-
libquadmath/Makefile.in | 5 +-
libquadmath/configure | 218 +++++++++++++++++++++++++++++-
libquadmath/configure.ac | 3 +
libsanitizer/asan/Makefile.am | 7 +-
libsanitizer/asan/Makefile.in | 7 +-
libsanitizer/configure | 133 ++++++++++++++++--
libsanitizer/configure.ac | 2 +
libsanitizer/hwasan/Makefile.am | 6 +-
libsanitizer/hwasan/Makefile.in | 5 +-
libsanitizer/lsan/Makefile.am | 8 +-
libsanitizer/lsan/Makefile.in | 8 +-
libsanitizer/tsan/Makefile.am | 6 +-
libsanitizer/tsan/Makefile.in | 5 +-
libsanitizer/ubsan/Makefile.am | 7 +-
libsanitizer/ubsan/Makefile.in | 7 +-
libssp/Makefile.am | 6 +-
libssp/Makefile.in | 5 +-
libssp/configure | 76 ++++++++++-
libssp/configure.ac | 2 +
libstdc++-v3/configure | 144 ++++++++++++++++++--
libstdc++-v3/configure.ac | 1 +
libstdc++-v3/src/Makefile.am | 7 +-
libstdc++-v3/src/Makefile.in | 5 +-
libtool.m4 | 57 +++++++-
libvtv/configure | 132 ++++++++++++++++--
libvtv/configure.ac | 1 +
lto-plugin/configure | 75 +++++++++-
lto-plugin/configure.ac | 1 +
zlib/configure | 75 +++++++++-
zlib/configure.ac | 1 +
93 files changed, 2556 insertions(+), 279 deletions(-)
create mode 100644 libgcc/config/t-darwin-rpath
diff --git a/configure b/configure
index 28f0913bdd4..28e25bf7162 100755
--- a/configure
+++ b/configure
@@ -8492,6 +8492,20 @@ else
fi
fi
+case $target in
+ *-darwin2* | *-darwin1[56789]*)
+ # For these versions, we default to using embedded rpaths.
+ if test "x$enable_darwin_at_rpath" != "xno"; then
+ poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths"
+ fi
+ ;;
+ *-darwin*)
+ # For these versions, we only use embedded rpaths on demand.
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths"
+ fi
+ ;;
+esac
# GCC GRAPHITE dependency isl.
diff --git a/configure.ac b/configure.ac
index 5d25dc864c3..49c237bb8b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1855,6 +1855,20 @@ AC_ARG_WITH(boot-ldflags,
if test "$poststage1_libs" = ""; then
poststage1_ldflags="-static-libstdc++ -static-libgcc"
fi])
+case $target in
+ *-darwin2* | *-darwin1[[56789]]*)
+ # For these versions, we default to using embedded rpaths.
+ if test "x$enable_darwin_at_rpath" != "xno"; then
+ poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths"
+ fi
+ ;;
+ *-darwin*)
+ # For these versions, we only use embedded rpaths on demand.
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths"
+ fi
+ ;;
+esac
AC_SUBST(poststage1_ldflags)
# GCC GRAPHITE dependency isl.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 78779546459..60ba2916457 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1193,6 +1193,8 @@ LANG_MAKEFRAGS = @all_lang_makefrags@
# Used by gcc/jit/Make-lang.in
LD_VERSION_SCRIPT_OPTION = @ld_version_script_option@
LD_SONAME_OPTION = @ld_soname_option@
+@ENABLE_DARWIN_AT_RPATH_TRUE@DARWIN_RPATH = @rpath
+@ENABLE_DARWIN_AT_RPATH_FALSE@DARWIN_RPATH = ${libdir}
# Flags to pass to recursive makes.
# CC is set by configure.
@@ -2014,9 +2016,12 @@ cs-tconfig.h: Makefile
$(SHELL) $(srcdir)/mkconfig.sh tconfig.h
cs-tm.h: Makefile
- TARGET_CPU_DEFAULT="$(target_cpu_default)" \
- HEADERS="$(tm_include_list)" DEFINES="$(tm_defines)" \
- $(SHELL) $(srcdir)/mkconfig.sh tm.h
+@ENABLE_DARWIN_AT_RPATH_FALSE@ TARGET_CPU_DEFAULT="$(target_cpu_default)" \
+@ENABLE_DARWIN_AT_RPATH_FALSE@ HEADERS="$(tm_include_list)" DEFINES="$(tm_defines)" \
+@ENABLE_DARWIN_AT_RPATH_FALSE@ $(SHELL) $(srcdir)/mkconfig.sh tm.h
+@ENABLE_DARWIN_AT_RPATH_TRUE@ TARGET_CPU_DEFAULT="$(target_cpu_default)" \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ HEADERS="$(tm_include_list)" DEFINES="$(tm_defines) DARWIN_AT_RPATH=1" \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ $(SHELL) $(srcdir)/mkconfig.sh tm.h
cs-tm_p.h: Makefile
TARGET_CPU_DEFAULT="" \
diff --git a/gcc/aclocal.m4 b/gcc/aclocal.m4
index 6be36df5190..126e09bbcd1 100644
--- a/gcc/aclocal.m4
+++ b/gcc/aclocal.m4
@@ -12,6 +12,56 @@
# PARTICULAR PURPOSE.
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ([2.52])dnl
+ m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 2006-2017 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# --------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
m4_include([../libtool.m4])
m4_include([../ltoptions.m4])
m4_include([../ltsugar.m4])
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index b5243a24a8f..ad7cf5072e5 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -794,12 +794,15 @@ gnatlib-shared-darwin:
$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
$(SO_OPTS) \
-Wl,-install_name,@rpath/libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
- $(MISCLIB)
+ -nodefaultrpaths -Wl,-rpath,@loader_path/,-rpath,@loader_path/.. \
+ -Wl,-rpath,@loader_path/../../../../ $(MISCLIB)
cd $(RTSDIR); $(GCC_FOR_ADA_RTS) -dynamiclib $(PICFLAG_FOR_TARGET) \
-o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
$(GNATRTL_TASKING_OBJS) \
$(SO_OPTS) \
-Wl,-install_name,@rpath/libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ -nodefaultrpaths -Wl,-rpath,@loader_path/,-rpath,@loader_path/.. \
+ -Wl,-rpath,@loader_path/../../../../ \
$(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
cd $(RTSDIR); $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
libgnat$(soext)
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index e0e8672a455..1b6920f4c92 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -309,6 +309,18 @@ extern GTY(()) int darwin_ms_struct;
#define DARWIN_CC1_SPEC \
"%<dynamic %<dynamiclib %<force_cpusubtype_ALL %<multiply_defined* "
+/* When we are using embedded runpaths DARWIN_AT_RPATH is set. */
+#if DARWIN_AT_RPATH
+# define DARWIN_RPATH_LINK \
+"%{!r:%{!nostdlib:%{!nodefaultrpaths:%(darwin_rpaths)}}}"
+# define DARWIN_SHARED_LIBGCC "-lgcc_s.1.1"
+#else
+# define DARWIN_RPATH_LINK ""
+# define DARWIN_SHARED_LIBGCC \
+"%:version-compare(!> 10.11 mmacosx-version-min= -lgcc_s.1.1) \
+ %:version-compare(>= 10.11 mmacosx-version-min= -lemutls_w) "
+#endif
+
#define SUBSUBTARGET_OVERRIDE_OPTIONS \
do { \
darwin_override_options (); \
@@ -403,7 +415,8 @@ extern GTY(()) int darwin_ms_struct;
DARWIN_NOPIE_SPEC \
DARWIN_RDYNAMIC \
DARWIN_NOCOMPACT_UNWIND \
- "}}}}}}} %<pie %<no-pie %<rdynamic %<X %<rpath "
+ DARWIN_RPATH_LINK \
+ "}}}}}}} %<pie %<no-pie %<rdynamic %<X %<rpath %<nodefaultrpaths "
/* Spec that controls whether the debug linker is run automatically for
a link step. This needs to be done if there is a source file on the
@@ -518,8 +531,7 @@ extern GTY(()) int darwin_ms_struct;
%:version-compare(!> 10.6 mmacosx-version-min= -lgcc_eh) \
%:version-compare(>= 10.6 mmacosx-version-min= -lemutls_w); \
shared-libgcc|fexceptions|fobjc-exceptions|fgnu-runtime: \
- %:version-compare(!> 10.11 mmacosx-version-min= -lgcc_s.1.1) \
- %:version-compare(>= 10.11 mmacosx-version-min= -lemutls_w) \
+ " DARWIN_SHARED_LIBGCC " \
%:version-compare(!> 10.3.9 mmacosx-version-min= -lgcc_eh) \
%:version-compare(>< 10.3.9 10.5 mmacosx-version-min= -lgcc_s.10.4) \
%:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5); \
@@ -554,7 +566,8 @@ extern GTY(()) int darwin_ms_struct;
{ "darwin_crt2", DARWIN_CRT2_SPEC }, \
{ "darwin_crt3", DARWIN_CRT3_SPEC }, \
{ "darwin_dylib1", DARWIN_DYLIB1_SPEC }, \
- { "darwin_bundle1", DARWIN_BUNDLE1_SPEC },
+ { "darwin_bundle1", DARWIN_BUNDLE1_SPEC }, \
+ { "darwin_rpaths", DARWIN_RPATH_SPEC },
#define DARWIN_CRT1_SPEC \
"%:version-compare(!> 10.5 mmacosx-version-min= -lcrt1.o) \
@@ -580,6 +593,17 @@ extern GTY(()) int darwin_ms_struct;
"%{!static:%:version-compare(< 10.6 mmacosx-version-min= -lbundle1.o) \
%{fgnu-tm: -lcrttms.o}}"
+#if DARWIN_AT_RPATH
+/* A default rpath, that picks up dependent libraries installed in the same
+ director as one being loaded. */
+#define DARWIN_RPATH_SPEC \
+ "%:version-compare(>= 10.5 mmacosx-version-min= -rpath) \
+ %:version-compare(>= 10.5 mmacosx-version-min= @loader_path) \
+ %P "
+#else
+#define DARWIN_RPATH_SPEC ""
+#endif
+
#ifdef HAVE_AS_MMACOSX_VERSION_MIN_OPTION
/* Emit macosx version (but only major). */
#define ASM_MMACOSX_VERSION_MIN_SPEC \
diff --git a/gcc/config/darwin.opt b/gcc/config/darwin.opt
index d655aaef2fb..ff624ffd82a 100644
--- a/gcc/config/darwin.opt
+++ b/gcc/config/darwin.opt
@@ -241,6 +241,10 @@ nodefaultexport
Driver RejectNegative
Do not add a default symbol exports to modules or dynamic libraries.
+nodefaultrpaths
+Driver RejectNegative
+Do not add default run paths (for the compiler library directories) to executables, modules or dynamic libraries.
+
nofixprebinding
Driver RejectNegative
(Obsolete after 10.3.9) Set MH_NOPREFIXBINDING, in an executable.
diff --git a/gcc/configure b/gcc/configure
index 07e8a64afbb..eaa1a189583 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -741,6 +741,8 @@ ORIGINAL_PLUGIN_LD_FOR_TARGET
gcc_cv_ld
ORIGINAL_AS_FOR_TARGET
gcc_cv_as
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_fast_install
objdir
OTOOL64
@@ -1006,6 +1008,7 @@ enable_static
with_pic
enable_fast_install
enable_libtool_lock
+enable_darwin_at_rpath
enable_ld
enable_gold
with_plugin_ld
@@ -1741,6 +1744,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-ld[=ARG] build ld [ARG={default,yes,no}]
--enable-gold[=ARG] build gold [ARG={default,yes,no}]
--enable-gnu-indirect-function
@@ -16356,7 +16362,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -18061,6 +18067,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -18078,9 +18127,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -19886,7 +19939,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19889 "configure"
+#line 19942 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -19992,7 +20045,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19995 "configure"
+#line 20048 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -20868,6 +20921,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -20885,12 +20981,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -23261,6 +23365,15 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# Identify the assembler which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the assembler
# which will be driven by the driver program.
@@ -32851,6 +32964,10 @@ LTLIBOBJS=$ac_ltlibobjs
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 62c31d8e02d..80e31229408 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2599,6 +2599,8 @@ AC_PROG_LIBTOOL
AC_SUBST(objdir)
AC_SUBST(enable_fast_install)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
# Identify the assembler which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the assembler
# which will be driven by the driver program.
diff --git a/gcc/jit/Make-lang.in b/gcc/jit/Make-lang.in
index a65f13853ae..3fd564a5932 100644
--- a/gcc/jit/Make-lang.in
+++ b/gcc/jit/Make-lang.in
@@ -59,7 +59,7 @@ LIBGCCJIT_AGE = 1
LIBGCCJIT_BASENAME = libgccjit
LIBGCCJIT_SONAME = \
- ${libdir}/$(LIBGCCJIT_BASENAME).$(LIBGCCJIT_VERSION_NUM).dylib
+ $(DARWIN_RPATH)/$(LIBGCCJIT_BASENAME).$(LIBGCCJIT_VERSION_NUM).dylib
LIBGCCJIT_FILENAME = $(LIBGCCJIT_BASENAME).$(LIBGCCJIT_VERSION_NUM).dylib
LIBGCCJIT_LINKER_NAME = $(LIBGCCJIT_BASENAME).dylib
diff --git a/libatomic/Makefile.am b/libatomic/Makefile.am
index c6c8d81c56a..3bb32f32ebf 100644
--- a/libatomic/Makefile.am
+++ b/libatomic/Makefile.am
@@ -65,8 +65,13 @@ libatomic_version_script =
libatomic_version_dep =
endif
libatomic_version_info = -version-info $(libtool_VERSION)
+if ENABLE_DARWIN_AT_RPATH
+libatomic_darwin_rpath = -Wc,-nodefaultrpaths
+libatomic_darwin_rpath += -Wl,-rpath,@loader_path
+endif
-libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) $(lt_host_flags)
+libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) \
+ $(lt_host_flags) $(libatomic_darwin_rpath)
libatomic_la_SOURCES = gload.c gstore.c gcas.c gexch.c glfree.c lock.c init.c \
fenv.c fence.c flag.c
diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in
index 83efe7d2694..4164199cf9d 100644
--- a/libatomic/Makefile.in
+++ b/libatomic/Makefile.in
@@ -416,7 +416,12 @@ noinst_LTLIBRARIES = libatomic_convenience.la
@LIBAT_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@libatomic_version_dep = $(top_srcdir)/libatomic.map
@LIBAT_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@libatomic_version_dep = libatomic.map-sun
libatomic_version_info = -version-info $(libtool_VERSION)
-libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) $(lt_host_flags)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libatomic_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) \
+ $(lt_host_flags) $(libatomic_darwin_rpath)
+
libatomic_la_SOURCES = gload.c gstore.c gcas.c gexch.c glfree.c lock.c \
init.c fenv.c fence.c flag.c $(am__append_2)
SIZEOBJS = load store cas exch fadd fsub fand fior fxor fnand tas
diff --git a/libatomic/configure b/libatomic/configure
index 57f320753e1..dc5f4bca65e 100755
--- a/libatomic/configure
+++ b/libatomic/configure
@@ -658,6 +658,8 @@ OPT_LDFLAGS
SECTION_LDFLAGS
enable_aarch64_lse
libtool_VERSION
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
@@ -802,6 +804,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
enable_symvers
enable_werror
@@ -1451,6 +1454,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -7604,7 +7610,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9577,6 +9583,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9594,9 +9643,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11402,7 +11455,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11405 "configure"
+#line 11458 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11508,7 +11561,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11511 "configure"
+#line 11564 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11793,6 +11846,15 @@ fi
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=3:0:2
@@ -15920,6 +15982,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${LIBAT_BUILD_VERSIONED_SHLIB_TRUE}" && test -z "${LIBAT_BUILD_VERSIONED_SHLIB_FALSE}"; then
as_fn_error $? "conditional \"LIBAT_BUILD_VERSIONED_SHLIB\" was never defined.
diff --git a/libatomic/configure.ac b/libatomic/configure.ac
index 318b605a1d7..6919d212ae5 100644
--- a/libatomic/configure.ac
+++ b/libatomic/configure.ac
@@ -155,6 +155,8 @@ AC_SUBST(enable_shared)
AC_SUBST(enable_static)
AM_MAINTAINER_MODE
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=3:0:2
AC_SUBST(libtool_VERSION)
diff --git a/libbacktrace/configure b/libbacktrace/configure
index c3e7b884e36..0ccc060901d 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -681,6 +681,8 @@ PIC_FLAG
WARN_FLAGS
EXTRA_FLAGS
BACKTRACE_FILE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
OTOOL64
OTOOL
LIPO
@@ -805,6 +807,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_largefile
enable_cet
enable_werror
@@ -1453,6 +1456,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--disable-largefile omit support for large files
--enable-cet enable Intel CET in target libraries [default=auto]
--disable-werror disable building with -Werror
@@ -8048,7 +8054,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9754,6 +9760,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9771,9 +9820,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11579,7 +11632,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11582 "configure"
+#line 11635 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11685,7 +11738,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11688 "configure"
+#line 11741 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11924,6 +11977,15 @@ CC="$lt_save_CC"
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# Check whether --enable-largefile was given.
if test "${enable_largefile+set}" = set; then :
enableval=$enable_largefile;
@@ -14486,6 +14548,10 @@ if test -z "${HAVE_DWZ_TRUE}" && test -z "${HAVE_DWZ_FALSE}"; then
as_fn_error $? "conditional \"HAVE_DWZ\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${HAVE_ELF_TRUE}" && test -z "${HAVE_ELF_FALSE}"; then
as_fn_error $? "conditional \"HAVE_ELF\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac
index 72ff2b30053..71cd50f8cdf 100644
--- a/libbacktrace/configure.ac
+++ b/libbacktrace/configure.ac
@@ -84,6 +84,8 @@ AM_CONDITIONAL(HAVE_DWZ, test "$DWZ" != "")
LT_INIT
AM_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
AC_SYS_LARGEFILE
backtrace_supported=yes
diff --git a/libcc1/configure b/libcc1/configure
index 2a914a0bfc8..ea689a353c8 100755
--- a/libcc1/configure
+++ b/libcc1/configure
@@ -787,6 +787,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_cet
with_gcc_major_version_only
enable_werror_always
@@ -1439,6 +1440,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-cet enable Intel CET in host libraries [default=auto]
--enable-werror-always enable -Werror despite compiler version
--enable-plugin enable plugin support
@@ -7309,7 +7313,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9014,6 +9018,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9031,9 +9078,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -10839,7 +10890,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10842 "configure"
+#line 10893 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10945,7 +10996,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10948 "configure"
+#line 10999 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12227,6 +12278,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -12244,12 +12338,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
diff --git a/libffi/Makefile.am b/libffi/Makefile.am
index 2259ddb75f9..2c5b74df9ee 100644
--- a/libffi/Makefile.am
+++ b/libffi/Makefile.am
@@ -214,7 +214,12 @@ libffi.map: $(top_srcdir)/libffi.map.in
$(COMPILE) -D$(TARGET) -DGENERATE_LIBFFI_MAP \
-E -x assembler-with-cpp -o $@ $(top_srcdir)/libffi.map.in
-libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS)
+if ENABLE_DARWIN_AT_RPATH
+libffi_darwin_rpath = -Wl,-rpath,@loader_path
+endif
+libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) \
+ $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS) \
+ $(libffi_darwin_rpath)
libffi_la_DEPENDENCIES = $(libffi_la_LIBADD) $(libffi_version_dep)
AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
diff --git a/libffi/Makefile.in b/libffi/Makefile.in
index 1d936b5c8a5..71469f7d632 100644
--- a/libffi/Makefile.in
+++ b/libffi/Makefile.in
@@ -597,7 +597,11 @@ AM_CFLAGS = -Wall -g -fexceptions $(CET_FLAGS) $(am__append_2)
@LIBFFI_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBFFI_BUILD_VERSIONED_SHLIB_TRUE@libffi_version_dep = libffi.map
@LIBFFI_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBFFI_BUILD_VERSIONED_SHLIB_TRUE@libffi_version_dep = libffi.map-sun
libffi_version_info = -version-info `grep -v '^\#' $(srcdir)/libtool-version`
-libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libffi_darwin_rpath = -Wl,-rpath,@loader_path
+libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) \
+ $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS) \
+ $(libffi_darwin_rpath)
+
libffi_la_DEPENDENCIES = $(libffi_la_LIBADD) $(libffi_version_dep)
AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
AM_CCASFLAGS = $(AM_CPPFLAGS) $(CET_FLAGS)
diff --git a/libffi/configure b/libffi/configure
index 9eac9c907bf..29054551f7e 100755
--- a/libffi/configure
+++ b/libffi/configure
@@ -667,6 +667,8 @@ MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
READELF
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
CXXCPP
CPP
OTOOL64
@@ -810,6 +812,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
enable_pax_emutramp
enable_debug
@@ -1465,6 +1468,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -7835,7 +7841,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9809,6 +9815,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9826,9 +9875,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11634,7 +11687,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11637 "configure"
+#line 11690 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11740,7 +11793,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11743 "configure"
+#line 11796 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12616,6 +12669,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -12633,12 +12729,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15008,6 +15112,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# Only expand once:
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}readelf", so it can be a program name with args.
@@ -17153,6 +17265,10 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libffi/configure.ac b/libffi/configure.ac
index 014d89d0423..716f20ae313 100644
--- a/libffi/configure.ac
+++ b/libffi/configure.ac
@@ -55,6 +55,7 @@ AC_SUBST(CET_FLAGS)
AM_PROG_AS
AM_PROG_CC_C_O
AC_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
AC_CHECK_TOOL(READELF, readelf)
diff --git a/libffi/doc/version.texi b/libffi/doc/version.texi
index f2b741e87e4..6261b21fec9 100644
--- a/libffi/doc/version.texi
+++ b/libffi/doc/version.texi
@@ -1,4 +1,4 @@
-@set UPDATED 27 June 2021
-@set UPDATED-MONTH June 2021
+@set UPDATED 31 August 2022
+@set UPDATED-MONTH August 2022
@set EDITION 3.4.2
@set VERSION 3.4.2
diff --git a/libgcc/config.host b/libgcc/config.host
index c94d69d84b7..d40cf55acb6 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -233,7 +233,6 @@ case ${host} in
;;
esac
tmake_file="$tmake_file t-slibgcc-darwin"
- # newer toolsets produce warnings when building for unsupported versions.
case ${host} in
*-*-darwin1[89]* | *-*-darwin2* )
tmake_file="t-darwin-min-8 $tmake_file"
@@ -251,6 +250,28 @@ case ${host} in
echo "Warning: libgcc configured to support macOS 10.5" 1>&2
;;
esac
+ # We are not using libtool to build the libs here, so we need to replicate
+ # a little of the logic around setting Darwin rpaths. Setting an explicit
+ # yes or no is honoured, otherwise we choose a suitable default.
+ # Sadly, this has to be kept in line with the rules in libtool.m4.
+ # This make fragment will override the setting in t-slibgcc-darwin so it
+ # must appear after it.
+ if test "x$enable_darwin_at_rpath" = "x"; then
+ echo "enable_darwin_at_rpath is unset" 1>&2
+ case ${host} in
+ *-darwin[45678]*) ;;
+ *-darwin9* | *-darwin1[01234]*) ;; # We might default these on later.
+ *-darwin*)
+ echo "but is needed after macOS 10.11 (setting it on)" 1>&2
+ enable_darwin_at_rpath=yes
+ ;;
+ esac
+ else
+ echo "enable_darwin_at_rpath is '$enable_darwin_at_rpath'" 1>&2
+ fi
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ tmake_file="$tmake_file t-darwin-rpath "
+ fi
extra_parts="crt3.o libd10-uwfef.a crttms.o crttme.o libemutls_w.a"
;;
*-*-dragonfly*)
diff --git a/libgcc/config/t-darwin-rpath b/libgcc/config/t-darwin-rpath
new file mode 100644
index 00000000000..e73d7f378b0
--- /dev/null
+++ b/libgcc/config/t-darwin-rpath
@@ -0,0 +1,2 @@
+# Use @rpath and add a search path to exes and dylibs that depend on this.
+SHLIB_RPATH = @rpath
diff --git a/libgcc/config/t-slibgcc-darwin b/libgcc/config/t-slibgcc-darwin
index cb0cbbdb1c5..da4886848e8 100644
--- a/libgcc/config/t-slibgcc-darwin
+++ b/libgcc/config/t-slibgcc-darwin
@@ -1,4 +1,4 @@
-# Build a shared libgcc library with the darwin linker.
+# Build a shared libgcc library able to use embedded runpaths.
SHLIB_SOVERSION = 1.1
SHLIB_SO_MINVERSION = 1
@@ -6,7 +6,6 @@ SHLIB_VERSTRING = -compatibility_version $(SHLIB_SO_MINVERSION) \
-current_version $(SHLIB_SOVERSION)
SHLIB_EXT = .dylib
SHLIB_LC = -lSystem
-SHLIB_INSTALL_DIR = $(slibdir)
SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
SHLIB_MKMAP_OPTS = -v leading_underscore=1
@@ -23,11 +22,16 @@ SHLIB_SONAME = @shlib_base_name@$(SHLIB_EXT)
# subdir. The code under MULTIBUILDTOP combines these into a single FAT
# library, that is what we eventually install.
+# When enable_darwin_at_rpath is true, use @rpath instead of $(slibdir) for
+# this and dylibs that depend on this. So this def must come first and be
+# overridden in a make fragment that depends on the rpath setting.
+SHLIB_RPATH = $(slibdir)
+
SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) $(LDFLAGS) -dynamiclib -nodefaultlibs \
- -install_name $(SHLIB_INSTALL_DIR)/$(SHLIB_INSTALL_NAME) \
+ -install_name $(SHLIB_RPATH)/$(SHLIB_INSTALL_NAME) \
-single_module -o $(SHLIB_DIR)/$(SHLIB_SONAME) \
-Wl,-exported_symbols_list,$(SHLIB_MAP) \
- $(SHLIB_VERSTRING) \
+ $(SHLIB_VERSTRING) -nodefaultrpaths \
@multilib_flags@ @shlib_objs@ $(SHLIB_LC)
# we do our own thing
@@ -63,9 +67,9 @@ EHS_INSTNAME = libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT)
libgcc_ehs$(SHLIB_EXT): $(LIBEHSOBJS) $(extra-parts)
mkdir -p $(MULTIDIR)
$(CC) $(LIBGCC2_CFLAGS) $(LDFLAGS) -dynamiclib -nodefaultlibs \
- -install_name $(SHLIB_INSTALL_DIR)/$(EHS_INSTNAME) \
+ -install_name $(SHLIB_RPATH)/$(EHS_INSTNAME) \
-o $(MULTIDIR)/libgcc_ehs$(SHLIB_EXT) $(SHLIB_VERSTRING) \
- $(LIBEHSOBJS) $(SHLIB_LC)
+ -nodefaultrpaths $(LIBEHSOBJS) $(SHLIB_LC)
all: libgcc_ehs$(SHLIB_EXT)
@@ -122,12 +126,12 @@ libgcc_s.1.dylib: all-multi libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT) \
cp ../$${mlib}/libgcc/$${mlib}/libgcc_ehs$(SHLIB_EXT) \
./libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} || exit 1 ; \
arch=`$(LIPO) -info libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} | sed -e 's/.*:\ //'` ; \
- $(CC) -arch $${arch} -nodefaultlibs -dynamiclib \
+ $(CC) -arch $${arch} -nodefaultlibs -dynamiclib -nodefaultrpaths \
-o libgcc_s.1$(SHLIB_EXT)_T_$${mlib} \
-Wl,-reexport_library,libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} \
-Wl,-reexport_library,libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} \
- -install_name $(SHLIB_INSTALL_DIR)/libgcc_s.1.dylib \
- -compatibility_version 1 -current_version 1 ; \
+ -install_name $(SHLIB_RPATH)/libgcc_s.1.dylib \
+ -compatibility_version 1 -current_version 1.1 ; \
done
$(LIPO) -output libgcc_s.1$(SHLIB_EXT) -create libgcc_s.1$(SHLIB_EXT)_T*
rm libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T*
@@ -141,13 +145,13 @@ libgcc_s.1.dylib: all-multi libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)
cp ../$${mlib}/libgcc/$${mlib}/libgcc_s$(SHLIB_EXT) \
./libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} || exit 1 ; \
arch=`$(LIPO) -info libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} | sed -e 's/.*:\ //'` ; \
- $(CC) -arch $${arch} -nodefaultlibs -dynamiclib \
+ $(CC) -arch $${arch} -nodefaultlibs -dynamiclib -nodefaultrpaths \
-o libgcc_s.1$(SHLIB_EXT)_T_$${mlib} \
-Wl,-reexport_library,libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} \
-lSystem \
-Wl,-reexported_symbols_list,$(srcdir)/config/darwin-unwind.ver \
- -install_name $(SHLIB_INSTALL_DIR)/libgcc_s.1.dylib \
- -compatibility_version 1 -current_version 1 ; \
+ -install_name $(SHLIB_RPATH)/libgcc_s.1.dylib \
+ -compatibility_version 1 -current_version 1.1 ; \
done
$(LIPO) -output libgcc_s.1$(SHLIB_EXT) -create libgcc_s.1$(SHLIB_EXT)_T*
rm libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T*
diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am
index 9fab07c9a50..9f8a4f69863 100644
--- a/libgfortran/Makefile.am
+++ b/libgfortran/Makefile.am
@@ -37,6 +37,11 @@ else
version_arg =
version_dep =
endif
+extra_darwin_ldflags_libgfortran = @extra_ldflags_libgfortran@
+if ENABLE_DARWIN_AT_RPATH
+extra_darwin_ldflags_libgfortran += -Wc,-nodefaultrpaths
+extra_darwin_ldflags_libgfortran += -Wl,-rpath,@loader_path
+endif
gfor_c_HEADERS = ISO_Fortran_binding.h
gfor_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
@@ -50,7 +55,7 @@ libgfortran_la_LINK = $(LINK) $(libgfortran_la_LDFLAGS)
libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
$(LTLDFLAGS) $(LIBQUADLIB) ../libbacktrace/libbacktrace.la \
$(HWCAP_LDFLAGS) \
- $(LIBM) $(extra_ldflags_libgfortran) \
+ $(LIBM) $(extra_darwin_ldflags_libgfortran) \
$(version_arg) -Wc,-shared-libgcc
libgfortran_la_DEPENDENCIES = $(version_dep) libgfortran.spec $(LIBQUADLIB_DEP)
diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in
index e8627f9a4bc..30d1dc56da7 100644
--- a/libgfortran/Makefile.in
+++ b/libgfortran/Makefile.in
@@ -91,8 +91,10 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-@LIBGFOR_MINIMAL_TRUE@am__append_1 = -DLIBGFOR_MINIMAL
-@LIBGFOR_MINIMAL_FALSE@am__append_2 = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+@LIBGFOR_MINIMAL_TRUE@am__append_2 = -DLIBGFOR_MINIMAL
+@LIBGFOR_MINIMAL_FALSE@am__append_3 = \
@LIBGFOR_MINIMAL_FALSE@io/close.c \
@LIBGFOR_MINIMAL_FALSE@io/file_pos.c \
@LIBGFOR_MINIMAL_FALSE@io/format.c \
@@ -110,7 +112,7 @@ target_triplet = @target@
@LIBGFOR_MINIMAL_FALSE@io/fbuf.c \
@LIBGFOR_MINIMAL_FALSE@io/async.c
-@LIBGFOR_MINIMAL_FALSE@am__append_3 = \
+@LIBGFOR_MINIMAL_FALSE@am__append_4 = \
@LIBGFOR_MINIMAL_FALSE@intrinsics/access.c \
@LIBGFOR_MINIMAL_FALSE@intrinsics/c99_functions.c \
@LIBGFOR_MINIMAL_FALSE@intrinsics/chdir.c \
@@ -143,9 +145,9 @@ target_triplet = @target@
@LIBGFOR_MINIMAL_FALSE@intrinsics/umask.c \
@LIBGFOR_MINIMAL_FALSE@intrinsics/unlink.c
-@IEEE_SUPPORT_TRUE@am__append_4 = ieee/ieee_helper.c
-@LIBGFOR_MINIMAL_TRUE@am__append_5 = runtime/minimal.c
-@LIBGFOR_MINIMAL_FALSE@am__append_6 = \
+@IEEE_SUPPORT_TRUE@am__append_5 = ieee/ieee_helper.c
+@LIBGFOR_MINIMAL_TRUE@am__append_6 = runtime/minimal.c
+@LIBGFOR_MINIMAL_FALSE@am__append_7 = \
@LIBGFOR_MINIMAL_FALSE@runtime/backtrace.c \
@LIBGFOR_MINIMAL_FALSE@runtime/convert_char.c \
@LIBGFOR_MINIMAL_FALSE@runtime/environ.c \
@@ -584,7 +586,7 @@ AMTAR = @AMTAR@
# Some targets require additional compiler options for IEEE compatibility.
AM_CFLAGS = @AM_CFLAGS@ -fcx-fortran-rules $(SECTION_FLAGS) \
- $(IEEE_FLAGS) $(am__append_1)
+ $(IEEE_FLAGS) $(am__append_2)
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ $(IEEE_FLAGS)
AR = @AR@
@@ -743,6 +745,8 @@ gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
@LIBGFOR_USE_SYMVER_FALSE@version_dep =
@LIBGFOR_USE_SYMVER_GNU_TRUE@@LIBGFOR_USE_SYMVER_TRUE@version_dep = gfortran.ver
@LIBGFOR_USE_SYMVER_SUN_TRUE@@LIBGFOR_USE_SYMVER_TRUE@version_dep = gfortran.ver-sun gfortran.ver
+extra_darwin_ldflags_libgfortran = @extra_ldflags_libgfortran@ \
+ $(am__append_1)
gfor_c_HEADERS = ISO_Fortran_binding.h
gfor_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) \
@@ -754,7 +758,7 @@ libgfortran_la_LINK = $(LINK) $(libgfortran_la_LDFLAGS)
libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
$(LTLDFLAGS) $(LIBQUADLIB) ../libbacktrace/libbacktrace.la \
$(HWCAP_LDFLAGS) \
- $(LIBM) $(extra_ldflags_libgfortran) \
+ $(LIBM) $(extra_darwin_ldflags_libgfortran) \
$(version_arg) -Wc,-shared-libgcc
libgfortran_la_DEPENDENCIES = $(version_dep) libgfortran.spec $(LIBQUADLIB_DEP)
@@ -775,7 +779,7 @@ AM_CPPFLAGS = -iquote$(srcdir)/io -I$(srcdir)/$(MULTISRCTOP)../gcc \
-I$(MULTIBUILDTOP)../libbacktrace \
-I../libbacktrace
-gfor_io_src = io/size_from_kind.c $(am__append_2)
+gfor_io_src = io/size_from_kind.c $(am__append_3)
gfor_io_headers = \
io/io.h \
io/fbuf.h \
@@ -797,7 +801,7 @@ gfor_helper_src = intrinsics/associated.c intrinsics/abort.c \
intrinsics/selected_int_kind.f90 \
intrinsics/selected_real_kind.f90 intrinsics/trigd.c \
intrinsics/unpack_generic.c runtime/in_pack_generic.c \
- runtime/in_unpack_generic.c $(am__append_3) $(am__append_4)
+ runtime/in_unpack_generic.c $(am__append_4) $(am__append_5)
@IEEE_SUPPORT_TRUE@gfor_ieee_helper_src = ieee/ieee_helper.c
@IEEE_SUPPORT_FALSE@gfor_ieee_src =
@IEEE_SUPPORT_TRUE@gfor_ieee_src = \
@@ -806,8 +810,8 @@ gfor_helper_src = intrinsics/associated.c intrinsics/abort.c \
@IEEE_SUPPORT_TRUE@ieee/ieee_features.F90
gfor_src = runtime/bounds.c runtime/compile_options.c runtime/memory.c \
- runtime/string.c runtime/select.c $(am__append_5) \
- $(am__append_6)
+ runtime/string.c runtime/select.c $(am__append_6) \
+ $(am__append_7)
i_all_c = \
$(srcdir)/generated/all_l1.c \
$(srcdir)/generated/all_l2.c \
diff --git a/libgfortran/configure b/libgfortran/configure
index cd176b04a14..774dd52fc95 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -654,6 +654,8 @@ extra_ldflags_libgfortran
ac_ct_FC
FCFLAGS
FC
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -819,6 +821,7 @@ enable_static
with_pic
enable_fast_install
enable_libtool_lock
+enable_darwin_at_rpath
enable_largefile
enable_libquadmath_support
with_gcc_major_version_only
@@ -1473,6 +1476,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--disable-largefile omit support for large files
--disable-libquadmath-support
disable libquadmath support for Fortran
@@ -9243,7 +9249,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10953,6 +10959,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10970,9 +11019,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12799,7 +12852,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12802 "configure"
+#line 12855 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12905,7 +12958,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12908 "configure"
+#line 12961 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13307,6 +13360,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
#AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10
# We need gfortran to compile parts of the library
@@ -14950,6 +15011,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_FC=no
hardcode_direct_FC=no
hardcode_automatic_FC=yes
@@ -14967,9 +15071,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_FC="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_FC="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -16242,9 +16350,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# extra LD Flags which are required for targets
+extra_ldflags_libgfortran=
case "${host}" in
- *-darwin*)
- # Darwin needs -single_module when linking libgfortran
+ *-*-darwin[4567]*)
+ # Earlier Darwin needs -single_module when linking libgfortran
extra_ldflags_libgfortran=-Wl,-single_module
;;
esac
@@ -31601,6 +31710,10 @@ if test -z "${HAVE_HWCAP_TRUE}" && test -z "${HAVE_HWCAP_FALSE}"; then
as_fn_error $? "conditional \"HAVE_HWCAP\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${IEEE_SUPPORT_TRUE}" && test -z "${IEEE_SUPPORT_FALSE}"; then
as_fn_error $? "conditional \"IEEE_SUPPORT\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index 8bd2af966c8..46585a3ee14 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -269,6 +269,7 @@ LT_LIB_M
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
#AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10
# We need gfortran to compile parts of the library
@@ -277,9 +278,10 @@ FC="$GFORTRAN"
AC_PROG_FC(gfortran)
# extra LD Flags which are required for targets
+extra_ldflags_libgfortran=
case "${host}" in
- *-darwin*)
- # Darwin needs -single_module when linking libgfortran
+ *-*-darwin[[4567]]*)
+ # Earlier Darwin needs -single_module when linking libgfortran
extra_ldflags_libgfortran=-Wl,-single_module
;;
esac
diff --git a/libgm2/Makefile.am b/libgm2/Makefile.am
index 95df3ed7a30..aa35e747c9a 100644
--- a/libgm2/Makefile.am
+++ b/libgm2/Makefile.am
@@ -46,6 +46,12 @@ SUBDIRS = libm2min libm2log libm2cor libm2iso libm2pim
GM2_BUILDDIR := $(shell pwd)
gm2_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
+if ENABLE_DARWIN_AT_RPATH
+DARWIN_AT_RPATH=yes
+else
+DARWIN_AT_RPATH=yes
+endif
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
# friends when we are called from the top level Makefile.
@@ -91,7 +97,8 @@ AM_MAKEFLAGS = \
"WERROR=$(WERROR)" \
"TARGET_LIB_PATH=$(TARGET_LIB_PATH)" \
"TARGET_LIB_PATH_libgm2=$(TARGET_LIB_PATH_libgm2)" \
- "LIBTOOL=$(GM2_BUILDDIR)/libtool"
+ "LIBTOOL=$(GM2_BUILDDIR)/libtool" \
+ "DARWIN_AT_RPATH=$(DARWIN_AT_RPATH)"
# Subdir rules rely on $(FLAGS_TO_PASS)
FLAGS_TO_PASS = $(AM_MAKEFLAGS)
diff --git a/libgm2/Makefile.in b/libgm2/Makefile.in
index c0396791f48..e8fa4aa52dc 100644
--- a/libgm2/Makefile.in
+++ b/libgm2/Makefile.in
@@ -90,15 +90,15 @@ host_triplet = @host@
target_triplet = @target@
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
@@ -343,6 +343,8 @@ GM2_SRC = $(GCC_DIR)/m2
SUBDIRS = libm2min libm2log libm2cor libm2iso libm2pim
GM2_BUILDDIR := $(shell pwd)
gm2_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
+@ENABLE_DARWIN_AT_RPATH_FALSE@DARWIN_AT_RPATH = yes
+@ENABLE_DARWIN_AT_RPATH_TRUE@DARWIN_AT_RPATH = yes
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
@@ -389,7 +391,8 @@ AM_MAKEFLAGS = \
"WERROR=$(WERROR)" \
"TARGET_LIB_PATH=$(TARGET_LIB_PATH)" \
"TARGET_LIB_PATH_libgm2=$(TARGET_LIB_PATH_libgm2)" \
- "LIBTOOL=$(GM2_BUILDDIR)/libtool"
+ "LIBTOOL=$(GM2_BUILDDIR)/libtool" \
+ "DARWIN_AT_RPATH=$(DARWIN_AT_RPATH)"
# Subdir rules rely on $(FLAGS_TO_PASS)
diff --git a/libgm2/aclocal.m4 b/libgm2/aclocal.m4
index c352303012d..832065fbb9b 100644
--- a/libgm2/aclocal.m4
+++ b/libgm2/aclocal.m4
@@ -1187,14 +1187,14 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
-m4_include([../libtool.m4])
-m4_include([../ltoptions.m4])
-m4_include([../ltsugar.m4])
-m4_include([../ltversion.m4])
-m4_include([../lt~obsolete.m4])
m4_include([../config/acx.m4])
m4_include([../config/depstand.m4])
m4_include([../config/lead-dot.m4])
m4_include([../config/multi.m4])
m4_include([../config/no-executables.m4])
m4_include([../config/override.m4])
+m4_include([../libtool.m4])
+m4_include([../ltoptions.m4])
+m4_include([../ltsugar.m4])
+m4_include([../ltversion.m4])
+m4_include([../lt~obsolete.m4])
diff --git a/libgm2/configure b/libgm2/configure
index 072d584544e..d55a7f4a74b 100755
--- a/libgm2/configure
+++ b/libgm2/configure
@@ -649,6 +649,8 @@ GM2_FOR_TARGET
CC_FOR_BUILD
enable_static
enable_shared
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
CXXCPP
OTOOL64
OTOOL
@@ -805,6 +807,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
with_gcc_major_version_only
'
ac_precious_vars='build_alias
@@ -1455,6 +1458,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -6569,10 +6575,6 @@ fi
-enable_dlopen=yes
-
-
-
case `pwd` in
*\ * | *\ *)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
@@ -9181,7 +9183,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9229,6 +9231,8 @@ done
+ enable_dlopen=no
+
enable_win32_dll=no
@@ -10892,6 +10896,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10909,9 +10956,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12738,7 +12789,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12741 "configure"
+#line 12792 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12844,7 +12895,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12847 "configure"
+#line 12898 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13726,6 +13777,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13743,12 +13837,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -16122,6 +16224,21 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+enable_dlopen=yes
+
+
+
+
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
+
if test "${multilib}" = "yes"; then
@@ -20310,6 +20427,10 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${BUILD_PIMLIB_TRUE}" && test -z "${BUILD_PIMLIB_FALSE}"; then
as_fn_error $? "conditional \"BUILD_PIMLIB\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgm2/configure.ac b/libgm2/configure.ac
index 92e76c9346c..5701b95878b 100644
--- a/libgm2/configure.ac
+++ b/libgm2/configure.ac
@@ -212,8 +212,12 @@ AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
AC_PROG_MAKE_SET
AC_PROG_INSTALL
-AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
+LT_INIT
+AC_LIBTOOL_DLOPEN
+
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
diff --git a/libgm2/libm2cor/Makefile.am b/libgm2/libm2cor/Makefile.am
index 48de40c22dd..e50c7a2ef55 100644
--- a/libgm2/libm2cor/Makefile.am
+++ b/libgm2/libm2cor/Makefile.am
@@ -123,6 +123,10 @@ libm2cor_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2cor_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2cor_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
+
libm2cor_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2cor_la_link_flags)
BUILT_SOURCES = SYSTEM.def
CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2cor/Makefile.in b/libgm2/libm2cor/Makefile.in
index 3b0b40fea60..cc8a3fa73ed 100644
--- a/libgm2/libm2cor/Makefile.in
+++ b/libgm2/libm2cor/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@BUILD_CORLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2cor
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -468,8 +469,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_CORLIB_TRUE@ -fm2-pathname=m2iso -I$(GM2_SRC)/gm2-libs-iso \
@BUILD_CORLIB_TRUE@ -fm2-g -g -Wreturn-type -fcase -fm2-prefix=m2cor
-@BUILD_CORLIB_TRUE@@TARGET_DARWIN_FALSE@libm2cor_la_link_flags =
-@BUILD_CORLIB_TRUE@@TARGET_DARWIN_TRUE@libm2cor_la_link_flags = -Wl,-undefined,dynamic_lookup
+@BUILD_CORLIB_TRUE@@TARGET_DARWIN_FALSE@libm2cor_la_link_flags = \
+@BUILD_CORLIB_TRUE@@TARGET_DARWIN_FALSE@ $(am__append_1)
+@BUILD_CORLIB_TRUE@@TARGET_DARWIN_TRUE@libm2cor_la_link_flags = -Wl,-undefined,dynamic_lookup \
+@BUILD_CORLIB_TRUE@@TARGET_DARWIN_TRUE@ $(am__append_1)
@BUILD_CORLIB_TRUE@libm2cor_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2cor_la_link_flags)
@BUILD_CORLIB_TRUE@BUILT_SOURCES = SYSTEM.def
@BUILD_CORLIB_TRUE@CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2iso/Makefile.am b/libgm2/libm2iso/Makefile.am
index 1386f156cab..4d8e897266f 100644
--- a/libgm2/libm2iso/Makefile.am
+++ b/libgm2/libm2iso/Makefile.am
@@ -197,6 +197,10 @@ libm2iso_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2iso_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2iso_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
+
libm2iso_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2iso_la_link_flags)
CLEANFILES = SYSTEM.def
BUILT_SOURCES = SYSTEM.def
diff --git a/libgm2/libm2iso/Makefile.in b/libgm2/libm2iso/Makefile.in
index b939581b7c1..08563adfe78 100644
--- a/libgm2/libm2iso/Makefile.in
+++ b/libgm2/libm2iso/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@BUILD_ISOLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2iso
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -569,8 +570,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_ISOLIB_TRUE@ -fm2-pathname=m2pim -I$(GM2_SRC)/gm2-libs \
@BUILD_ISOLIB_TRUE@ -fiso -fextended-opaque -fm2-g -g -Wreturn-type -fcase -fm2-prefix=m2iso
-@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_FALSE@libm2iso_la_link_flags =
-@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_TRUE@libm2iso_la_link_flags = -Wl,-undefined,dynamic_lookup
+@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_FALSE@libm2iso_la_link_flags = \
+@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_FALSE@ $(am__append_1)
+@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_TRUE@libm2iso_la_link_flags = -Wl,-undefined,dynamic_lookup \
+@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_TRUE@ $(am__append_1)
@BUILD_ISOLIB_TRUE@libm2iso_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2iso_la_link_flags)
@BUILD_ISOLIB_TRUE@CLEANFILES = SYSTEM.def
@BUILD_ISOLIB_TRUE@BUILT_SOURCES = SYSTEM.def
diff --git a/libgm2/libm2log/Makefile.am b/libgm2/libm2log/Makefile.am
index a15747fd245..3b7609ee5c1 100644
--- a/libgm2/libm2log/Makefile.am
+++ b/libgm2/libm2log/Makefile.am
@@ -142,6 +142,9 @@ libm2log_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2log_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2log_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
libm2log_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2log_la_link_flags)
BUILT_SOURCES = ../libm2pim/SYSTEM.def
diff --git a/libgm2/libm2log/Makefile.in b/libgm2/libm2log/Makefile.in
index ba34a6b445a..fa12a386c55 100644
--- a/libgm2/libm2log/Makefile.in
+++ b/libgm2/libm2log/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@BUILD_LOGLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2log
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -477,8 +478,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_LOGLIB_TRUE@ -fm2-pathname=m2iso -I$(GM2_SRC)/gm2-libs-iso \
@BUILD_LOGLIB_TRUE@ -Wreturn-type -fcase -fm2-prefix=m2log
-@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_FALSE@libm2log_la_link_flags =
-@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_TRUE@libm2log_la_link_flags = -Wl,-undefined,dynamic_lookup
+@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_FALSE@libm2log_la_link_flags = \
+@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_FALSE@ $(am__append_1)
+@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_TRUE@libm2log_la_link_flags = -Wl,-undefined,dynamic_lookup \
+@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_TRUE@ $(am__append_1)
@BUILD_LOGLIB_TRUE@libm2log_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2log_la_link_flags)
@BUILD_LOGLIB_TRUE@BUILT_SOURCES = ../libm2pim/SYSTEM.def
@BUILD_LOGLIB_TRUE@M2LIBDIR = /m2/m2log/
diff --git a/libgm2/libm2min/Makefile.am b/libgm2/libm2min/Makefile.am
index 1ff160028f6..21411769505 100644
--- a/libgm2/libm2min/Makefile.am
+++ b/libgm2/libm2min/Makefile.am
@@ -113,6 +113,9 @@ libm2min_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2min_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2min_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
libm2min_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2min_la_link_flags)
BUILT_SOURCES = SYSTEM.def
CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2min/Makefile.in b/libgm2/libm2min/Makefile.in
index 9ead8397fd0..73af6568b88 100644
--- a/libgm2/libm2min/Makefile.in
+++ b/libgm2/libm2min/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2min
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -441,8 +442,10 @@ libm2min_la_M2FLAGS = \
-fm2-pathname=m2pim -I$(GM2_SRC)/gm2-libs -fno-exceptions \
-fno-m2-plugin -fno-scaffold-dynamic -fno-scaffold-main -fm2-prefix=m2min
-@TARGET_DARWIN_FALSE@libm2min_la_link_flags =
-@TARGET_DARWIN_TRUE@libm2min_la_link_flags = -Wl,-undefined,dynamic_lookup
+@TARGET_DARWIN_FALSE@libm2min_la_link_flags = $(am__append_1)
+@TARGET_DARWIN_TRUE@libm2min_la_link_flags = \
+@TARGET_DARWIN_TRUE@ -Wl,-undefined,dynamic_lookup \
+@TARGET_DARWIN_TRUE@ $(am__append_1)
libm2min_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2min_la_link_flags)
BUILT_SOURCES = SYSTEM.def
CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2pim/Makefile.am b/libgm2/libm2pim/Makefile.am
index ebfeba1ac1d..e777a60c077 100644
--- a/libgm2/libm2pim/Makefile.am
+++ b/libgm2/libm2pim/Makefile.am
@@ -175,6 +175,9 @@ libm2pim_la_link_flags = -Wl,-undefined,dynamic_lookup
else
libm2pim_la_link_flags =
endif
+if ENABLE_DARWIN_AT_RPATH
+libm2pim_la_link_flags += -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
libm2pim_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2pim_la_link_flags)
BUILT_SOURCES = SYSTEM.def
CLEANFILES = SYSTEM.def
diff --git a/libgm2/libm2pim/Makefile.in b/libgm2/libm2pim/Makefile.in
index 660488f9692..54414058bc5 100644
--- a/libgm2/libm2pim/Makefile.in
+++ b/libgm2/libm2pim/Makefile.in
@@ -105,17 +105,18 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@BUILD_PIMLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2pim
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
- $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/override.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am
@@ -538,8 +539,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_PIMLIB_TRUE@ -fm2-pathname=m2iso -I$(GM2_SRC)/gm2-libs-iso \
@BUILD_PIMLIB_TRUE@ -fm2-g -g -Wreturn-type -fcase -fm2-prefix=m2pim
-@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_FALSE@libm2pim_la_link_flags =
-@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_TRUE@libm2pim_la_link_flags = -Wl,-undefined,dynamic_lookup
+@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_FALSE@libm2pim_la_link_flags = \
+@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_FALSE@ $(am__append_1)
+@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_TRUE@libm2pim_la_link_flags = -Wl,-undefined,dynamic_lookup \
+@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_TRUE@ $(am__append_1)
@BUILD_PIMLIB_TRUE@libm2pim_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2pim_la_link_flags)
@BUILD_PIMLIB_TRUE@BUILT_SOURCES = SYSTEM.def
@BUILD_PIMLIB_TRUE@CLEANFILES = SYSTEM.def
diff --git a/libgo/configure b/libgo/configure
index a607dbff68e..72d46c3eec3 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -708,6 +708,8 @@ glibgo_toolexecdir
WERROR
WARN_FLAGS
CC_FOR_BUILD
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
CPP
@@ -11544,7 +11546,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11547 "configure"
+#line 11549 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11650,7 +11652,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11653 "configure"
+#line 11655 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13779,6 +13781,14 @@ CC="$lt_save_CC"
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
CC_FOR_BUILD=${CC_FOR_BUILD:-gcc}
@@ -16386,6 +16396,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${USE_LIBFFI_TRUE}" && test -z "${USE_LIBFFI_FALSE}"; then
as_fn_error $? "conditional \"USE_LIBFFI\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgo/configure.ac b/libgo/configure.ac
index a59aa091d1d..6f1ac32660b 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -53,6 +53,7 @@ AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
CC_FOR_BUILD=${CC_FOR_BUILD:-gcc}
AC_SUBST(CC_FOR_BUILD)
diff --git a/libgomp/Makefile.am b/libgomp/Makefile.am
index 428f7a9dab5..ceb8c910abd 100644
--- a/libgomp/Makefile.am
+++ b/libgomp/Makefile.am
@@ -53,9 +53,14 @@ else
libgomp_version_script =
libgomp_version_dep =
endif
+
libgomp_version_info = -version-info $(libtool_VERSION)
+if ENABLE_DARWIN_AT_RPATH
+libgomp_darwin_rpath = -Wc,-nodefaultrpaths
+libgomp_darwin_rpath += -Wl,-rpath,@loader_path
+endif
libgomp_la_LDFLAGS = $(libgomp_version_info) $(libgomp_version_script) \
- $(lt_host_flags)
+ $(lt_host_flags) $(libgomp_darwin_rpath)
libgomp_la_LIBADD =
libgomp_la_DEPENDENCIES = $(libgomp_version_dep)
libgomp_la_LINK = $(LINK) $(libgomp_la_LDFLAGS)
diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
index 3ef05e6a3cb..2467250215e 100644
--- a/libgomp/Makefile.in
+++ b/libgomp/Makefile.in
@@ -535,8 +535,11 @@ nodist_toolexeclib_HEADERS = libgomp.spec
@LIBGOMP_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgomp_version_dep = libgomp.ver
@LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgomp_version_dep = libgomp.ver-sun
libgomp_version_info = -version-info $(libtool_VERSION)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libgomp_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
libgomp_la_LDFLAGS = $(libgomp_version_info) $(libgomp_version_script) \
- $(lt_host_flags)
+ $(lt_host_flags) $(libgomp_darwin_rpath)
libgomp_la_LIBADD = $(DL_LIBS)
libgomp_la_DEPENDENCIES = $(libgomp_version_dep)
diff --git a/libgomp/configure b/libgomp/configure
index a12b30f1b0f..7c103cf37f1 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -683,6 +683,8 @@ CXX
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -822,6 +824,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
enable_linux_futex
enable_tls
@@ -1477,6 +1480,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -7618,7 +7624,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9591,6 +9597,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9608,9 +9657,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11416,7 +11469,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11419 "configure"
+#line 11472 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11522,7 +11575,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11525 "configure"
+#line 11578 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11783,6 +11836,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
@@ -13469,6 +13530,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_FC=no
hardcode_direct_FC=no
hardcode_automatic_FC=yes
@@ -13486,9 +13590,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_FC="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_FC="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -17130,6 +17238,10 @@ if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then
as_fn_error $? "conditional \"BUILD_INFO\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index 1aad83a79da..8c941cddd2f 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -148,6 +148,7 @@ AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
AM_MAINTAINER_MODE
diff --git a/libitm/Makefile.am b/libitm/Makefile.am
index 3f31ad30556..a25317b07fe 100644
--- a/libitm/Makefile.am
+++ b/libitm/Makefile.am
@@ -54,7 +54,12 @@ libitm_version_info = -version-info $(libtool_VERSION)
# want or need libstdc++.
libitm_la_DEPENDENCIES = $(libitm_version_dep)
libitm_la_LINK = $(LINK) $(libitm_la_LDFLAGS)
-libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script)
+if ENABLE_DARWIN_AT_RPATH
+libitm_darwin_rpath = -Wc,-nodefaultrpaths
+libitm_darwin_rpath += -Wl,-rpath,@loader_path
+endif
+libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script) \
+ $(libitm_darwin_rpath)
libitm_la_SOURCES = \
aatree.cc alloc.cc alloc_c.cc alloc_cpp.cc barrier.cc beginend.cc \
diff --git a/libitm/Makefile.in b/libitm/Makefile.in
index 7c51fe02511..9f0691018a9 100644
--- a/libitm/Makefile.in
+++ b/libitm/Makefile.in
@@ -480,7 +480,12 @@ libitm_version_info = -version-info $(libtool_VERSION)
# want or need libstdc++.
libitm_la_DEPENDENCIES = $(libitm_version_dep)
libitm_la_LINK = $(LINK) $(libitm_la_LDFLAGS)
-libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libitm_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script) \
+ $(libitm_darwin_rpath)
+
libitm_la_SOURCES = aatree.cc alloc.cc alloc_c.cc alloc_cpp.cc \
barrier.cc beginend.cc clone.cc eh_cpp.cc local.cc query.cc \
retry.cc rwlock.cc useraction.cc util.cc sjlj.S tls.cc \
diff --git a/libitm/configure b/libitm/configure
index 02e8de7896b..9ba7fb03a57 100755
--- a/libitm/configure
+++ b/libitm/configure
@@ -660,6 +660,8 @@ libtool_VERSION
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
CXXCPP
@@ -809,6 +811,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
enable_linux_futex
enable_tls
@@ -1461,6 +1464,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -8279,7 +8285,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10253,6 +10259,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10270,9 +10319,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12078,7 +12131,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12081 "configure"
+#line 12134 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12184,7 +12237,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12187 "configure"
+#line 12240 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13060,6 +13113,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13077,12 +13173,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15454,6 +15558,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
@@ -18212,6 +18324,10 @@ if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then
as_fn_error $? "conditional \"BUILD_INFO\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libitm/configure.ac b/libitm/configure.ac
index 892a24caa85..dded4d387be 100644
--- a/libitm/configure.ac
+++ b/libitm/configure.ac
@@ -156,6 +156,7 @@ AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes")
AM_PROG_LIBTOOL
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
AM_MAINTAINER_MODE
diff --git a/libobjc/configure b/libobjc/configure
index 752f6fdfebd..68172549137 100755
--- a/libobjc/configure
+++ b/libobjc/configure
@@ -636,6 +636,9 @@ OBJC_BOEHM_GC_LIBS
OBJC_BOEHM_GC_INCLUDES
OBJC_BOEHM_GC
OBJC_GCFLAGS
+extra_ldflags_libobjc
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
SET_MAKE
CPP
OTOOL64
@@ -667,7 +670,6 @@ RANLIB
AR
AS
XCFLAGS
-extra_ldflags_libobjc
lt_host_flags
OBJEXT
EXEEXT
@@ -755,6 +757,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_tls
enable_objc_gc
with_target_bdw_gc
@@ -1392,6 +1395,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-tls Use thread-local storage [default=yes]
--enable-objc-gc enable use of Boehm's garbage collector with the GNU
Objective-C runtime
@@ -3431,17 +3437,6 @@ esac
-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
-
# Add CET specific flags if CET is enabled
@@ -7011,7 +7006,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -8988,6 +8983,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9005,9 +9043,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -10834,7 +10876,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10837 "configure"
+#line 10879 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10940,7 +10982,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10943 "configure"
+#line 10985 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11212,6 +11254,38 @@ $as_echo "no" >&6; }
fi
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
+# 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
+
+
# -------
# Headers
# -------
@@ -11953,6 +12027,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/libobjc/configure.ac b/libobjc/configure.ac
index 9bd7d59d597..cb21ebbfcc7 100644
--- a/libobjc/configure.ac
+++ b/libobjc/configure.ac
@@ -148,17 +148,6 @@ m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
# 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)
@@ -183,6 +172,31 @@ AM_PROG_CC_C_O
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
# -------
diff --git a/libphobos/configure b/libphobos/configure
index b7276d95010..25b13bdd93e 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -707,6 +707,8 @@ get_gcc_base_ver
phobos_compiler_shared_flag
phobos_compiler_pic_flag
phobos_lt_pic_flag
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
OTOOL64
@@ -838,6 +840,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
with_gcc_major_version_only
enable_werror
with_libatomic
@@ -1490,6 +1493,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-werror turns on -Werror [default=no]
--enable-version-specific-runtime-libs
Specify that runtime libraries should be installed
@@ -8282,7 +8288,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9987,6 +9993,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10004,9 +10053,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11812,7 +11865,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11815 "configure"
+#line 11868 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11918,7 +11971,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11921 "configure"
+#line 11974 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13443,6 +13496,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_D=no
hardcode_direct_D=no
hardcode_automatic_D=yes
@@ -13460,9 +13556,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_D="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_D="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_D="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_D="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_D="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_D="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -14064,6 +14164,14 @@ CFLAGS=$lt_save_CFLAGS
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
# libtool variables for Phobos shared and position-independent compiles.
#
@@ -15877,6 +15985,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${DRUNTIME_CPU_AARCH64_TRUE}" && test -z "${DRUNTIME_CPU_AARCH64_FALSE}"; then
as_fn_error $? "conditional \"DRUNTIME_CPU_AARCH64\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libphobos/configure.ac b/libphobos/configure.ac
index 3b2e6df5d5c..bb669675ce0 100644
--- a/libphobos/configure.ac
+++ b/libphobos/configure.ac
@@ -93,6 +93,7 @@ AM_PROG_LIBTOOL
WITH_LOCAL_DRUNTIME([LT_LANG([D])], [])
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
# libtool variables for Phobos shared and position-independent compiles.
#
diff --git a/libphobos/libdruntime/Makefile.am b/libphobos/libdruntime/Makefile.am
index 832a0524ab3..b78bcdd203f 100644
--- a/libphobos/libdruntime/Makefile.am
+++ b/libphobos/libdruntime/Makefile.am
@@ -128,8 +128,11 @@ ALL_DRUNTIME_SOURCES = $(DRUNTIME_DSOURCES) $(DRUNTIME_CSOURCES) \
toolexeclib_LTLIBRARIES = libgdruntime.la
libgdruntime_la_SOURCES = $(ALL_DRUNTIME_SOURCES)
libgdruntime_la_LIBTOOLFLAGS =
+if ENABLE_DARWIN_AT_RPATH
+libgdruntime_darwin_rpath = -Wl,-rpath,@loader_path
+endif
libgdruntime_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../src,-Bgcc \
- -version-info $(libtool_VERSION)
+ -version-info $(libtool_VERSION) $(libgdruntime_darwin_rpath)
libgdruntime_la_LIBADD = $(LIBATOMIC) $(LIBBACKTRACE)
libgdruntime_la_DEPENDENCIES = $(DRTSTUFF)
# Also override library link commands: This is not strictly
diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in
index 61a2a770888..4d62985349b 100644
--- a/libphobos/libdruntime/Makefile.in
+++ b/libphobos/libdruntime/Makefile.in
@@ -813,8 +813,9 @@ ALL_DRUNTIME_SOURCES = $(DRUNTIME_DSOURCES) $(DRUNTIME_CSOURCES) \
toolexeclib_LTLIBRARIES = libgdruntime.la
libgdruntime_la_SOURCES = $(ALL_DRUNTIME_SOURCES)
libgdruntime_la_LIBTOOLFLAGS =
+@ENABLE_DARWIN_AT_RPATH_TRUE@libgdruntime_darwin_rpath = -Wl,-rpath,@loader_path
libgdruntime_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../src,-Bgcc \
- -version-info $(libtool_VERSION)
+ -version-info $(libtool_VERSION) $(libgdruntime_darwin_rpath)
libgdruntime_la_LIBADD = $(LIBATOMIC) $(LIBBACKTRACE)
libgdruntime_la_DEPENDENCIES = $(DRTSTUFF)
diff --git a/libphobos/src/Makefile.am b/libphobos/src/Makefile.am
index 6474fca5eb5..f6521ed5860 100644
--- a/libphobos/src/Makefile.am
+++ b/libphobos/src/Makefile.am
@@ -44,8 +44,11 @@ toolexeclib_DATA = libgphobos.spec
toolexeclib_LTLIBRARIES = libgphobos.la
libgphobos_la_SOURCES = $(ALL_PHOBOS_SOURCES)
libgphobos_la_LIBTOOLFLAGS =
+if ENABLE_DARWIN_AT_RPATH
+libgphobos_darwin_rpath = -Wl,-rpath,@loader_path
+endif
libgphobos_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../libdruntime/gcc \
- -version-info $(libtool_VERSION)
+ -version-info $(libtool_VERSION) $(libgphobos_darwin_rpath)
if ENABLE_LIBDRUNTIME_ONLY
libgphobos_la_LIBADD = ../libdruntime/libgdruntime_convenience.la
else
diff --git a/libphobos/src/Makefile.in b/libphobos/src/Makefile.in
index a6229587e7b..cc3358b437e 100644
--- a/libphobos/src/Makefile.in
+++ b/libphobos/src/Makefile.in
@@ -529,8 +529,9 @@ toolexeclib_DATA = libgphobos.spec
toolexeclib_LTLIBRARIES = libgphobos.la
libgphobos_la_SOURCES = $(ALL_PHOBOS_SOURCES)
libgphobos_la_LIBTOOLFLAGS =
+@ENABLE_DARWIN_AT_RPATH_TRUE@libgphobos_darwin_rpath = -Wl,-rpath,@loader_path
libgphobos_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../libdruntime/gcc \
- -version-info $(libtool_VERSION)
+ -version-info $(libtool_VERSION) $(libgphobos_darwin_rpath)
@ENABLE_LIBDRUNTIME_ONLY_FALSE@libgphobos_la_LIBADD = \
@ENABLE_LIBDRUNTIME_ONLY_FALSE@ ../libdruntime/libgdruntime_convenience.la $(LIBZ)
diff --git a/libquadmath/Makefile.am b/libquadmath/Makefile.am
index 35dffb46f6e..0d02c95e738 100644
--- a/libquadmath/Makefile.am
+++ b/libquadmath/Makefile.am
@@ -36,8 +36,13 @@ endif
toolexeclib_LTLIBRARIES = libquadmath.la
libquadmath_la_LIBADD =
+
+if ENABLE_DARWIN_AT_RPATH
+libquadmath_darwin_rpath = -Wc,-nodefaultrpaths
+libquadmath_darwin_rpath += -Wl,-rpath,@loader_path
+endif
libquadmath_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
- $(version_arg) $(lt_host_flags) -lm
+ $(version_arg) $(lt_host_flags) $(LIBM) $(libquadmath_darwin_rpath)
libquadmath_la_DEPENDENCIES = $(version_dep) $(libquadmath_la_LIBADD)
nodist_libsubinclude_HEADERS = quadmath.h quadmath_weak.h
diff --git a/libquadmath/Makefile.in b/libquadmath/Makefile.in
index 8c011212258..068af559457 100644
--- a/libquadmath/Makefile.in
+++ b/libquadmath/Makefile.in
@@ -355,6 +355,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
+LIBM = @LIBM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
@@ -463,8 +464,10 @@ AUTOMAKE_OPTIONS = foreign info-in-builddir
@BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_SUN_TRUE@@LIBQUAD_USE_SYMVER_TRUE@version_dep = quadmath.map-sun
@BUILD_LIBQUADMATH_TRUE@toolexeclib_LTLIBRARIES = libquadmath.la
@BUILD_LIBQUADMATH_TRUE@libquadmath_la_LIBADD =
+@BUILD_LIBQUADMATH_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@libquadmath_darwin_rpath = -Wc,-nodefaultrpaths \
+@BUILD_LIBQUADMATH_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
@BUILD_LIBQUADMATH_TRUE@libquadmath_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
-@BUILD_LIBQUADMATH_TRUE@ $(version_arg) $(lt_host_flags) -lm
+@BUILD_LIBQUADMATH_TRUE@ $(version_arg) $(lt_host_flags) $(LIBM) $(libquadmath_darwin_rpath)
@BUILD_LIBQUADMATH_TRUE@libquadmath_la_DEPENDENCIES = $(version_dep) $(libquadmath_la_LIBADD)
@BUILD_LIBQUADMATH_TRUE@nodist_libsubinclude_HEADERS = quadmath.h quadmath_weak.h
diff --git a/libquadmath/configure b/libquadmath/configure
index 0b145a644c3..5bd9a070fdc 100755
--- a/libquadmath/configure
+++ b/libquadmath/configure
@@ -644,11 +644,14 @@ LIBQUAD_USE_SYMVER_GNU_FALSE
LIBQUAD_USE_SYMVER_GNU_TRUE
LIBQUAD_USE_SYMVER_FALSE
LIBQUAD_USE_SYMVER_TRUE
+LIBM
toolexeclibdir
toolexecdir
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -785,6 +788,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_maintainer_mode
with_toolexeclibdir
enable_symvers
@@ -1435,6 +1439,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
@@ -7310,7 +7317,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9022,6 +9029,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9039,9 +9089,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -10868,7 +10922,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10871 "configure"
+#line 10925 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10974,7 +11028,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10977 "configure"
+#line 11031 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11235,6 +11289,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
@@ -12199,6 +12261,148 @@ esac
+LIBM=
+case $host in
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+ # These system don't have libm, or don't need it
+ ;;
+*-ncr-sysv4.3*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mwvalidcheckl in -lmw" >&5
+$as_echo_n "checking for _mwvalidcheckl in -lmw... " >&6; }
+if ${ac_cv_lib_mw__mwvalidcheckl+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lmw $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char _mwvalidcheckl ();
+int
+main ()
+{
+return _mwvalidcheckl ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_mw__mwvalidcheckl=yes
+else
+ ac_cv_lib_mw__mwvalidcheckl=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mw__mwvalidcheckl" >&5
+$as_echo "$ac_cv_lib_mw__mwvalidcheckl" >&6; }
+if test "x$ac_cv_lib_mw__mwvalidcheckl" = xyes; then :
+ LIBM="-lmw"
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
+$as_echo_n "checking for cos in -lm... " >&6; }
+if ${ac_cv_lib_m_cos+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char cos ();
+int
+main ()
+{
+return cos ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_cos=yes
+else
+ ac_cv_lib_m_cos=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
+$as_echo "$ac_cv_lib_m_cos" >&6; }
+if test "x$ac_cv_lib_m_cos" = xyes; then :
+ LIBM="$LIBM -lm"
+fi
+
+ ;;
+*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
+$as_echo_n "checking for cos in -lm... " >&6; }
+if ${ac_cv_lib_m_cos+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char cos ();
+int
+main ()
+{
+return cos ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_cos=yes
+else
+ ac_cv_lib_m_cos=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
+$as_echo "$ac_cv_lib_m_cos" >&6; }
+if test "x$ac_cv_lib_m_cos" = xyes; then :
+ LIBM="-lm"
+fi
+
+ ;;
+esac
+
+
+
for ac_header in fenv.h langinfo.h locale.h wchar.h wctype.h limits.h ctype.h printf.h errno.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
@@ -13459,6 +13663,10 @@ if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then
as_fn_error $? "conditional \"BUILD_INFO\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libquadmath/configure.ac b/libquadmath/configure.ac
index eec4084a45f..94a3f2179e9 100644
--- a/libquadmath/configure.ac
+++ b/libquadmath/configure.ac
@@ -59,6 +59,7 @@ AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
AM_MAINTAINER_MODE
@@ -121,6 +122,8 @@ esac
AC_SUBST(toolexecdir)
AC_SUBST(toolexeclibdir)
+AC_CHECK_LIBM
+
AC_CHECK_HEADERS(fenv.h langinfo.h locale.h wchar.h wctype.h limits.h ctype.h printf.h errno.h)
LIBQUAD_CHECK_MATH_H_SIGNGAM
diff --git a/libsanitizer/asan/Makefile.am b/libsanitizer/asan/Makefile.am
index 4f802f723d6..223d3e07816 100644
--- a/libsanitizer/asan/Makefile.am
+++ b/libsanitizer/asan/Makefile.am
@@ -60,7 +60,12 @@ libasan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
libasan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libasan)
+if ENABLE_DARWIN_AT_RPATH
+libasan_darwin_rpath = -Wc,-nodefaultrpaths
+libasan_darwin_rpath += -Wl,-rpath,@loader_path
+endif
+libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libasan) $(libasan_darwin_rpath)
libasan_preinit.o: asan_preinit.o
cp $< $@
diff --git a/libsanitizer/asan/Makefile.in b/libsanitizer/asan/Makefile.in
index 7833a9a4c3f..e88e5e0b0a7 100644
--- a/libsanitizer/asan/Makefile.in
+++ b/libsanitizer/asan/Makefile.in
@@ -465,7 +465,12 @@ libasan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(top_builddir)/lsan/libsanitizer_lsan.la $(am__append_2) \
$(am__append_3) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libasan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libasan_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libasan) $(libasan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
diff --git a/libsanitizer/configure b/libsanitizer/configure
index 0805d254fe5..2edd5c37ce7 100755
--- a/libsanitizer/configure
+++ b/libsanitizer/configure
@@ -666,6 +666,8 @@ LSAN_SUPPORTED_FALSE
LSAN_SUPPORTED_TRUE
TSAN_SUPPORTED_FALSE
TSAN_SUPPORTED_TRUE
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
CXXCPP
@@ -817,6 +819,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_werror
with_gcc_major_version_only
enable_cet
@@ -1471,6 +1474,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--disable-werror disable building with -Werror
--enable-cet enable Intel CET in target libraries [default=auto]
@@ -8891,7 +8897,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10596,6 +10602,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10613,9 +10662,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12421,7 +12474,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12424 "configure"
+#line 12477 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12527,7 +12580,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12530 "configure"
+#line 12583 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13403,6 +13456,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13420,12 +13516,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15845,6 +15949,15 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
@@ -17243,6 +17356,10 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${TSAN_SUPPORTED_TRUE}" && test -z "${TSAN_SUPPORTED_FALSE}"; then
as_fn_error $? "conditional \"TSAN_SUPPORTED\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libsanitizer/configure.ac b/libsanitizer/configure.ac
index 04cd8910ed6..5906c8d4887 100644
--- a/libsanitizer/configure.ac
+++ b/libsanitizer/configure.ac
@@ -85,6 +85,8 @@ esac
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
AC_CHECK_SIZEOF([void *])
if test "${multilib}" = "yes"; then
diff --git a/libsanitizer/hwasan/Makefile.am b/libsanitizer/hwasan/Makefile.am
index bb7f8fa0b7b..653fc8c4720 100644
--- a/libsanitizer/hwasan/Makefile.am
+++ b/libsanitizer/hwasan/Makefile.am
@@ -47,7 +47,11 @@ libhwasan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
libhwasan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libhwasan)
+if ENABLE_DARWIN_AT_RPATH
+libhwasan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
+libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libhwasan) $(libhwasan_darwin_rpath)
libhwasan_preinit.o: hwasan_preinit.o
cp $< $@
diff --git a/libsanitizer/hwasan/Makefile.in b/libsanitizer/hwasan/Makefile.in
index 58bc26b44b9..87971fd3374 100644
--- a/libsanitizer/hwasan/Makefile.in
+++ b/libsanitizer/hwasan/Makefile.in
@@ -447,7 +447,10 @@ libhwasan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(top_builddir)/lsan/libsanitizer_lsan.la $(am__append_1) \
$(am__append_2) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libhwasan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libhwasan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/
+libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libhwasan) $(libhwasan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
diff --git a/libsanitizer/lsan/Makefile.am b/libsanitizer/lsan/Makefile.am
index 6ff28ff5eea..7701b0e18cf 100644
--- a/libsanitizer/lsan/Makefile.am
+++ b/libsanitizer/lsan/Makefile.am
@@ -41,8 +41,12 @@ if LIBBACKTRACE_SUPPORTED
liblsan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
liblsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_liblsan)
-
+if ENABLE_DARWIN_AT_RPATH
+liblsan_darwin_rpath = -Wc,-nodefaultrpaths
+liblsan_darwin_rpath += -Wl,-rpath,@loader_path
+endif
+liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_liblsan) $(liblsan_darwin_rpath)
liblsan_preinit.o: lsan_preinit.o
cp $< $@
diff --git a/libsanitizer/lsan/Makefile.in b/libsanitizer/lsan/Makefile.in
index d8fd4ee9557..078edf01fda 100644
--- a/libsanitizer/lsan/Makefile.in
+++ b/libsanitizer/lsan/Makefile.in
@@ -413,7 +413,12 @@ liblsan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(top_builddir)/interception/libinterception.la \
$(am__append_1) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_liblsan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@liblsan_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_liblsan) $(liblsan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
@@ -788,7 +793,6 @@ uninstall-am: uninstall-nodist_toolexeclibHEADERS \
.PRECIOUS: Makefile
-
liblsan_preinit.o: lsan_preinit.o
cp $< $@
diff --git a/libsanitizer/tsan/Makefile.am b/libsanitizer/tsan/Makefile.am
index da80743da9d..01290b0313d 100644
--- a/libsanitizer/tsan/Makefile.am
+++ b/libsanitizer/tsan/Makefile.am
@@ -57,7 +57,11 @@ libtsan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
libtsan_la_DEPENDENCIES +=$(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
libtsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libtsan)
+if ENABLE_DARWIN_AT_RPATH
+libtsan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/
+endif
+libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libtsan) $(libtsan_darwin_rpath)
libtsan_preinit.o: tsan_preinit.o
cp $< $@
diff --git a/libsanitizer/tsan/Makefile.in b/libsanitizer/tsan/Makefile.in
index 36498832bb8..95011584bcb 100644
--- a/libsanitizer/tsan/Makefile.in
+++ b/libsanitizer/tsan/Makefile.in
@@ -464,7 +464,10 @@ libtsan_la_DEPENDENCIES = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(top_builddir)/interception/libinterception.la \
$(TSAN_TARGET_DEPENDENT_OBJECTS) $(am__append_2)
-libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libtsan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libtsan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/
+libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libtsan) $(libtsan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
diff --git a/libsanitizer/ubsan/Makefile.am b/libsanitizer/ubsan/Makefile.am
index d480f26adc0..7769b3437e4 100644
--- a/libsanitizer/ubsan/Makefile.am
+++ b/libsanitizer/ubsan/Makefile.am
@@ -36,7 +36,12 @@ if LIBBACKTRACE_SUPPORTED
libubsan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
endif
libubsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libubsan)
+if ENABLE_DARWIN_AT_RPATH
+libubsan_darwin_rpath = -Wc,-nodefaultrpaths
+libubsan_darwin_rpath += -Wl,-rpath,@loader_path
+endif
+libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libubsan) $(libubsan_darwin_rpath)
# Use special rules for files that require RTTI support.
ubsan_handlers_cxx.% ubsan_type_hash.% ubsan_type_hash_itanium.% : AM_CXXFLAGS += -frtti
diff --git a/libsanitizer/ubsan/Makefile.in b/libsanitizer/ubsan/Makefile.in
index 92a8e387fd7..7e51480e970 100644
--- a/libsanitizer/ubsan/Makefile.in
+++ b/libsanitizer/ubsan/Makefile.in
@@ -400,7 +400,12 @@ libubsan_la_SOURCES = $(ubsan_files)
libubsan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(am__append_1) $(am__append_2) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
-libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libubsan)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libubsan_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
+libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(link_libubsan) $(libubsan_darwin_rpath)
+
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
diff --git a/libssp/Makefile.am b/libssp/Makefile.am
index 1636e43b369..f7ed2aa6043 100644
--- a/libssp/Makefile.am
+++ b/libssp/Makefile.am
@@ -49,8 +49,12 @@ libssp_la_SOURCES = \
vsnprintf-chk.c vsprintf-chk.c
libssp_la_LIBADD =
libssp_la_DEPENDENCIES = $(version_dep) $(libssp_la_LIBADD)
+if ENABLE_DARWIN_AT_RPATH
+libssp_darwin_rpath = -Wc,-nodefaultrpaths
+libssp_darwin_rpath += -Wl,-rpath,@loader_path
+endif
libssp_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
- $(version_arg) $(lt_host_flags)
+ $(version_arg) $(lt_host_flags) $(libssp_darwin_rpath)
libssp_nonshared_la_SOURCES = \
ssp-local.c
diff --git a/libssp/Makefile.in b/libssp/Makefile.in
index bc8a0dc2b28..1cf86361b96 100644
--- a/libssp/Makefile.in
+++ b/libssp/Makefile.in
@@ -376,8 +376,11 @@ libssp_la_SOURCES = \
libssp_la_LIBADD =
libssp_la_DEPENDENCIES = $(version_dep) $(libssp_la_LIBADD)
+@ENABLE_DARWIN_AT_RPATH_TRUE@libssp_darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
libssp_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
- $(version_arg) $(lt_host_flags)
+ $(version_arg) $(lt_host_flags) $(libssp_darwin_rpath)
libssp_nonshared_la_SOURCES = \
ssp-local.c
diff --git a/libssp/configure b/libssp/configure
index 7f8b8fdf99d..a31b69f306e 100755
--- a/libssp/configure
+++ b/libssp/configure
@@ -636,6 +636,8 @@ LIBOBJS
get_gcc_base_ver
toolexeclibdir
toolexecdir
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -781,6 +783,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
with_toolexeclibdir
with_gcc_major_version_only
'
@@ -1426,6 +1429,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -7496,7 +7502,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -9208,6 +9214,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -9225,9 +9274,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -11054,7 +11107,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11057 "configure"
+#line 11110 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11160,7 +11213,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11163 "configure"
+#line 11216 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11438,6 +11491,15 @@ fi
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
+
# Calculate toolexeclibdir
# Also toolexecdir, though it's only used in toolexeclibdir
case ${version_specific_libs} in
@@ -11647,6 +11709,10 @@ if test -z "${LIBSSP_USE_SYMVER_SUN_TRUE}" && test -z "${LIBSSP_USE_SYMVER_SUN_F
as_fn_error $? "conditional \"LIBSSP_USE_SYMVER_SUN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/libssp/configure.ac b/libssp/configure.ac
index f30f81c54f6..90778e2355d 100644
--- a/libssp/configure.ac
+++ b/libssp/configure.ac
@@ -165,6 +165,8 @@ AC_SUBST(enable_static)
GCC_WITH_TOOLEXECLIBDIR
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+
# Calculate toolexeclibdir
# Also toolexecdir, though it's only used in toolexeclibdir
case ${version_specific_libs} in
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index c4da56c3042..b2b121a0936 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -789,6 +789,8 @@ GLIBCXX_HOSTED_TRUE
glibcxx_compiler_shared_flag
glibcxx_compiler_pic_flag
glibcxx_lt_pic_flag
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -924,6 +926,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_hosted_libstdcxx
enable_libstdcxx_hosted
enable_libstdcxx_verbose
@@ -1615,6 +1618,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--disable-hosted-libstdcxx
only build freestanding C++ runtime support
--disable-libstdcxx-hosted
@@ -8539,7 +8545,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10379,6 +10385,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10396,9 +10445,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12225,7 +12278,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12228 "configure"
+#line 12281 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12331,7 +12384,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12334 "configure"
+#line 12387 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13213,6 +13266,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13230,12 +13326,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15632,6 +15736,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
if test "$enable_vtable_verify" = yes; then
predep_objects_CXX="${predep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_start.o"
@@ -16055,7 +16167,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; }
# Fake what AC_TRY_COMPILE does.
cat > conftest.$ac_ext << EOF
-#line 16058 "configure"
+#line 16170 "configure"
int main()
{
typedef bool atomic_type;
@@ -16090,7 +16202,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16093 "configure"
+#line 16205 "configure"
int main()
{
typedef short atomic_type;
@@ -16125,7 +16237,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16128 "configure"
+#line 16240 "configure"
int main()
{
// NB: _Atomic_word not necessarily int.
@@ -16161,7 +16273,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16164 "configure"
+#line 16276 "configure"
int main()
{
typedef long long atomic_type;
@@ -16317,7 +16429,7 @@ $as_echo "mutex" >&6; }
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 16320 "configure"
+#line 16432 "configure"
int main()
{
_Decimal32 d1;
@@ -16359,7 +16471,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 16362 "configure"
+#line 16474 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
@@ -74906,6 +75018,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${GLIBCXX_HOSTED_TRUE}" && test -z "${GLIBCXX_HOSTED_FALSE}"; then
as_fn_error $? "conditional \"GLIBCXX_HOSTED\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index fc0f2522027..80e573e690f 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -108,6 +108,7 @@ AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
if test "$enable_vtable_verify" = yes; then
predep_objects_CXX="${predep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_start.o"
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index 5b9af41cdb9..925137c2ccc 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -152,8 +152,13 @@ libstdc___la_DEPENDENCIES = \
$(top_builddir)/src/c++17/libc++17convenience.la \
$(top_builddir)/src/c++20/libc++20convenience.la
+if ENABLE_DARWIN_AT_RPATH
+libstdc___darwin_rpath = -Wc,-nodefaultrpaths
+libstdc___darwin_rpath += -Wl,-rpath,@loader_path
+endif
+
libstdc___la_LDFLAGS = \
- -version-info $(libtool_VERSION) ${version_arg} -lm
+ -version-info $(libtool_VERSION) ${version_arg} -lm $(libstdc___darwin_rpath)
libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) $(lt_host_flags)
diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
index f42d957af36..0ce75f30708 100644
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -560,8 +560,11 @@ libstdc___la_DEPENDENCIES = \
$(top_builddir)/src/c++17/libc++17convenience.la \
$(top_builddir)/src/c++20/libc++20convenience.la
+@ENABLE_DARWIN_AT_RPATH_TRUE@libstdc___darwin_rpath = \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
+@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
libstdc___la_LDFLAGS = \
- -version-info $(libtool_VERSION) ${version_arg} -lm
+ -version-info $(libtool_VERSION) ${version_arg} -lm $(libstdc___darwin_rpath)
libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) $(lt_host_flags)
@GLIBCXX_LDBL_ALT128_COMPAT_FALSE@@GLIBCXX_LDBL_COMPAT_TRUE@LTCXXCOMPILE64 = $(LTCXXCOMPILE)
diff --git a/libtool.m4 b/libtool.m4
index e36fdd3c0e2..7f8ae26db62 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -1005,7 +1005,7 @@ _LT_EOF
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[[89]]*|UNSET,*-darwin[[12]][[0123456789]]*)
+ UNSET,*-darwin[[89]]*|UNSET,*-darwin[[12]][[0-9]]*)
;;
10.[[012]][[,.]]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -1039,6 +1039,45 @@ _LT_EOF
m4_defun([_LT_DARWIN_LINKER_FEATURES],
[
m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ AC_ARG_ENABLE([darwin-at-rpath],
+ AS_HELP_STRING([--enable-darwin-at-rpath],
+ [install libraries with @rpath/library-name, requires rpaths to be added to executables]),
+ [if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[[4-8]]*|UNSET,rhapsody*|10.[[0-4]][[,.]]*)
+ AC_MSG_WARN([Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)])
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi],
+ [case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[[4-8]]*|UNSET,rhapsody*|10.[[0-4]][[,.]]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[[5-9]]*|UNSET,darwin2*|10.1[[1-9]][[,.]]*|1[[1-9]].*[[,.]]* )
+ AC_MSG_NOTICE([@rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)])
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+ ])
+
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_automatic, $1)=yes
@@ -1056,13 +1095,21 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
_LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
_LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
m4_if([$1], [CXX],
[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
_LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
],[])
@@ -4265,6 +4312,7 @@ _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
[Compiler flag to prevent dynamic linking])
])# _LT_COMPILER_PIC
+_LT_TAGVAR(enable_darwin_at_rpath, $1)=no
# _LT_LINKER_SHLIBS([TAGNAME])
# ----------------------------
@@ -6504,7 +6552,6 @@ fi # test "$_lt_caught_CXX_error" != yes
AC_LANG_POP
])# _LT_LANG_CXX_CONFIG
-
# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
# ---------------------------------
# Figure out "hidden" library dependencies from verbose
diff --git a/libvtv/configure b/libvtv/configure
index 917557103e9..a7889161c50 100755
--- a/libvtv/configure
+++ b/libvtv/configure
@@ -640,6 +640,8 @@ VTV_CYGMIN_FALSE
VTV_CYGMIN_TRUE
XCFLAGS
libtool_VERSION
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
lt_host_flags
@@ -797,6 +799,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
enable_cet
with_gcc_major_version_only
'
@@ -1446,6 +1449,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-cet enable Intel CET in target libraries [default=auto]
Optional Packages:
@@ -8786,7 +8792,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10491,6 +10497,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10508,9 +10557,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12316,7 +12369,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12319 "configure"
+#line 12372 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12422,7 +12475,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12425 "configure"
+#line 12478 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13298,6 +13351,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc_CXX=no
hardcode_direct_CXX=no
hardcode_automatic_CXX=yes
@@ -13315,12 +13411,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring${_lt_dsymutil}"
archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
@@ -15714,6 +15818,14 @@ esac
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=1:0:0
@@ -16059,6 +16171,10 @@ if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${VTV_CYGMIN_TRUE}" && test -z "${VTV_CYGMIN_FALSE}"; then
as_fn_error $? "conditional \"VTV_CYGMIN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libvtv/configure.ac b/libvtv/configure.ac
index f3b937e4b10..50aaadbb3a3 100644
--- a/libvtv/configure.ac
+++ b/libvtv/configure.ac
@@ -153,6 +153,7 @@ AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=1:0:0
diff --git a/lto-plugin/configure b/lto-plugin/configure
index 37c44d04a0d..28f5dd79cd7 100755
--- a/lto-plugin/configure
+++ b/lto-plugin/configure
@@ -634,6 +634,8 @@ LTLIBOBJS
LIBOBJS
target_noncanonical
lt_host_flags
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
OTOOL64
OTOOL
LIPO
@@ -788,6 +790,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
'
ac_precious_vars='build_alias
host_alias
@@ -1434,6 +1437,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -8657,7 +8663,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -10363,6 +10369,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -10380,9 +10429,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -12188,7 +12241,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12191 "configure"
+#line 12244 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12294,7 +12347,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12297 "configure"
+#line 12350 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12531,6 +12584,14 @@ CC="$lt_save_CC"
# Only expand once:
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
@@ -12777,6 +12838,10 @@ if test -z "${LTO_PLUGIN_USE_SYMVER_SUN_TRUE}" && test -z "${LTO_PLUGIN_USE_SYMV
as_fn_error $? "conditional \"LTO_PLUGIN_USE_SYMVER_SUN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/lto-plugin/configure.ac b/lto-plugin/configure.ac
index 84f2a60b480..c051b8c6283 100644
--- a/lto-plugin/configure.ac
+++ b/lto-plugin/configure.ac
@@ -121,6 +121,7 @@ fi
AC_SUBST(ac_lto_plugin_extra_ldflags)
AM_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
ACX_LT_HOST_FLAGS
AC_SUBST(target_noncanonical)
AC_TYPE_INT64_T
diff --git a/zlib/configure b/zlib/configure
index 273ac36647d..92c462d04c6 100755
--- a/zlib/configure
+++ b/zlib/configure
@@ -641,6 +641,8 @@ TARGET_LIBRARY_FALSE
TARGET_LIBRARY_TRUE
toolexeclibdir
toolexecdir
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
CPP
OTOOL64
OTOOL
@@ -778,6 +780,7 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_darwin_at_rpath
with_toolexeclibdir
enable_host_shared
enable_host_pie
@@ -1422,6 +1425,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-darwin-at-rpath
+ install libraries with @rpath/library-name, requires
+ rpaths to be added to executables
--enable-host-shared build host code as shared libraries
--enable-host-pie build host code as PIE
@@ -6976,7 +6982,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
# darwin 5.x (macOS 10.1) onwards we only need to adjust when the
# deployment target is forced to an earlier version.
case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
+ UNSET,*-darwin[89]*|UNSET,*-darwin[12][0-9]*)
;;
10.[012][,.]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
@@ -8955,6 +8961,49 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
darwin* | rhapsody*)
+
+ # Publish an arg to allow the user to select that Darwin host (and target)
+ # libraries should be given install-names like @rpath/libfoo.dylib. This
+ # requires that the user of the library then adds an 'rpath' to the DSO that
+ # needs access.
+ # NOTE: there are defaults below, for systems that support rpaths. The person
+ # configuring can override the defaults for any system version that supports
+ # them - they are, however, forced off for system versions without support.
+ # Check whether --enable-darwin-at-rpath was given.
+if test "${enable_darwin_at_rpath+set}" = set; then :
+ enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then
+ # This is not supported before macOS 10.5 / Darwin9.
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&5
+$as_echo "$as_me: WARNING: Darwin @rpath library names are incompatible with OSX versions earlier than 10.5 (rpaths disabled)" >&2;}
+ enable_darwin_at_rpath=no
+ ;;
+ esac
+ fi
+else
+ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in
+ # As above, before 10.5 / Darwin9 this does not work.
+ UNSET,darwin[4-8]*|UNSET,rhapsody*|10.[0-4][,.]*)
+ enable_darwin_at_rpath=no
+ ;;
+
+ # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use
+ # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key
+ # system executables (e.g. /bin/sh). Force rpaths on for these systems.
+ UNSET,darwin1[5-9]*|UNSET,darwin2*|10.1[1-9][,.]*|1[1-9].*[,.]* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&5
+$as_echo "$as_me: @rpath library names are needed on macOS versions later than 10.11 (rpaths have been enabled)" >&6;}
+ enable_darwin_at_rpath=yes
+ ;;
+ # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can
+ # work with either DYLD_LIBRARY_PATH or embedded rpaths.
+
+ esac
+
+fi
+
+
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
@@ -8972,9 +9021,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
- archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _lt_install_name='\$rpath/\$soname'
+ if test "x$enable_darwin_at_rpath" = "xyes"; then
+ _lt_install_name='@rpath/\$soname'
+ fi
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name ${_lt_install_name} \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
@@ -10801,7 +10854,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10804 "configure"
+#line 10857 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10907,7 +10960,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10910 "configure"
+#line 10963 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11144,6 +11197,14 @@ CC="$lt_save_CC"
# Only expand once:
+ if test x$enable_darwin_at_rpath = xyes; then
+ ENABLE_DARWIN_AT_RPATH_TRUE=
+ ENABLE_DARWIN_AT_RPATH_FALSE='#'
+else
+ ENABLE_DARWIN_AT_RPATH_TRUE='#'
+ ENABLE_DARWIN_AT_RPATH_FALSE=
+fi
+
# Find CPP now so that any conditional tests below won't do it and
# thereby make the resulting definitions conditional.
@@ -11790,6 +11851,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${TARGET_LIBRARY_TRUE}" && test -z "${TARGET_LIBRARY_FALSE}"; then
as_fn_error $? "conditional \"TARGET_LIBRARY\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/zlib/configure.ac b/zlib/configure.ac
index adf7aad4e51..9501cdfea85 100644
--- a/zlib/configure.ac
+++ b/zlib/configure.ac
@@ -64,6 +64,7 @@ GCC_CET_FLAGS(CET_FLAGS)
AC_SUBST(CET_FLAGS)
AC_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
# Find CPP now so that any conditional tests below won't do it and
# thereby make the resulting definitions conditional.
--
2.39.2 (Apple Git-143)
[-- Attachment #4: 0003-Darwin-rpaths-Add-with-darwin-extra-rpath.patch --]
[-- Type: application/octet-stream, Size: 6093 bytes --]
From 2348525bb5fb18d486ad0738fd7939fca26df797 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Sat, 28 May 2022 10:16:27 +0100
Subject: [PATCH 3/5] Darwin, rpaths: Add --with-darwin-extra-rpath.
This is provided to allow distributions to add a single additional
runpath to allow for cases where the installed GCC library directories
are then symlinked to a common dirctory outside of any of the GCC
installations.
For example:
/opt/distro/lib:
libgfortran.dylib -> /opt/distro/lib/gcc-11.3/lib/libgfortran.dylib
So that libraries which are designed to be found in the runpath we would then
add --with-darwin-add-rpath=/opt/distro/lib to the configure line.
This patch makes the configuration a little more forgiving of using
--disable-darwin-at-rpath (although for platform versions >= 10.11 this will
result in misconfigured target libraries).
gcc/ChangeLog:
* configure.ac: Add --with-darwin-extra-rpath option.
* config/darwin.h: Handle DARWIN_EXTRA_RPATH.
* config.in: Regenerate.
* configure: Regenerate.
---
gcc/config.in | 13 +++++++++++++
gcc/config/darwin.h | 14 ++++++++++++++
gcc/configure | 28 ++++++++++++++++++++++++++--
gcc/configure.ac | 13 +++++++++++++
4 files changed, 66 insertions(+), 2 deletions(-)
diff --git a/gcc/config.in b/gcc/config.in
index 5cf51bc1b01..9bda18ab64b 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -49,6 +49,19 @@
#endif
+/* Specify a runpath directory, additional to those provided by the compiler
+ */
+#ifndef USED_FOR_TARGET
+#undef DARWIN_ADD_RPATH
+#endif
+
+
+/* Should add an extra runpath directory */
+#ifndef USED_FOR_TARGET
+#undef DARWIN_DO_EXTRA_RPATH
+#endif
+
+
/* Define to enable the use of a default assembler. */
#ifndef USED_FOR_TARGET
#undef DEFAULT_ASSEMBLER
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 1b6920f4c92..ede8c1d8dbb 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -321,6 +321,19 @@ extern GTY(()) int darwin_ms_struct;
%:version-compare(>= 10.11 mmacosx-version-min= -lemutls_w) "
#endif
+/* We might elect to add a path even when this compiler does not use embedded
+ run paths, so that we can use libraries from an alternate compiler that is
+ using embedded runpaths. */
+#if DARWIN_DO_EXTRA_RPATH
+# define DARWIN_EXTRA_RPATH \
+"%{!r:%{!nostdlib:%{!nodefaultrpaths:\
+ %:version-compare(>= 10.5 mmacosx-version-min= -rpath) \
+ %:version-compare(>= 10.5 mmacosx-version-min= " DARWIN_ADD_RPATH ") \
+ }}}"
+#else
+# define DARWIN_EXTRA_RPATH ""
+#endif
+
#define SUBSUBTARGET_OVERRIDE_OPTIONS \
do { \
darwin_override_options (); \
@@ -415,6 +428,7 @@ extern GTY(()) int darwin_ms_struct;
DARWIN_NOPIE_SPEC \
DARWIN_RDYNAMIC \
DARWIN_NOCOMPACT_UNWIND \
+ DARWIN_EXTRA_RPATH \
DARWIN_RPATH_LINK \
"}}}}}}} %<pie %<no-pie %<rdynamic %<X %<rpath %<nodefaultrpaths "
diff --git a/gcc/configure b/gcc/configure
index eaa1a189583..13472fcfc3c 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1009,6 +1009,7 @@ with_pic
enable_fast_install
enable_libtool_lock
enable_darwin_at_rpath
+with_darwin_extra_rpath
enable_ld
enable_gold
with_plugin_ld
@@ -1870,6 +1871,9 @@ Optional Packages:
--with-pic try to use only PIC/non-PIC objects [default=use
both]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
+ --with-darwin-extra-rpath=[ARG]
+ Specify a runpath directory, additional to those
+ provided by the compiler
--with-plugin-ld=[ARG] specify the plugin linker
--with-glibc-version=M.N
assume GCC used with glibc version M.N or later
@@ -19939,7 +19943,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19942 "configure"
+#line 19946 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -20045,7 +20049,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 20048 "configure"
+#line 20052 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -23373,6 +23377,26 @@ else
ENABLE_DARWIN_AT_RPATH_FALSE=
fi
+DARWIN_DO_EXTRA_RPATH=0
+
+# Check whether --with-darwin-extra-rpath was given.
+if test "${with_darwin_extra_rpath+set}" = set; then :
+ withval=$with_darwin_extra_rpath; if test x"$withval" != x; then
+ DARWIN_ADD_RPATH="$withval"
+ DARWIN_DO_EXTRA_RPATH=1
+ fi
+fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define DARWIN_DO_EXTRA_RPATH $DARWIN_DO_EXTRA_RPATH
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define DARWIN_ADD_RPATH "$DARWIN_ADD_RPATH"
+_ACEOF
+
# Identify the assembler which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the assembler
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 80e31229408..84175a5d7ce 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2600,6 +2600,19 @@ AC_SUBST(objdir)
AC_SUBST(enable_fast_install)
AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
+DARWIN_DO_EXTRA_RPATH=0
+AC_ARG_WITH(darwin-extra-rpath,
+[AS_HELP_STRING(
+ [[--with-darwin-extra-rpath=[ARG]]],
+ [Specify a runpath directory, additional to those provided by the compiler])],
+[if test x"$withval" != x; then
+ DARWIN_ADD_RPATH="$withval"
+ DARWIN_DO_EXTRA_RPATH=1
+ fi])
+AC_DEFINE_UNQUOTED(DARWIN_DO_EXTRA_RPATH, $DARWIN_DO_EXTRA_RPATH,
+ [Should add an extra runpath directory])
+AC_DEFINE_UNQUOTED(DARWIN_ADD_RPATH, "$DARWIN_ADD_RPATH",
+ [Specify a runpath directory, additional to those provided by the compiler])
# Identify the assembler which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the assembler
--
2.39.2 (Apple Git-143)
[-- Attachment #5: 0004-Testsuite-allow-non-installed-testing-on-darwin.patch --]
[-- Type: application/octet-stream, Size: 12763 bytes --]
From 0415173d58e7df3683dbd92d5d92003c8200a4b0 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Fri, 16 Apr 2021 20:01:40 +0100
Subject: [PATCH 4/5] Testsuite: allow non-installed testing on darwin
DYLD_LIBRARY_PATH is now removed from the environment for all system
tools, including the shell. Adapt the testsuite and pass the right
options to allow testing, even when the compiler and libraries have not
been installed.
gcc/ChangeLog:
* Makefile.in: set ENABLE_DARWIN_AT_RPATH in site.tmp.
gcc/testsuite/ChangeLog:
* gfortran.dg/coarray/caf.exp: Correctly set
libatomic flags.
* gfortran.dg/dg.exp: Likewise.
* lib/asan-dg.exp: Set correct -B flags.
* lib/atomic-dg.exp: Likewise.
* lib/target-libpath.exp: Handle ENABLE_DARWIN_AT_RPATH.
libatomic/ChangeLog:
* testsuite/lib/libatomic.exp: Pass correct flags on darwin.
libffi/ChangeLog:
* testsuite/lib/libffi.exp: Likewise.
libitm/ChangeLog:
* testsuite/lib/libitm.exp: Likewise.
* testsuite/libitm.c++/c++.exp: Likewise.
---
gcc/Makefile.in | 3 +++
gcc/testsuite/gfortran.dg/coarray/caf.exp | 16 +++++++++---
gcc/testsuite/gfortran.dg/dg.exp | 32 ++++++++++++++++++++---
gcc/testsuite/lib/asan-dg.exp | 2 +-
gcc/testsuite/lib/atomic-dg.exp | 2 +-
gcc/testsuite/lib/target-libpath.exp | 23 +++++++++++++---
libatomic/testsuite/lib/libatomic.exp | 8 ++++--
libffi/testsuite/lib/libffi.exp | 11 +++++---
libitm/testsuite/lib/libitm.exp | 1 +
libitm/testsuite/libitm.c++/c++.exp | 4 ++-
10 files changed, 84 insertions(+), 18 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 60ba2916457..023dba2159c 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -4209,6 +4209,9 @@ site.exp: ./config.status Makefile
echo "set COMPAT_OPTIONS \"$(COMPAT_OPTIONS)\"" >> ./site.tmp; \
else true; \
fi
+ @if test "x@enable_darwin_at_rpath@" = "xyes" ; then \
+ echo "set ENABLE_DARWIN_AT_RPATH 1" >> ./site.tmp; \
+ fi
@echo "## All variables above are generated by configure. Do Not Edit ##" >> ./site.tmp
@cat ./site.tmp > site.exp
@cat site.bak | sed \
diff --git a/gcc/testsuite/gfortran.dg/coarray/caf.exp b/gcc/testsuite/gfortran.dg/coarray/caf.exp
index d232be2fa90..a10b17a78d0 100644
--- a/gcc/testsuite/gfortran.dg/coarray/caf.exp
+++ b/gcc/testsuite/gfortran.dg/coarray/caf.exp
@@ -28,6 +28,7 @@
# Load procedures from common libraries.
load_lib gfortran-dg.exp
+load_lib atomic-dg.exp
# If a testcase doesn't have special options, use these.
global DEFAULT_FFLAGS
@@ -47,6 +48,7 @@ global gfortran_test_path
global gfortran_aux_module_flags
set gfortran_test_path $srcdir/$subdir
set gfortran_aux_module_flags $DEFAULT_FFLAGS
+
proc dg-compile-aux-modules { args } {
global gfortran_test_path
global gfortran_aux_module_flags
@@ -71,7 +73,15 @@ proc dg-compile-aux-modules { args } {
# Add -latomic only where supported. Assume built-in support elsewhere.
set maybe_atomic_lib ""
if [check_effective_target_libatomic_available] {
- set maybe_atomic_lib "-latomic"
+ if ![is_remote host] {
+ if [info exists TOOL_OPTIONS] {
+ set maybe_atomic_lib "[atomic_link_flags [get_multilibs ${TOOL_OPTIONS}]]"
+ } else {
+ set maybe_atomic_lib "[atomic_link_flags [get_multilibs]]"
+ }
+ }
+ set t [get_multilibs]
+ puts "maybe al $maybe_atomic_lib ml $t"
}
# Main loop.
@@ -97,14 +107,14 @@ foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ]]
foreach flags $option_list {
verbose "Testing $nshort (single), $flags" 1
set gfortran_aux_module_flags "-fcoarray=single $flags"
- dg-test $test "-fcoarray=single $flags $maybe_atomic_lib" ""
+ dg-test $test "-fcoarray=single $flags" $maybe_atomic_lib
cleanup-modules ""
}
foreach flags $option_list {
verbose "Testing $nshort (libcaf_single), $flags" 1
set gfortran_aux_module_flags "-fcoarray=lib $flags -lcaf_single"
- dg-test $test "-fcoarray=lib $flags -lcaf_single $maybe_atomic_lib" ""
+ dg-test $test "-fcoarray=lib $flags -lcaf_single" $maybe_atomic_lib
cleanup-modules ""
}
}
diff --git a/gcc/testsuite/gfortran.dg/dg.exp b/gcc/testsuite/gfortran.dg/dg.exp
index ee2760327dc..73541ea7301 100644
--- a/gcc/testsuite/gfortran.dg/dg.exp
+++ b/gcc/testsuite/gfortran.dg/dg.exp
@@ -18,6 +18,7 @@
# Load support procs.
load_lib gfortran-dg.exp
+load_lib atomic-dg.exp
# If a testcase doesn't have special options, use these.
global DEFAULT_FFLAGS
@@ -53,13 +54,38 @@ proc dg-compile-aux-modules { args } {
}
}
+# coarray tests might need libatomic. Assume that it is either not needed or
+# provided by builtins if it's not available.
+set maybe_atomic_lib ""
+if [check_effective_target_libatomic_available] {
+ if ![is_remote host] {
+ if [info exists TOOL_OPTIONS] {
+ set maybe_atomic_lib "[atomic_link_flags [get_multilibs ${TOOL_OPTIONS}]]"
+ } else {
+ set maybe_atomic_lib "[atomic_link_flags [get_multilibs]]"
+ }
+ } else {
+ set maybe_atomic_lib ""
+ }
+ set t [get_multilibs]
+ puts "dg set al $maybe_atomic_lib ml $t"
+}
+
+set all_flags $DEFAULT_FFLAGS
+if { $maybe_atomic_lib != "" } {
+ foreach f $maybe_atomic_lib {
+ lappend all_flags $f
+ }
+}
+
+puts "revised FFLAGS $all_flags"
+
# Main loop.
gfortran-dg-runtest [lsort \
- [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ] ] "" $DEFAULT_FFLAGS
+ [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ] ] "" $all_flags
gfortran-dg-runtest [lsort \
- [glob -nocomplain $srcdir/$subdir/g77/*.\[fF\] ] ] "" $DEFAULT_FFLAGS
-
+ [glob -nocomplain $srcdir/$subdir/g77/*.\[fF\] ] ] "" $all_flags
# All done.
dg-finish
diff --git a/gcc/testsuite/lib/asan-dg.exp b/gcc/testsuite/lib/asan-dg.exp
index 35e60eaaed5..157b60908d6 100644
--- a/gcc/testsuite/lib/asan-dg.exp
+++ b/gcc/testsuite/lib/asan-dg.exp
@@ -78,7 +78,7 @@ proc asan_link_flags_1 { paths lib } {
|| [file exists "${gccpath}/libsanitizer/${lib}/.libs/lib${lib}.${shlib_ext}"] } {
append flags " -B${gccpath}/libsanitizer/ "
append flags " -B${gccpath}/libsanitizer/${lib}/ "
- append flags " -L${gccpath}/libsanitizer/${lib}/.libs "
+ append flags " -B${gccpath}/libsanitizer/${lib}/.libs "
append ld_library_path ":${gccpath}/libsanitizer/${lib}/.libs"
}
} else {
diff --git a/gcc/testsuite/lib/atomic-dg.exp b/gcc/testsuite/lib/atomic-dg.exp
index 1589acd8eaf..ce1799cef2d 100644
--- a/gcc/testsuite/lib/atomic-dg.exp
+++ b/gcc/testsuite/lib/atomic-dg.exp
@@ -33,7 +33,7 @@ proc atomic_link_flags { paths } {
if { [file exists "${gccpath}/libatomic/.libs/libatomic.a"]
|| [file exists "${gccpath}/libatomic/.libs/libatomic.${shlib_ext}"] } {
append flags " -B${gccpath}/libatomic/ "
- append flags " -L${gccpath}/libatomic/.libs"
+ append flags " -B${gccpath}/libatomic/.libs"
append ld_library_path ":${gccpath}/libatomic/.libs"
}
} else {
diff --git a/gcc/testsuite/lib/target-libpath.exp b/gcc/testsuite/lib/target-libpath.exp
index 6d530fb4af6..36b64dd4550 100644
--- a/gcc/testsuite/lib/target-libpath.exp
+++ b/gcc/testsuite/lib/target-libpath.exp
@@ -67,6 +67,7 @@ proc set_ld_library_path_env_vars { } {
global orig_dyld_library_path
global orig_path
global orig_gcc_exec_prefix
+ global ENABLE_DARWIN_AT_RPATH
global env
# Save the original GCC_EXEC_PREFIX.
@@ -133,6 +134,7 @@ proc set_ld_library_path_env_vars { } {
#
# Doing this is somewhat of a hack as ld_library_path gets repeated in
# SHLIB_PATH and LD_LIBRARY_PATH when unix_load sets these variables.
+ if { ![istarget *-*-darwin*] } {
if { $orig_ld_library_path_saved } {
setenv LD_LIBRARY_PATH "$ld_library_path:$orig_ld_library_path"
} else {
@@ -166,10 +168,22 @@ proc set_ld_library_path_env_vars { } {
} else {
setenv LD_LIBRARY_PATH_64 "$ld_library_path"
}
- if { $orig_dyld_library_path_saved } {
- setenv DYLD_LIBRARY_PATH "$ld_library_path:$orig_dyld_library_path"
- } else {
- setenv DYLD_LIBRARY_PATH "$ld_library_path"
+ }
+ if { [istarget *-*-darwin*] } {
+ if { [info exists ENABLE_DARWIN_AT_RPATH] || [istarget *-*-darwin1\[5-9\]*]
+ || [istarget *-*-darwin20*] } {
+ # Either we are not using DYLD_LIBRARY_PATH or we're on a version of the
+ # OS for which it is not passed through system exes.
+ if [info exists env(DYLD_LIBRARY_PATH)] {
+ unsetenv DYLD_LIBRARY_PATH
+ }
+ } else {
+ if { $orig_dyld_library_path_saved } {
+ setenv DYLD_LIBRARY_PATH "$ld_library_path:$orig_dyld_library_path"
+ } else {
+ setenv DYLD_LIBRARY_PATH "$ld_library_path"
+ }
+ }
}
if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } {
if { $orig_path_saved } {
@@ -179,6 +193,7 @@ proc set_ld_library_path_env_vars { } {
}
}
+ verbose -log "set paths"
verbose -log "LD_LIBRARY_PATH=[getenv LD_LIBRARY_PATH]"
verbose -log "LD_RUN_PATH=[getenv LD_RUN_PATH]"
verbose -log "SHLIB_PATH=[getenv SHLIB_PATH]"
diff --git a/libatomic/testsuite/lib/libatomic.exp b/libatomic/testsuite/lib/libatomic.exp
index 10f38475bc8..c6d645e9ae3 100644
--- a/libatomic/testsuite/lib/libatomic.exp
+++ b/libatomic/testsuite/lib/libatomic.exp
@@ -148,11 +148,15 @@ proc libatomic_init { args } {
if { $blddir != "" } {
lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/"
lappend ALWAYS_CFLAGS "additional_flags=-I${blddir}"
- lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs"
+ if [istarget *-*-darwin*] {
+ lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/.libs"
+ } else {
+ lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs"
+ }
}
lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/.."
- if [istarget *-*-darwin*] {
+ if [istarget *-*-darwin\[89\]*] {
lappend ALWAYS_CFLAGS "additional_flags=-shared-libgcc"
}
diff --git a/libffi/testsuite/lib/libffi.exp b/libffi/testsuite/lib/libffi.exp
index 15d3d5ebd73..611f5177c7a 100644
--- a/libffi/testsuite/lib/libffi.exp
+++ b/libffi/testsuite/lib/libffi.exp
@@ -337,8 +337,13 @@ proc libffi-init { args } {
verbose "libffi_dir $libffi_dir"
if { $libffi_dir != "" } {
set libffi_dir [file dirname ${libffi_dir}]
- set libffi_link_flags "-L${libffi_dir}/.libs"
- lappend libffi_link_flags "-L${blddircxx}/src/.libs"
+ if [istarget *-*-darwin*] {
+ set libffi_link_flags "-B${libffi_dir}/.libs"
+ lappend libffi_link_flags "-B${blddircxx}/src/.libs"
+ } else {
+ set libffi_link_flags "-L${libffi_dir}/.libs"
+ lappend libffi_link_flags "-L${blddircxx}/src/.libs"
+ }
}
set_ld_library_path_env_vars
@@ -382,7 +387,7 @@ proc libffi_target_compile { source dest type options } {
# Darwin needs a stack execution allowed flag.
if { [istarget "*-*-darwin9*"] || [istarget "*-*-darwin1*"]
- || [istarget "*-*-darwin2*"] } {
+ || [istarget "x86_64-*-darwin2*"] } {
lappend options "additional_flags=-Wl,-allow_stack_execute"
lappend options "additional_flags=-Wl,-search_paths_first"
}
diff --git a/libitm/testsuite/lib/libitm.exp b/libitm/testsuite/lib/libitm.exp
index da918d1ee8d..61bbfa0c923 100644
--- a/libitm/testsuite/lib/libitm.exp
+++ b/libitm/testsuite/lib/libitm.exp
@@ -159,6 +159,7 @@ proc libitm_init { args } {
}
if [istarget *-*-darwin*] {
+ lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/.libs"
lappend ALWAYS_CFLAGS "additional_flags=-shared-libgcc"
}
diff --git a/libitm/testsuite/libitm.c++/c++.exp b/libitm/testsuite/libitm.c++/c++.exp
index de45e7e5480..1b0ead05fee 100644
--- a/libitm/testsuite/libitm.c++/c++.exp
+++ b/libitm/testsuite/libitm.c++/c++.exp
@@ -56,8 +56,10 @@ if { $lang_test_file_found } {
# Gather a list of all tests.
set tests [lsort [glob -nocomplain $srcdir/$subdir/*.C]]
+ set stdcxxadder ""
if { $blddir != "" } {
set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
+ set stdcxxadder "-B ${blddir}/${lang_library_path}"
} else {
set ld_library_path "$always_ld_library_path"
}
@@ -72,7 +74,7 @@ if { $lang_test_file_found } {
}
# Main loop.
- dg-runtest $tests "" $libstdcxx_includes
+ dg-runtest $tests $stdcxxadder $libstdcxx_includes
}
# All done.
--
2.39.2 (Apple Git-143)
[-- Attachment #6: 0005-Doc-document-the-new-Darwin-options.patch --]
[-- Type: application/octet-stream, Size: 2774 bytes --]
From be8676410ab15a6e6cce300ce617d1f5259dcabf Mon Sep 17 00:00:00 2001
From: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Date: Thu, 24 Aug 2023 13:22:28 +0200
Subject: [PATCH 5/5] Doc: document the new Darwin options
gcc/ChangeLog:
* doc/invoke.texi: Document the new -nodefaultrpaths option.
* doc/install.texi: Document the new --with-darwin-extra-rpath
option.
---
gcc/doc/install.texi | 6 ++++++
gcc/doc/invoke.texi | 10 +++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index e099cd0b568..a388e1f12e0 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -1808,6 +1808,12 @@ particularly useful if you intend to use several versions of GCC in
parallel. The default is @samp{yes} for @samp{libada}, and @samp{no} for
the remaining libraries.
+@item --with-darwin-extra-rpath
+This is provided to allow distributions to add a single additional
+runpath on Darwin / macOS systems. This allows for cases where the
+installed GCC library directories are then symlinked to a common
+directory outside of the GCC installation.
+
@item @anchor{WithAixSoname}--with-aix-soname=@samp{aix}, @samp{svr4} or @samp{both}
Traditional AIX shared library versioning (versioned @code{Shared Object}
files as members of unversioned @code{Archive Library} files named
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index a32dabf0405..778d82ecd2b 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -920,7 +920,7 @@ Objective-C and Objective-C++ Dialects}.
-iframework
-image_base -init -install_name -keep_private_externs
-multi_module -multiply_defined -multiply_defined_unused
--noall_load -no_dead_strip_inits_and_terms
+-noall_load -no_dead_strip_inits_and_terms -nodefaultrpaths
-nofixprebinding -nomultidefs -noprebind -noseglinkedit
-pagezero_size -prebind -prebind_all_twolevel_modules
-private_bundle -read_only_relocs -sectalign
@@ -24269,6 +24269,14 @@ an executable when linking, using the Darwin @file{libtool} command.
This causes GCC's output file to have the @samp{ALL} subtype, instead of
one controlled by the @option{-mcpu} or @option{-march} option.
+@opindex nodefaultrpaths
+@item -nodefaultrpaths
+Do not add default run paths for the compiler library directories to
+executables, modules or dynamic libraries. On macOS 10.5 and later,
+the embedded runpath is added by default unless the user adds
+@option{-nodefaultrpaths} to the link line. Run paths are needed
+(and therefore enforced) to build on macOS version 10.11 or later.
+
@item -allowable_client @var{client_name}
@itemx -client_name
@itemx -compatibility_version
--
2.39.2 (Apple Git-143)
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-09-20 13:52 ` FX Coudert
@ 2023-10-08 13:07 ` Nathanael Nerode
2023-10-08 22:14 ` Iain Sandoe
0 siblings, 1 reply; 39+ messages in thread
From: Nathanael Nerode @ 2023-10-08 13:07 UTC (permalink / raw)
To: FX Coudert, GCC Patches
Cc: Joseph Myers, bonzini, neroden, aoliva, Ralf.Wildenhues, Iain Sandoe
I hope a global maintainer can step up. I've been on hiatus from GCC work for some years, and this was never my part of the build system anyway -- and I don't use Darwin -- so I'm not qualified to review it. It looks fine but it should be reviewed by someone who knows what they're doing.
On Wed, Sep 20, 2023, at 9:52 AM, FX Coudert wrote:
> ping**2 for a build maintainer or global maintainer to review, please
> It restores testing on darwin >= 21, which is not currently working
>
> If no maintainer is available to review build system, could I get
> guidance on how to proceed further?
>
> Thanks,
> FX
>
>
>> Le 12 sept. 2023 à 19:52, FX Coudert <fxcoudert@gmail.com> a écrit :
>>
>> Hi build maintainers,
>>
>> May I ping this series of patches for review? In particular, they allow to restore testing on darwin, which is currently broken with darwin >= 21, due to DYLD_LIBRARY_PATH being systematically removed from the environment by system tools.
>>
>> It has been tested for two years on darwin, and would allow to restore regular regtesting on that target. It is a big step to help prevent bugs being undetected on this port.
>>
>> The patchset was okayed from the driver point of view, but we need a build reviewer (or global reviewer) to okay those bits. Original presentation of the patches:
>>
>> ------
>> I’d like to post an updated and rebased version of Iain Sandoe’s patches for modern darwin, originally posted in November 2021: https://gcc.gnu.org/pipermail/gcc-patches/2021-November/584775.html
>>
>> The rationale in that message is pretty much unchanged, and the patches have been since tested thoroughly on darwin (both Intel and ARM) for almost two years now. We have been shipping Iain’s branch (including these patches) since then in Homebrew and most other major distros of GCC on Darwin. So I think it’s been very thoroughly tested.
>>
>> The main comment that arose from review in the previous incarnation was the need to at least offer the libtool part of the patch to upstream, in order to reduce in the long term the divergence between our version and upstream. I have done so in https://savannah.gnu.org/patch/index.php?10385
>>
>> (I would also note that I have offered other suggestions of small snippets that could be upstream in libtool for darwin, but have not received much feedback for now: https://savannah.gnu.org/patch/?10371)
>> ------
>>
>>
>> Thanks,
>> FX
>>
>>
>>
>>> Le 29 août 2023 à 22:17, FX Coudert <fxcoudert@gmail.com> a écrit :
>>>
>>>> I think a build machinery review is needed.
>>>
>>> Thanks. CC’ing the relevant maintainers for review of the build part.
>>> The driver part and the darwin-specific part are already okayed.
>>>
>>> FX
>
>
> Attachments:
> * 0001-Driver-Provide-a-spec-to-insert-rpaths-for-compiler-.patch
> * 0002-Darwin-Allow-for-configuring-Darwin-to-use-embedded-.patch
> * 0003-Darwin-rpaths-Add-with-darwin-extra-rpath.patch
> * 0004-Testsuite-allow-non-installed-testing-on-darwin.patch
> * 0005-Doc-document-the-new-Darwin-options.patch
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-10-08 13:07 ` Nathanael Nerode
@ 2023-10-08 22:14 ` Iain Sandoe
2023-10-21 18:05 ` Jeff Law
0 siblings, 1 reply; 39+ messages in thread
From: Iain Sandoe @ 2023-10-08 22:14 UTC (permalink / raw)
To: Nathanael Nerode, Jeff Law
Cc: FX Coudert, GCC Patches, Joseph Myers, bonzini, neroden, aoliva,
Ralf.Wildenhues
+ Jeff
> On 8 Oct 2023, at 14:07, Nathanael Nerode <ncn_gcc10@fastmail.fm> wrote:
>
> I hope a global maintainer can step up. I've been on hiatus from GCC work for some years, and this was never my part of the build system anyway -- and I don't use Darwin -- so I'm not qualified to review it. It looks fine but it should be reviewed by someone who knows what they're doing.
Thanks Nathanael for taking a look,
@Jeff as we discussed at the Cauldron, I suspected it might be difficult to get this review, so would really appreciate if could cast an eye over it at some point,
thanks
Iain
>
> On Wed, Sep 20, 2023, at 9:52 AM, FX Coudert wrote:
>> ping**2 for a build maintainer or global maintainer to review, please
>> It restores testing on darwin >= 21, which is not currently working
>>
>> If no maintainer is available to review build system, could I get
>> guidance on how to proceed further?
>>
>> Thanks,
>> FX
>>
>>
>>> Le 12 sept. 2023 à 19:52, FX Coudert <fxcoudert@gmail.com> a écrit :
>>>
>>> Hi build maintainers,
>>>
>>> May I ping this series of patches for review? In particular, they allow to restore testing on darwin, which is currently broken with darwin >= 21, due to DYLD_LIBRARY_PATH being systematically removed from the environment by system tools.
>>>
>>> It has been tested for two years on darwin, and would allow to restore regular regtesting on that target. It is a big step to help prevent bugs being undetected on this port.
>>>
>>> The patchset was okayed from the driver point of view, but we need a build reviewer (or global reviewer) to okay those bits. Original presentation of the patches:
>>>
>>> ------
>>> I’d like to post an updated and rebased version of Iain Sandoe’s patches for modern darwin, originally posted in November 2021: https://gcc.gnu.org/pipermail/gcc-patches/2021-November/584775.html
>>>
>>> The rationale in that message is pretty much unchanged, and the patches have been since tested thoroughly on darwin (both Intel and ARM) for almost two years now. We have been shipping Iain’s branch (including these patches) since then in Homebrew and most other major distros of GCC on Darwin. So I think it’s been very thoroughly tested.
>>>
>>> The main comment that arose from review in the previous incarnation was the need to at least offer the libtool part of the patch to upstream, in order to reduce in the long term the divergence between our version and upstream. I have done so in https://savannah.gnu.org/patch/index.php?10385
>>>
>>> (I would also note that I have offered other suggestions of small snippets that could be upstream in libtool for darwin, but have not received much feedback for now: https://savannah.gnu.org/patch/?10371)
>>> ------
>>>
>>>
>>> Thanks,
>>> FX
>>>
>>>
>>>
>>>> Le 29 août 2023 à 22:17, FX Coudert <fxcoudert@gmail.com> a écrit :
>>>>
>>>>> I think a build machinery review is needed.
>>>>
>>>> Thanks. CC’ing the relevant maintainers for review of the build part.
>>>> The driver part and the darwin-specific part are already okayed.
>>>>
>>>> FX
>>
>>
>> Attachments:
>> * 0001-Driver-Provide-a-spec-to-insert-rpaths-for-compiler-.patch
>> * 0002-Darwin-Allow-for-configuring-Darwin-to-use-embedded-.patch
>> * 0003-Darwin-rpaths-Add-with-darwin-extra-rpath.patch
>> * 0004-Testsuite-allow-non-installed-testing-on-darwin.patch
>> * 0005-Doc-document-the-new-Darwin-options.patch
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-10-08 22:14 ` Iain Sandoe
@ 2023-10-21 18:05 ` Jeff Law
2023-10-21 18:26 ` Iain Sandoe
0 siblings, 1 reply; 39+ messages in thread
From: Jeff Law @ 2023-10-21 18:05 UTC (permalink / raw)
To: Iain Sandoe, Nathanael Nerode
Cc: FX Coudert, GCC Patches, Joseph Myers, bonzini, neroden, aoliva,
Ralf.Wildenhues
On 10/8/23 16:14, Iain Sandoe wrote:
> + Jeff
>
>> On 8 Oct 2023, at 14:07, Nathanael Nerode <ncn_gcc10@fastmail.fm> wrote:
>>
>> I hope a global maintainer can step up. I've been on hiatus from GCC work for some years, and this was never my part of the build system anyway -- and I don't use Darwin -- so I'm not qualified to review it. It looks fine but it should be reviewed by someone who knows what they're doing.
>
> Thanks Nathanael for taking a look,
>
> @Jeff as we discussed at the Cauldron, I suspected it might be difficult to get this review, so would really appreciate if could cast an eye over it at some point,
If you could forward the remaining patches it'd be helpful. I think
Alex just acked one or more of these that affected the build machinery.
jeff
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-10-21 18:05 ` Jeff Law
@ 2023-10-21 18:26 ` Iain Sandoe
0 siblings, 0 replies; 39+ messages in thread
From: Iain Sandoe @ 2023-10-21 18:26 UTC (permalink / raw)
To: Jeff Law; +Cc: FX Coudert, GCC Patches, aoliva
Hi Jeff,
> On 21 Oct 2023, at 19:05, Jeff Law <jeffreyalaw@gmail.com> wrote:
> On 10/8/23 16:14, Iain Sandoe wrote:
>> + Jeff
>>> On 8 Oct 2023, at 14:07, Nathanael Nerode <ncn_gcc10@fastmail.fm> wrote:
>>>
>>> I hope a global maintainer can step up. I've been on hiatus from GCC work for some years, and this was never my part of the build system anyway -- and I don't use Darwin -- so I'm not qualified to review it. It looks fine but it should be reviewed by someone who knows what they're doing.
>> Thanks Nathanael for taking a look,
>> @Jeff as we discussed at the Cauldron, I suspected it might be difficult to get this review, so would really appreciate if could cast an eye over it at some point,
> If you could forward the remaining patches it'd be helpful. I think Alex just acked one or more of these that affected the build machinery.
Yes, that’s now fine - it was the build system review that was missing (which Alex did, thanks!) - the other parts are already approved.
Iain
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-08-29 20:17 ` FX Coudert
2023-09-12 17:52 ` FX Coudert
@ 2023-10-21 5:27 ` Alexandre Oliva
2023-10-22 21:18 ` FX Coudert
1 sibling, 1 reply; 39+ messages in thread
From: Alexandre Oliva @ 2023-10-21 5:27 UTC (permalink / raw)
To: FX Coudert
Cc: Joseph Myers, GCC Patches, bonzini, neroden, Ralf.Wildenhues,
Iain Sandoe
On Aug 29, 2023, FX Coudert <fxcoudert@gmail.com> wrote:
>> I think a build machinery review is needed.
> Thanks. CC’ing the relevant maintainers for review of the build part.
> The driver part and the darwin-specific part are already okayed.
The build machinery bits look reasonable to me. I have no specific
knowledge of darwin, but I expect darwin maintainers understand and
approve of the bits that are going into build machinery files.
Apologies for the delay.
--
Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/
Free Software Activist GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice but
very few check the facts. Think Assange & Stallman. The empires strike back
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-10-21 5:27 ` Alexandre Oliva
@ 2023-10-22 21:18 ` FX Coudert
2023-11-30 19:43 ` Ian Lance Taylor
0 siblings, 1 reply; 39+ messages in thread
From: FX Coudert @ 2023-10-22 21:18 UTC (permalink / raw)
To: Alexandre Oliva
Cc: Joseph Myers, GCC Patches, bonzini, neroden, Ralf.Wildenhues,
Iain Sandoe
Thanks a lot Alexandre for the review!
FX
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-10-22 21:18 ` FX Coudert
@ 2023-11-30 19:43 ` Ian Lance Taylor
2023-11-30 19:56 ` Iain Sandoe
0 siblings, 1 reply; 39+ messages in thread
From: Ian Lance Taylor @ 2023-11-30 19:43 UTC (permalink / raw)
To: FX Coudert; +Cc: GCC Patches, Iain Sandoe
On Sun, Oct 22, 2023 at 2:18 PM FX Coudert <fxcoudert@gmail.com> wrote:
>
> Thanks a lot Alexandre for the review!
This patch changed the files lingo/configure.ac and libgo/configure.
Those files live in an upstream repository and should be changed there
and then merged into the GCC repo, as described in libgo/README.gcc.
This is not a big deal, and I can take care of changing the upstream
repository. But I don't understand the changes in libgo. As far as I
can tell, all they do is add an automake conditional that is never
used. Is there any reason for that? Should I just revert the changes
to libgo?
To be clear, I am asking about this change in git revision
6a6d3817afa02bbcd2388c8e005da6faf88932f1 and the corresponding change
in the generated file libgo/configure.ac. Thanks.
diff --git a/libgo/configure.ac b/libgo/configure.ac
index 54c35c0903c..e8d66f8415d 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -53,6 +53,7 @@ AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test
x$enable_darwin_at_rpath = xyes])
CC_FOR_BUILD=${CC_FOR_BUILD:-gcc}
AC_SUBST(CC_FOR_BUILD)
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-11-30 19:43 ` Ian Lance Taylor
@ 2023-11-30 19:56 ` Iain Sandoe
2023-11-30 19:58 ` Ian Lance Taylor
0 siblings, 1 reply; 39+ messages in thread
From: Iain Sandoe @ 2023-11-30 19:56 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: FX Coudert, GCC Patches
Hi Ian
> On 30 Nov 2023, at 19:43, Ian Lance Taylor <iant@golang.org> wrote:
>
> On Sun, Oct 22, 2023 at 2:18 PM FX Coudert <fxcoudert@gmail.com> wrote:
>>
>> Thanks a lot Alexandre for the review!
>
> This patch changed the files lingo/configure.ac and libgo/configure.
> Those files live in an upstream repository and should be changed there
> and then merged into the GCC repo, as described in libgo/README.gcc.
> This is not a big deal, and I can take care of changing the upstream
> repository. But I don't understand the changes in libgo. As far as I
> can tell, all they do is add an automake conditional that is never
> used. Is there any reason for that?
It’s not used (yet) because we do not build libgo on Darwin, if/when we
do it would be used in the same way as for the other runtimes.
> Should I just revert the changes to libgo?
That is also fine (because we do not yet build it on Darwin), it seems unlikely
we’d forget to re-add it.
Iain
>
> To be clear, I am asking about this change in git revision
> 6a6d3817afa02bbcd2388c8e005da6faf88932f1 and the corresponding change
> in the generated file libgo/configure.ac. Thanks.
>
> diff --git a/libgo/configure.ac b/libgo/configure.ac
> index 54c35c0903c..e8d66f8415d 100644
> --- a/libgo/configure.ac
> +++ b/libgo/configure.ac
> @@ -53,6 +53,7 @@ AC_LIBTOOL_DLOPEN
> AM_PROG_LIBTOOL
> AC_SUBST(enable_shared)
> AC_SUBST(enable_static)
> +AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test
> x$enable_darwin_at_rpath = xyes])
>
> CC_FOR_BUILD=${CC_FOR_BUILD:-gcc}
> AC_SUBST(CC_FOR_BUILD)
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-11-30 19:56 ` Iain Sandoe
@ 2023-11-30 19:58 ` Ian Lance Taylor
2023-11-30 21:25 ` Ian Lance Taylor
0 siblings, 1 reply; 39+ messages in thread
From: Ian Lance Taylor @ 2023-11-30 19:58 UTC (permalink / raw)
To: Iain Sandoe; +Cc: FX Coudert, GCC Patches
On Thu, Nov 30, 2023 at 11:56 AM Iain Sandoe <iain@sandoe.co.uk> wrote:
>
> > On 30 Nov 2023, at 19:43, Ian Lance Taylor <iant@golang.org> wrote:
> >
> > On Sun, Oct 22, 2023 at 2:18 PM FX Coudert <fxcoudert@gmail.com> wrote:
> >>
> >> Thanks a lot Alexandre for the review!
> >
> > This patch changed the files lingo/configure.ac and libgo/configure.
> > Those files live in an upstream repository and should be changed there
> > and then merged into the GCC repo, as described in libgo/README.gcc.
> > This is not a big deal, and I can take care of changing the upstream
> > repository. But I don't understand the changes in libgo. As far as I
> > can tell, all they do is add an automake conditional that is never
> > used. Is there any reason for that?
>
> It’s not used (yet) because we do not build libgo on Darwin, if/when we
> do it would be used in the same way as for the other runtimes.
>
> > Should I just revert the changes to libgo?
>
> That is also fine (because we do not yet build it on Darwin), it seems unlikely
> we’d forget to re-add it.
Thanks, I'll make the change upstream.
Ian
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-11-30 19:58 ` Ian Lance Taylor
@ 2023-11-30 21:25 ` Ian Lance Taylor
0 siblings, 0 replies; 39+ messages in thread
From: Ian Lance Taylor @ 2023-11-30 21:25 UTC (permalink / raw)
To: Iain Sandoe; +Cc: FX Coudert, GCC Patches
On Thu, Nov 30, 2023 at 11:58 AM Ian Lance Taylor <iant@golang.org> wrote:
>
> On Thu, Nov 30, 2023 at 11:56 AM Iain Sandoe <iain@sandoe.co.uk> wrote:
> >
> > > On 30 Nov 2023, at 19:43, Ian Lance Taylor <iant@golang.org> wrote:
> > >
> > > On Sun, Oct 22, 2023 at 2:18 PM FX Coudert <fxcoudert@gmail.com> wrote:
> > >>
> > >> Thanks a lot Alexandre for the review!
> > >
> > > This patch changed the files lingo/configure.ac and libgo/configure.
> > > Those files live in an upstream repository and should be changed there
> > > and then merged into the GCC repo, as described in libgo/README.gcc.
> > > This is not a big deal, and I can take care of changing the upstream
> > > repository. But I don't understand the changes in libgo. As far as I
> > > can tell, all they do is add an automake conditional that is never
> > > used. Is there any reason for that?
> >
> > It’s not used (yet) because we do not build libgo on Darwin, if/when we
> > do it would be used in the same way as for the other runtimes.
> >
> > > Should I just revert the changes to libgo?
> >
> > That is also fine (because we do not yet build it on Darwin), it seems unlikely
> > we’d forget to re-add it.
>
> Thanks, I'll make the change upstream.
Now done.
Ian
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-08-15 16:58 Darwin: Replace environment runpath with embedded [PR88590] FX Coudert
2023-08-18 20:17 ` Joseph Myers
@ 2023-10-30 16:17 ` Martin Jambor
[not found] ` <653fd72a.050a0220.a6a20.de86SMTPIN_ADDED_BROKEN@mx.google.com>
2023-11-13 15:27 ` gfortran.dg/dg.exp debug messages pollute test output Rainer Orth
3 siblings, 0 replies; 39+ messages in thread
From: Martin Jambor @ 2023-10-30 16:17 UTC (permalink / raw)
To: Iain Sandoe; +Cc: FX Coudert, gcc-patches
Hello Iain,
On Tue, Aug 15 2023, FX Coudert via Gcc-patches wrote:
>
[...]
> From e1cf04cadb9fa065fb3f7d6bccf9ed6f1e9e3fc1 Mon Sep 17 00:00:00 2001
> From: Iain Sandoe <iain@sandoe.co.uk>
> Date: Sun, 28 Mar 2021 14:48:17 +0100
> Subject: [PATCH 2/4] Darwin: Allow for configuring Darwin to use embedded
> runpath.
our buildbot checker found that after this patch, there is an
uncommitted auto(re)conf generated hunk in fixincludes/configure:
diff --git a/fixincludes/configure b/fixincludes/configure
index b9770489adc..1bb547a1724 100755
--- a/fixincludes/configure
+++ b/fixincludes/configure
@@ -3027,6 +3027,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# ---------------------------
# _LT_COMPILER_PIC
+enable_darwin_at_rpath_$1=no
# _LT_LINKER_SHLIBS([TAGNAME])
# ----------------------------
@@ -3049,7 +3050,6 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# the compiler configuration to `libtool'.
# _LT_LANG_CXX_CONFIG
-
# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
# ---------------------------------
# Figure out "hidden" library dependencies from verbose
Can I commit it (with an appropriate ChangeLog message) or do you want
to take care of it yourself?
Thanks,
Martin
>
> Recent Darwin versions place contraints on the use of run paths
> specified in environment variables. This breaks some assumptions
> in the GCC build.
>
> This change allows the user to configure a Darwin build to use
> '@rpath/libraryname.dylib' in library names and then to add an
> embedded runpath to executables (and libraries with dependents).
>
> The embedded runpath is added by default unless the user adds
> '-nodefaultrpaths' to the link line.
>
> For an installed compiler, it means that any executable built with
> that compiler will reference the runtimes installed with the
> compiler (equivalent to hard-coding the library path into the name
> of the library).
>
> During build-time configurations any "-B" entries will be added to
> the runpath thus the newly-built libraries will be found by exes.
>
> Since the install name is set in libtool, that decision needs to be
> available here (but might also cause dependent ones in Makefiles,
> so we need to export a conditional).
>
> This facility is not available for Darwin 8 or earlier, however the
> existing environment variable runpath does work there.
>
> We default this on for systems where the external DYLD_LIBRARY_PATH
> does not work and off for Darwin 8 or earlier. For systems that can
> use either method, if the value is unset, we use the default (which
> is currently DYLD_LIBRARY_PATH).
>
> ----
>
> Ada changes:
> add paths relative to @loader-path
>
> JIT changes:
>
> This patch expects DARWIN_RPATH to be computed and available; which
> means that we will use @rpath or ${libdir} as the name prefix
> depending on the system version and the setting of
> --enable-darwin-at-rpath. For branches that do not have this
> available, the value should be set to ${libdir}.
>
> added m2 library changes.
>
> ChangeLog:
>
> * configure: Regenerate.
> * configure.ac: Do not add default runpaths to GCC exes
> when we are building -static-libstdc++/-static-libgcc (the
> default).
> * libtool.m4: Add 'enable-darwin-at-runpath'. Act on the
> enable flag to alter Darwin libraries to use @rpath names.
>
> fixincludes/ChangeLog:
>
> * configure: Regenerate.
>
> gcc/ChangeLog:
>
> * aclocal.m4: Regenerate.
> * configure: Regenerate.
> * configure.ac: Handle Darwin rpaths.
> * config/darwin-driver.cc: Handle Darwin rpaths.
> * config/darwin.h: Handle Darwin rpaths.
> * config/darwin.opt: Handle Darwin rpaths.
> * Makefile.in: Handle Darwin rpaths.
>
> gcc/ada/ChangeLog:
>
> * gcc-interface/Makefile.in: Handle Darwin rpaths.
>
> gcc/jit/ChangeLog:
> * Make-lang.in: Handle Darwin rpaths.
>
> libatomic/ChangeLog:
>
> * Makefile.am: Handle Darwin rpaths.
> * Makefile.in: Regenerate.
> * configure: Regenerate.
> * configure.ac: Handle Darwin rpaths.
>
> libbacktrace/ChangeLog:
>
> * configure: Regenerate.
> * configure.ac: Handle Darwin rpaths.
>
> libcc1/ChangeLog:
>
> * configure: Regenerate.
>
> libffi/ChangeLog:
>
> * Makefile.am: Handle Darwin rpaths.
> * Makefile.in: Regenerate.
> * configure: Regenerate.
>
> libgcc/ChangeLog:
>
> * config/t-slibgcc-darwin: Generate libgcc_s
> with an @rpath name.
> * config.host: Handle Darwin rpaths.
>
> libgfortran/ChangeLog:
>
> * Makefile.am: Handle Darwin rpaths.
> * Makefile.in: Regenerate.
> * configure: Regenerate.
> * configure.ac: Handle Darwin rpaths
>
> libgm2/ChangeLog:
>
> * Makefile.am: Handle Darwin rpaths.
> * Makefile.in: Regenerate.
> * aclocal.m4: Regenerate.
> * configure: Regenerate.
> * configure.ac: Handle Darwin rpaths.
> * libm2cor/Makefile.am: Handle Darwin rpaths.
> * libm2cor/Makefile.in: Regenerate.
> * libm2iso/Makefile.am: Handle Darwin rpaths.
> * libm2iso/Makefile.in: Regenerate.
> * libm2log/Makefile.am: Handle Darwin rpaths.
> * libm2log/Makefile.in: Regenerate.
> * libm2min/Makefile.am: Handle Darwin rpaths.
> * libm2min/Makefile.in: Regenerate.
> * libm2pim/Makefile.am: Handle Darwin rpaths.
> * libm2pim/Makefile.in: Regenerate.
>
> libgomp/ChangeLog:
>
> * Makefile.am: Handle Darwin rpaths.
> * Makefile.in: Regenerate.
> * configure: Regenerate.
> * configure.ac: Handle Darwin rpaths
>
> libitm/ChangeLog:
>
> * Makefile.am: Handle Darwin rpaths.
> * Makefile.in: Regenerate.
> * configure: Regenerate.
> * configure.ac: Handle Darwin rpaths.
>
> libobjc/ChangeLog:
>
> * configure: Regenerate.
> * configure.ac: Handle Darwin rpaths.
>
> libphobos/ChangeLog:
>
> * configure: Regenerate.
> * configure.ac: Handle Darwin rpaths.
> * libdruntime/Makefile.am: Handle Darwin rpaths.
> * libdruntime/Makefile.in: Regenerate.
> * src/Makefile.am: Handle Darwin rpaths.
> * src/Makefile.in: Regenerate.
>
> libquadmath/ChangeLog:
>
> * Makefile.am: Handle Darwin rpaths.
> * Makefile.in: Regenerate.
> * configure: Regenerate.
> * configure.ac: Handle Darwin rpaths.
>
> libsanitizer/ChangeLog:
>
> * asan/Makefile.am: Handle Darwin rpaths.
> * asan/Makefile.in: Regenerate.
> * configure: Regenerate.
> * hwasan/Makefile.am: Handle Darwin rpaths.
> * hwasan/Makefile.in: Regenerate.
> * lsan/Makefile.am: Handle Darwin rpaths.
> * lsan/Makefile.in: Regenerate.
> * tsan/Makefile.am: Handle Darwin rpaths.
> * tsan/Makefile.in: Regenerate.
> * ubsan/Makefile.am: Handle Darwin rpaths.
> * ubsan/Makefile.in: Regenerate.
>
> libssp/ChangeLog:
>
> * Makefile.am: Handle Darwin rpaths.
> * Makefile.in: Regenerate.
> * configure: Regenerate.
> * configure.ac: Handle Darwin rpaths.
>
> libstdc++-v3/ChangeLog:
>
> * configure: Regenerate.
> * configure.ac: Handle Darwin rpaths.
> * src/Makefile.am: Handle Darwin rpaths.
> * src/Makefile.in: Regenerate.
>
> libvtv/ChangeLog:
>
> * configure: Regenerate.
> * configure.ac: Handle Darwin rpaths.
>
> lto-plugin/ChangeLog:
> * configure: Regenerate.
> * configure.ac: Handle Darwin rpaths.
>
> zlib/ChangeLog:
> * configure: Regenerate.
> * configure.ac: Handle Darwin rpaths.
^ permalink raw reply [flat|nested] 39+ messages in thread
[parent not found: <653fd72a.050a0220.a6a20.de86SMTPIN_ADDED_BROKEN@mx.google.com>]
* Re: Darwin: Replace environment runpath with embedded [PR88590]
[not found] ` <653fd72a.050a0220.a6a20.de86SMTPIN_ADDED_BROKEN@mx.google.com>
@ 2023-10-30 16:19 ` Iain Sandoe
2023-10-30 16:31 ` FX Coudert
1 sibling, 0 replies; 39+ messages in thread
From: Iain Sandoe @ 2023-10-30 16:19 UTC (permalink / raw)
To: Martin Jambor; +Cc: FX Coudert, GCC Patches
Hi Martin,
> On 30 Oct 2023, at 16:17, Martin Jambor <mjambor@suse.cz> wrote:
> On Tue, Aug 15 2023, FX Coudert via Gcc-patches wrote:
>>
>
> [...]
>
>> From e1cf04cadb9fa065fb3f7d6bccf9ed6f1e9e3fc1 Mon Sep 17 00:00:00 2001
>> From: Iain Sandoe <iain@sandoe.co.uk>
>> Date: Sun, 28 Mar 2021 14:48:17 +0100
>> Subject: [PATCH 2/4] Darwin: Allow for configuring Darwin to use embedded
>> runpath.
>
> our buildbot checker found that after this patch, there is an
> uncommitted auto(re)conf generated hunk in fixincludes/configure:
>
> diff --git a/fixincludes/configure b/fixincludes/configure
> index b9770489adc..1bb547a1724 100755
> --- a/fixincludes/configure
> +++ b/fixincludes/configure
> @@ -3027,6 +3027,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
> # ---------------------------
> # _LT_COMPILER_PIC
>
> +enable_darwin_at_rpath_$1=no
>
> # _LT_LINKER_SHLIBS([TAGNAME])
> # ----------------------------
> @@ -3049,7 +3050,6 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
> # the compiler configuration to `libtool'.
> # _LT_LANG_CXX_CONFIG
>
> -
> # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
> # ---------------------------------
> # Figure out "hidden" library dependencies from verbose
>
>
> Can I commit it (with an appropriate ChangeLog message) or do you want
> to take care of it yourself?
Sorry for the omission, I’ll take care of it later today, thanks for spotting it.
Iain
>
> Thanks,
>
> Martin
>
>
>>
>> Recent Darwin versions place contraints on the use of run paths
>> specified in environment variables. This breaks some assumptions
>> in the GCC build.
>>
>> This change allows the user to configure a Darwin build to use
>> '@rpath/libraryname.dylib' in library names and then to add an
>> embedded runpath to executables (and libraries with dependents).
>>
>> The embedded runpath is added by default unless the user adds
>> '-nodefaultrpaths' to the link line.
>>
>> For an installed compiler, it means that any executable built with
>> that compiler will reference the runtimes installed with the
>> compiler (equivalent to hard-coding the library path into the name
>> of the library).
>>
>> During build-time configurations any "-B" entries will be added to
>> the runpath thus the newly-built libraries will be found by exes.
>>
>> Since the install name is set in libtool, that decision needs to be
>> available here (but might also cause dependent ones in Makefiles,
>> so we need to export a conditional).
>>
>> This facility is not available for Darwin 8 or earlier, however the
>> existing environment variable runpath does work there.
>>
>> We default this on for systems where the external DYLD_LIBRARY_PATH
>> does not work and off for Darwin 8 or earlier. For systems that can
>> use either method, if the value is unset, we use the default (which
>> is currently DYLD_LIBRARY_PATH).
>>
>> ----
>>
>> Ada changes:
>> add paths relative to @loader-path
>>
>> JIT changes:
>>
>> This patch expects DARWIN_RPATH to be computed and available; which
>> means that we will use @rpath or ${libdir} as the name prefix
>> depending on the system version and the setting of
>> --enable-darwin-at-rpath. For branches that do not have this
>> available, the value should be set to ${libdir}.
>>
>> added m2 library changes.
>>
>> ChangeLog:
>>
>> * configure: Regenerate.
>> * configure.ac: Do not add default runpaths to GCC exes
>> when we are building -static-libstdc++/-static-libgcc (the
>> default).
>> * libtool.m4: Add 'enable-darwin-at-runpath'. Act on the
>> enable flag to alter Darwin libraries to use @rpath names.
>>
>> fixincludes/ChangeLog:
>>
>> * configure: Regenerate.
>>
>> gcc/ChangeLog:
>>
>> * aclocal.m4: Regenerate.
>> * configure: Regenerate.
>> * configure.ac: Handle Darwin rpaths.
>> * config/darwin-driver.cc: Handle Darwin rpaths.
>> * config/darwin.h: Handle Darwin rpaths.
>> * config/darwin.opt: Handle Darwin rpaths.
>> * Makefile.in: Handle Darwin rpaths.
>>
>> gcc/ada/ChangeLog:
>>
>> * gcc-interface/Makefile.in: Handle Darwin rpaths.
>>
>> gcc/jit/ChangeLog:
>> * Make-lang.in: Handle Darwin rpaths.
>>
>> libatomic/ChangeLog:
>>
>> * Makefile.am: Handle Darwin rpaths.
>> * Makefile.in: Regenerate.
>> * configure: Regenerate.
>> * configure.ac: Handle Darwin rpaths.
>>
>> libbacktrace/ChangeLog:
>>
>> * configure: Regenerate.
>> * configure.ac: Handle Darwin rpaths.
>>
>> libcc1/ChangeLog:
>>
>> * configure: Regenerate.
>>
>> libffi/ChangeLog:
>>
>> * Makefile.am: Handle Darwin rpaths.
>> * Makefile.in: Regenerate.
>> * configure: Regenerate.
>>
>> libgcc/ChangeLog:
>>
>> * config/t-slibgcc-darwin: Generate libgcc_s
>> with an @rpath name.
>> * config.host: Handle Darwin rpaths.
>>
>> libgfortran/ChangeLog:
>>
>> * Makefile.am: Handle Darwin rpaths.
>> * Makefile.in: Regenerate.
>> * configure: Regenerate.
>> * configure.ac: Handle Darwin rpaths
>>
>> libgm2/ChangeLog:
>>
>> * Makefile.am: Handle Darwin rpaths.
>> * Makefile.in: Regenerate.
>> * aclocal.m4: Regenerate.
>> * configure: Regenerate.
>> * configure.ac: Handle Darwin rpaths.
>> * libm2cor/Makefile.am: Handle Darwin rpaths.
>> * libm2cor/Makefile.in: Regenerate.
>> * libm2iso/Makefile.am: Handle Darwin rpaths.
>> * libm2iso/Makefile.in: Regenerate.
>> * libm2log/Makefile.am: Handle Darwin rpaths.
>> * libm2log/Makefile.in: Regenerate.
>> * libm2min/Makefile.am: Handle Darwin rpaths.
>> * libm2min/Makefile.in: Regenerate.
>> * libm2pim/Makefile.am: Handle Darwin rpaths.
>> * libm2pim/Makefile.in: Regenerate.
>>
>> libgomp/ChangeLog:
>>
>> * Makefile.am: Handle Darwin rpaths.
>> * Makefile.in: Regenerate.
>> * configure: Regenerate.
>> * configure.ac: Handle Darwin rpaths
>>
>> libitm/ChangeLog:
>>
>> * Makefile.am: Handle Darwin rpaths.
>> * Makefile.in: Regenerate.
>> * configure: Regenerate.
>> * configure.ac: Handle Darwin rpaths.
>>
>> libobjc/ChangeLog:
>>
>> * configure: Regenerate.
>> * configure.ac: Handle Darwin rpaths.
>>
>> libphobos/ChangeLog:
>>
>> * configure: Regenerate.
>> * configure.ac: Handle Darwin rpaths.
>> * libdruntime/Makefile.am: Handle Darwin rpaths.
>> * libdruntime/Makefile.in: Regenerate.
>> * src/Makefile.am: Handle Darwin rpaths.
>> * src/Makefile.in: Regenerate.
>>
>> libquadmath/ChangeLog:
>>
>> * Makefile.am: Handle Darwin rpaths.
>> * Makefile.in: Regenerate.
>> * configure: Regenerate.
>> * configure.ac: Handle Darwin rpaths.
>>
>> libsanitizer/ChangeLog:
>>
>> * asan/Makefile.am: Handle Darwin rpaths.
>> * asan/Makefile.in: Regenerate.
>> * configure: Regenerate.
>> * hwasan/Makefile.am: Handle Darwin rpaths.
>> * hwasan/Makefile.in: Regenerate.
>> * lsan/Makefile.am: Handle Darwin rpaths.
>> * lsan/Makefile.in: Regenerate.
>> * tsan/Makefile.am: Handle Darwin rpaths.
>> * tsan/Makefile.in: Regenerate.
>> * ubsan/Makefile.am: Handle Darwin rpaths.
>> * ubsan/Makefile.in: Regenerate.
>>
>> libssp/ChangeLog:
>>
>> * Makefile.am: Handle Darwin rpaths.
>> * Makefile.in: Regenerate.
>> * configure: Regenerate.
>> * configure.ac: Handle Darwin rpaths.
>>
>> libstdc++-v3/ChangeLog:
>>
>> * configure: Regenerate.
>> * configure.ac: Handle Darwin rpaths.
>> * src/Makefile.am: Handle Darwin rpaths.
>> * src/Makefile.in: Regenerate.
>>
>> libvtv/ChangeLog:
>>
>> * configure: Regenerate.
>> * configure.ac: Handle Darwin rpaths.
>>
>> lto-plugin/ChangeLog:
>> * configure: Regenerate.
>> * configure.ac: Handle Darwin rpaths.
>>
>> zlib/ChangeLog:
>> * configure: Regenerate.
>> * configure.ac: Handle Darwin rpaths.
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
[not found] ` <653fd72a.050a0220.a6a20.de86SMTPIN_ADDED_BROKEN@mx.google.com>
2023-10-30 16:19 ` Iain Sandoe
@ 2023-10-30 16:31 ` FX Coudert
2023-10-30 19:08 ` Iain Sandoe
1 sibling, 1 reply; 39+ messages in thread
From: FX Coudert @ 2023-10-30 16:31 UTC (permalink / raw)
To: Martin Jambor; +Cc: Iain Sandoe, gcc-patches
Hi,
> +enable_darwin_at_rpath_$1=no
I actually don’t understand why this one would have $1 in the name, unlike all other regenerated configure files. What value do we expect for $1 at this point in the file? That’s just plain weird.
FX
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-10-30 16:31 ` FX Coudert
@ 2023-10-30 19:08 ` Iain Sandoe
2023-11-15 20:11 ` Thomas Schwinge
0 siblings, 1 reply; 39+ messages in thread
From: Iain Sandoe @ 2023-10-30 19:08 UTC (permalink / raw)
To: GCC Patches; +Cc: Martin Jambor, FX Coudert
Hi Folks
> On 30 Oct 2023, at 16:31, FX Coudert <fxcoudert@gmail.com> wrote:
>
>> +enable_darwin_at_rpath_$1=no
>
> I actually don’t understand why this one would have $1 in the name, unlike all other regenerated configure files. What value do we expect for $1 at this point in the file? That’s just plain weird.
I’ve committed the missing hunk - at least that should appease CI.
Agreed, it is weird, (actually, I’ve never quite understood why fixincludes wants libtool.m4 given that it is host-side and not building any libraries) ..
Iain
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-10-30 19:08 ` Iain Sandoe
@ 2023-11-15 20:11 ` Thomas Schwinge
2023-11-15 20:34 ` FX Coudert
0 siblings, 1 reply; 39+ messages in thread
From: Thomas Schwinge @ 2023-11-15 20:11 UTC (permalink / raw)
To: Iain Sandoe, gcc-patches; +Cc: Martin Jambor, FX Coudert
Hi!
On 2023-10-30T19:08:18+0000, Iain Sandoe <iains.gcc@gmail.com> wrote:
>> On 30 Oct 2023, at 16:31, FX Coudert <fxcoudert@gmail.com> wrote:
>>
>>> +enable_darwin_at_rpath_$1=no
>>
>> I actually don’t understand why this one would have $1 in the name, unlike all other regenerated configure files. What value do we expect for $1 at this point in the file? That’s just plain weird.
>
> I’ve committed the missing hunk - at least that should appease CI.
>
> Agreed, it is weird, (actually, I’ve never quite understood why fixincludes wants libtool.m4 given that it is host-side and not building any libraries) ..
So I currently see the following in my build logs:
[...]
mkdir -p -- ./fixincludes
Configuring in ./fixincludes
configure: creating cache ./config.cache
[...]/source-gcc/fixincludes/configure: line 3030: enable_darwin_at_rpath_--srcdir=[...]/source-gcc/fixincludes=no: No such file or directory
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... nvptx-unknown-none
[...]
I'm not convinced that's achieving what it means to achieve?
Grüße
Thomas
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-11-15 20:11 ` Thomas Schwinge
@ 2023-11-15 20:34 ` FX Coudert
2023-11-17 11:56 ` FX Coudert
0 siblings, 1 reply; 39+ messages in thread
From: FX Coudert @ 2023-11-15 20:34 UTC (permalink / raw)
To: Thomas Schwinge; +Cc: Iain Sandoe, gcc-patches, Martin Jambor
> So I currently see the following in my build logs:
>
> [...]
> mkdir -p -- ./fixincludes
> Configuring in ./fixincludes
> configure: creating cache ./config.cache
> [...]/source-gcc/fixincludes/configure: line 3030: enable_darwin_at_rpath_--srcdir=[...]/source-gcc/fixincludes=no: No such file or directory
> checking build system type... x86_64-pc-linux-gnu
> checking host system type... x86_64-pc-linux-gnu
> checking target system type... nvptx-unknown-none
> [...]
>
> I'm not convinced that's achieving what it means to achieve?
I’ve tried to understand where that line gets expanded from:
>>> +enable_darwin_at_rpath_$1=no
It comes from:
> _LT_TAGVAR(enable_darwin_at_rpath, $1)=no
in the top-level libtool.m4. I can’t say that I understand why that line is there. All the other definitions using this structure are all inside the definition of _LT_ prefixed functions, defined by m4_defun. This one line is alone, outside of any function.
If I remove the line from libtool.m4 (innocent smile) I see that fixincludes/configure is better, and it does not appear to change the regenerated files in other directories (I didn’t do a build yet, just tried to regenerate with some manual autoconf invocations).
Food for thought.
FX
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-11-15 20:34 ` FX Coudert
@ 2023-11-17 11:56 ` FX Coudert
2023-11-17 12:13 ` Thomas Schwinge
0 siblings, 1 reply; 39+ messages in thread
From: FX Coudert @ 2023-11-17 11:56 UTC (permalink / raw)
To: François-Xavier Coudert
Cc: Thomas Schwinge, Iain Sandoe, gcc-patches, Martin Jambor
[-- Attachment #1: Type: text/plain, Size: 873 bytes --]
Hi,
> If I remove the line from libtool.m4 (innocent smile) I see that fixincludes/configure is better, and it does not appear to change the regenerated files in other directories (I didn’t do a build yet, just tried to regenerate with some manual autoconf invocations).
I have done a full rebuild, and having looked more at the structure of libtool.m4 I am now convinced that having that line outside of the scope of _LT_DARWIN_LINKER_FEATURES is simply wrong (probably a copy-pasto or leftover from earlier code).
Having rebuilt everything, it only manifests itself in fixincludes/ChangeLog. Iain is traveling right now, but when he is back I would like to submit this patch if he agrees with the above. It was regtested on x86_64-apple-darwin21.
Thomas, can you confirm that it also fixes things for you? Although I don’t see why it wouldn’t.
FX
[-- Attachment #2: 0001-libsanitizer-fix-build-on-darwin.patch --]
[-- Type: application/octet-stream, Size: 1382 bytes --]
From f135df7c2ccca1982cac6bf1f77317f4b97ab56d Mon Sep 17 00:00:00 2001
From: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Date: Fri, 17 Nov 2023 12:46:09 +0100
Subject: [PATCH] libsanitizer: fix build on darwin
Upstream report of the issue at
https://github.com/llvm/llvm-project/issues/72639
libsanitizer/ChangeLog:
* asan/asan_mac.cpp: Protect Apple blocks behind the
MISSING_BLOCKS_SUPPORT macro.
---
libsanitizer/asan/asan_mac.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libsanitizer/asan/asan_mac.cpp b/libsanitizer/asan/asan_mac.cpp
index 5d5146e0cde..6252fa20d5e 100644
--- a/libsanitizer/asan/asan_mac.cpp
+++ b/libsanitizer/asan/asan_mac.cpp
@@ -139,9 +139,11 @@ typedef void (*dispatch_mach_handler_function_t)(void *context,
dispatch_mach_reason reason,
dispatch_mach_msg_t message,
mach_error_t error);
+#if !defined(MISSING_BLOCKS_SUPPORT)
typedef void (^dispatch_mach_handler_t)(dispatch_mach_reason reason,
dispatch_mach_msg_t message,
mach_error_t error);
+#endif
// A wrapper for the ObjC blocks used to support libdispatch.
typedef struct {
--
2.39.3 (Apple Git-145)
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-11-17 11:56 ` FX Coudert
@ 2023-11-17 12:13 ` Thomas Schwinge
2023-11-17 14:20 ` FX Coudert
0 siblings, 1 reply; 39+ messages in thread
From: Thomas Schwinge @ 2023-11-17 12:13 UTC (permalink / raw)
To: François-Xavier Coudert; +Cc: Iain Sandoe, gcc-patches, Martin Jambor
Hi FX!
On 2023-11-17T12:56:13+0100, FX Coudert <fxcoudert@gmail.com> wrote:
>> If I remove the line from libtool.m4 (innocent smile) I see that fixincludes/configure is better, and it does not appear to change the regenerated files in other directories (I didn’t do a build yet, just tried to regenerate with some manual autoconf invocations).
>
> I have done a full rebuild, and having looked more at the structure of libtool.m4 I am now convinced that having that line outside of the scope of _LT_DARWIN_LINKER_FEATURES is simply wrong (probably a copy-pasto or leftover from earlier code).
Sounds reasonable to me, from the textual description.
> Having rebuilt everything, it only manifests itself in fixincludes/ChangeLog. Iain is traveling right now, but when he is back I would like to submit this patch if he agrees with the above. It was regtested on x86_64-apple-darwin21.
>
> Thomas, can you confirm that it also fixes things for you? Although I don’t see why it wouldn’t.
> Subject: [PATCH] libsanitizer: fix build on darwin
EATTACHEDWRONGPATCH? ;-)
Grüße
Thomas
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-11-17 12:13 ` Thomas Schwinge
@ 2023-11-17 14:20 ` FX Coudert
2023-11-22 10:52 ` Iain Sandoe
0 siblings, 1 reply; 39+ messages in thread
From: FX Coudert @ 2023-11-17 14:20 UTC (permalink / raw)
To: Thomas Schwinge; +Cc: Iain Sandoe, gcc-patches, Martin Jambor
[-- Attachment #1: Type: text/plain, Size: 524 bytes --]
>> I have done a full rebuild, and having looked more at the structure of libtool.m4 I am now convinced that having that line outside of the scope of _LT_DARWIN_LINKER_FEATURES is simply wrong (probably a copy-pasto or leftover from earlier code).
>> Having rebuilt everything, it only manifests itself in fixincludes/ChangeLog. Iain is traveling right now, but when he is back I would like to submit this patch if he agrees with the above. It was regtested on x86_64-apple-darwin21.
With the correct patch attached.
[-- Attachment #2: 0001-Build-fix-error-in-fixinclude-configure.patch --]
[-- Type: application/octet-stream, Size: 1493 bytes --]
From 5394acd8f7c746b264d9b2a7290e4a07f47918cc Mon Sep 17 00:00:00 2001
From: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Date: Fri, 17 Nov 2023 12:50:42 +0100
Subject: [PATCH] Build: fix error in fixinclude configure
The stray line defining enable_darwin_at_rpath outside of the scope of
_LT_DARWIN_LINKER_FEATURES is a mistake and should be removed. It leads
to a wrong line in fixincludes/ChangeLog because there is no $1 argument
at that point.
ChangeLog:
* libtool.m4: Fix stray call
fixincludes/ChangeLog:
* configure: Regenerated.
---
fixincludes/configure | 1 -
libtool.m4 | 1 -
2 files changed, 2 deletions(-)
diff --git a/fixincludes/configure b/fixincludes/configure
index 1bb547a1724..662c94dc112 100755
--- a/fixincludes/configure
+++ b/fixincludes/configure
@@ -3027,7 +3027,6 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# ---------------------------
# _LT_COMPILER_PIC
-enable_darwin_at_rpath_$1=no
# _LT_LINKER_SHLIBS([TAGNAME])
# ----------------------------
diff --git a/libtool.m4 b/libtool.m4
index 7f8ae26db62..add2d4a1e23 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -4312,7 +4312,6 @@ _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
[Compiler flag to prevent dynamic linking])
])# _LT_COMPILER_PIC
-_LT_TAGVAR(enable_darwin_at_rpath, $1)=no
# _LT_LINKER_SHLIBS([TAGNAME])
# ----------------------------
--
2.39.3 (Apple Git-145)
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: Darwin: Replace environment runpath with embedded [PR88590]
2023-11-17 14:20 ` FX Coudert
@ 2023-11-22 10:52 ` Iain Sandoe
2023-11-22 10:55 ` FX Coudert
0 siblings, 1 reply; 39+ messages in thread
From: Iain Sandoe @ 2023-11-22 10:52 UTC (permalink / raw)
To: FX Coudert; +Cc: Thomas Schwinge, GCC Patches, Martin Jambor
Hi FX,
> On 17 Nov 2023, at 14:20, FX Coudert <fxcoudert@gmail.com> wrote:
>
>>> I have done a full rebuild, and having looked more at the structure of libtool.m4 I am now convinced that having that line outside of the scope of _LT_DARWIN_LINKER_FEATURES is simply wrong (probably a copy-pasto or leftover from earlier code).
The latter; my original patch to do this had all the work inside libtool.m4 - but that proved to be unwieldy in practice, so
the eventual patch split the ENABLE_DARWIN_AT_RPATH AM_CONDITIONAL out and applies it (after libtool is
initiallised) in configure.ac cases that need it.
It seems I failed to remove all the old code in that change :(.
>>> Having rebuilt everything, it only manifests itself in fixincludes/ChangeLog. Iain is traveling right now, but when he is back I would like to submit this patch if he agrees with the above. It was regtested on x86_64-apple-darwin21.
I have also regtested on i686, x86_64, aarch64 Darwin, x86_64 and aarch64 Linux.
>
> With the correct patch attached.
I believe this can be applied as a partial reversion of a previously approved patch,
thanks
Iain
>
> <0001-Build-fix-error-in-fixinclude-configure.patch>
^ permalink raw reply [flat|nested] 39+ messages in thread
* gfortran.dg/dg.exp debug messages pollute test output
@ 2023-11-13 15:27 ` Rainer Orth
2023-11-13 16:19 ` Iain Sandoe
0 siblings, 1 reply; 39+ messages in thread
From: Rainer Orth @ 2023-11-13 15:27 UTC (permalink / raw)
To: Iain Sandoe; +Cc: gcc-patches
Hi Iain,
I happened to notice that make check output is cluttered with the likes
of
dg set al -B/var/gcc/regression/master/11.4-gcc/build/i386-pc-solaris2.11/./libatomic/ -B/var/gcc/regression/master/11.4-gcc/build/i386-pc-solaris2.11/./libatomic/.libs ml /var/gcc/regression/master/11.4-gcc/build/i386-pc-solaris2.11/.
revised FFLAGS -pedantic-errors -B/var/gcc/regression/master/11.4-gcc/build/i386-pc-solaris2.11/./libatomic/ -B/var/gcc/regression/master/11.4-gcc/build/i386-pc-solaris2.11/./libatomic/.libs
(quite a number of instances). Those messages are from
gfortran.dg/dg.exp, introduced by your patch
commit a0673ec5f9236dca6ada23f28343c591ccd575e4
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Fri Apr 16 20:01:40 2021 +0100
Testsuite: allow non-installed testing on darwin
I couldn't find any submission for that patch, unfortunately. Besides,
it's unclear if those messages can just be removed (they are pretty
cryptic as is) or at least changed to use verbose instead of puts.
Please fix.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: gfortran.dg/dg.exp debug messages pollute test output
2023-11-13 15:27 ` gfortran.dg/dg.exp debug messages pollute test output Rainer Orth
@ 2023-11-13 16:19 ` Iain Sandoe
2023-11-15 10:29 ` FX Coudert
0 siblings, 1 reply; 39+ messages in thread
From: Iain Sandoe @ 2023-11-13 16:19 UTC (permalink / raw)
To: Rainer Orth; +Cc: GCC Patches, FX Coudert
Hi Rainer,
> On 13 Nov 2023, at 05:27, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>
> I happened to notice that make check output is cluttered with the likes
> of
>
> dg set al -B/var/gcc/regression/master/11.4-gcc/build/i386-pc-solaris2.11/./libatomic/ -B/var/gcc/regression/master/11.4-gcc/build/i386-pc-solaris2.11/./libatomic/.libs ml /var/gcc/regression/master/11.4-gcc/build/i386-pc-solaris2.11/.
> revised FFLAGS -pedantic-errors -B/var/gcc/regression/master/11.4-gcc/build/i386-pc-solaris2.11/./libatomic/ -B/var/gcc/regression/master/11.4-gcc/build/i386-pc-solaris2.11/./libatomic/.libs
>
> (quite a number of instances). Those messages are from
> gfortran.dg/dg.exp, introduced by your patch
>
> commit a0673ec5f9236dca6ada23f28343c591ccd575e4
> Author: Iain Sandoe <iain@sandoe.co.uk>
> Date: Fri Apr 16 20:01:40 2021 +0100
>
> Testsuite: allow non-installed testing on darwin
>
> I couldn't find any submission for that patch, unfortunately.
FX submitted the patch series, I can find the reference if you need it.
> Besides,
> it's unclear if those messages can just be removed (they are pretty
> cryptic as is) or at least changed to use verbose instead of puts.
> Please fix.
will do.
thanks
Iain
>
> Rainer
>
> --
> -----------------------------------------------------------------------------
> Rainer Orth, Center for Biotechnology, Bielefeld University
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: gfortran.dg/dg.exp debug messages pollute test output
2023-11-13 16:19 ` Iain Sandoe
@ 2023-11-15 10:29 ` FX Coudert
2023-11-15 12:04 ` Rainer Orth
2023-11-17 12:36 ` Thomas Schwinge
0 siblings, 2 replies; 39+ messages in thread
From: FX Coudert @ 2023-11-15 10:29 UTC (permalink / raw)
To: Iain Sandoe; +Cc: Rainer Orth, GCC Patches
[-- Attachment #1: Type: text/plain, Size: 595 bytes --]
> FX submitted the patch series, I can find the reference if you need it.
Patch was submitted in this thread: https://gcc.gnu.org/pipermail/gcc-patches/2023-September/630096.html
>> Besides,
>> it's unclear if those messages can just be removed (they are pretty
>> cryptic as is) or at least changed to use verbose instead of puts.
>> Please fix.
I don’t see value in this output, so I think it’s best to remove the puts calls entirely. Attached patch does that.
Testing under progress, OK if it passes? (or does that count as obvious fix-up of the previous patch)
FX
[-- Attachment #2: 0001-Testsuite-silence-some-noise-in-output.patch --]
[-- Type: application/octet-stream, Size: 1827 bytes --]
From 93941219b8dc0f3f855c0d253b7102688f60d067 Mon Sep 17 00:00:00 2001
From: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Date: Wed, 15 Nov 2023 11:22:37 +0100
Subject: [PATCH] Testsuite: silence some noise in output
We introduced in commit a0673ec5f9236dca6ada23f28343c591ccd575e4
some noisy messages, which clutter output with things like:
dg set al ...
revised FFLAGS ...
and are not really useful information. Let's remove them.
gcc/testsuite/ChangeLog:
* gfortran.dg/coarray/caf.exp: Remove some output.
* gfortran.dg/dg.exp: Remove some output.
---
gcc/testsuite/gfortran.dg/coarray/caf.exp | 1 -
gcc/testsuite/gfortran.dg/dg.exp | 3 ---
2 files changed, 4 deletions(-)
diff --git a/gcc/testsuite/gfortran.dg/coarray/caf.exp b/gcc/testsuite/gfortran.dg/coarray/caf.exp
index a10b17a78d0..fab8238a0d5 100644
--- a/gcc/testsuite/gfortran.dg/coarray/caf.exp
+++ b/gcc/testsuite/gfortran.dg/coarray/caf.exp
@@ -81,7 +81,6 @@ if [check_effective_target_libatomic_available] {
}
}
set t [get_multilibs]
- puts "maybe al $maybe_atomic_lib ml $t"
}
# Main loop.
diff --git a/gcc/testsuite/gfortran.dg/dg.exp b/gcc/testsuite/gfortran.dg/dg.exp
index 73541ea7301..22f2ffb405f 100644
--- a/gcc/testsuite/gfortran.dg/dg.exp
+++ b/gcc/testsuite/gfortran.dg/dg.exp
@@ -68,7 +68,6 @@ if [check_effective_target_libatomic_available] {
set maybe_atomic_lib ""
}
set t [get_multilibs]
- puts "dg set al $maybe_atomic_lib ml $t"
}
set all_flags $DEFAULT_FFLAGS
@@ -78,8 +77,6 @@ if { $maybe_atomic_lib != "" } {
}
}
-puts "revised FFLAGS $all_flags"
-
# Main loop.
gfortran-dg-runtest [lsort \
[glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ] ] "" $all_flags
--
2.39.3 (Apple Git-145)
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: gfortran.dg/dg.exp debug messages pollute test output
2023-11-15 10:29 ` FX Coudert
@ 2023-11-15 12:04 ` Rainer Orth
2023-11-17 12:36 ` Thomas Schwinge
1 sibling, 0 replies; 39+ messages in thread
From: Rainer Orth @ 2023-11-15 12:04 UTC (permalink / raw)
To: FX Coudert; +Cc: Iain Sandoe, GCC Patches
Hi FX,
>> FX submitted the patch series, I can find the reference if you need it.
>
> Patch was submitted in this thread:
> https://gcc.gnu.org/pipermail/gcc-patches/2023-September/630096.html
ah, I see. I'd been looking for the patch summary and Iain's name in my
searches; that's why I came up blank.
>>> Besides,
>>> it's unclear if those messages can just be removed (they are pretty
>>> cryptic as is) or at least changed to use verbose instead of puts.
>>> Please fix.
>
> I don’t see value in this output, so I think it’s best to remove the puts
> calls entirely. Attached patch does that.
> Testing under progress, OK if it passes? (or does that count as obvious
> fix-up of the previous patch)
Ok for trunk. However, this perfectly fits the obvious criteria, too.
Thanks.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: gfortran.dg/dg.exp debug messages pollute test output
2023-11-15 10:29 ` FX Coudert
2023-11-15 12:04 ` Rainer Orth
@ 2023-11-17 12:36 ` Thomas Schwinge
2023-11-18 9:03 ` FX Coudert
1 sibling, 1 reply; 39+ messages in thread
From: Thomas Schwinge @ 2023-11-17 12:36 UTC (permalink / raw)
To: FX Coudert, Iain Sandoe; +Cc: Rainer Orth, gcc-patches
Hi!
On 2023-11-15T11:29:20+0100, FX Coudert <fxcoudert@gmail.com> wrote:
>>> it's unclear if those messages can just be removed (they are pretty
>>> cryptic as is) or at least changed to use verbose instead of puts.
>>> Please fix.
>
> I don’t see value in this output, so I think it’s best to remove the puts calls entirely.
ACK, I'd noticed that, too.
> Attached patch does that.
> --- a/gcc/testsuite/gfortran.dg/coarray/caf.exp
> +++ b/gcc/testsuite/gfortran.dg/coarray/caf.exp
> @@ -81,7 +81,6 @@ if [check_effective_target_libatomic_available] {
> }
> }
> set t [get_multilibs]
> - puts "maybe al $maybe_atomic_lib ml $t"
> }
I suppose 'set t [...]' can be let go, too?
> --- a/gcc/testsuite/gfortran.dg/dg.exp
> +++ b/gcc/testsuite/gfortran.dg/dg.exp
> @@ -68,7 +68,6 @@ if [check_effective_target_libatomic_available] {
> set maybe_atomic_lib ""
> }
> set t [get_multilibs]
> - puts "dg set al $maybe_atomic_lib ml $t"
> }
Likewise.
Grüße
Thomas
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: gfortran.dg/dg.exp debug messages pollute test output
2023-11-17 12:36 ` Thomas Schwinge
@ 2023-11-18 9:03 ` FX Coudert
0 siblings, 0 replies; 39+ messages in thread
From: FX Coudert @ 2023-11-18 9:03 UTC (permalink / raw)
To: Thomas Schwinge; +Cc: Iain Sandoe, Rainer Orth, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 100 bytes --]
> I suppose 'set t [...]' can be let go, too?
Duh (x2).
Pushed, on top of the previous patch.
FX
[-- Attachment #2: 0001-Testsuite-remove-unused-variables.patch --]
[-- Type: application/octet-stream, Size: 1437 bytes --]
From f76d47e6bcd2c196bb525eead7e01688e1a732a9 Mon Sep 17 00:00:00 2001
From: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Date: Sat, 18 Nov 2023 10:01:14 +0100
Subject: [PATCH] Testsuite: remove unused variables
Missing from earlier commit, which removed the only use of those two
variables.
gcc/testsuite/ChangeLog:
* gfortran.dg/coarray/caf.exp: Remove unused variable.
* gfortran.dg/dg.exp: Remove unused variable.
---
gcc/testsuite/gfortran.dg/coarray/caf.exp | 1 -
gcc/testsuite/gfortran.dg/dg.exp | 1 -
2 files changed, 2 deletions(-)
diff --git a/gcc/testsuite/gfortran.dg/coarray/caf.exp b/gcc/testsuite/gfortran.dg/coarray/caf.exp
index fab8238a0d5..c626265e7b2 100644
--- a/gcc/testsuite/gfortran.dg/coarray/caf.exp
+++ b/gcc/testsuite/gfortran.dg/coarray/caf.exp
@@ -80,7 +80,6 @@ if [check_effective_target_libatomic_available] {
set maybe_atomic_lib "[atomic_link_flags [get_multilibs]]"
}
}
- set t [get_multilibs]
}
# Main loop.
diff --git a/gcc/testsuite/gfortran.dg/dg.exp b/gcc/testsuite/gfortran.dg/dg.exp
index 22f2ffb405f..253c0f5ec6a 100644
--- a/gcc/testsuite/gfortran.dg/dg.exp
+++ b/gcc/testsuite/gfortran.dg/dg.exp
@@ -67,7 +67,6 @@ if [check_effective_target_libatomic_available] {
} else {
set maybe_atomic_lib ""
}
- set t [get_multilibs]
}
set all_flags $DEFAULT_FFLAGS
--
2.39.3 (Apple Git-145)
^ permalink raw reply [flat|nested] 39+ messages in thread
end of thread, other threads:[~2023-11-30 21:25 UTC | newest]
Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-15 16:58 Darwin: Replace environment runpath with embedded [PR88590] FX Coudert
2023-08-18 20:17 ` Joseph Myers
2023-08-18 22:31 ` Iain Sandoe
2023-08-18 22:59 ` Joseph Myers
2023-08-18 23:05 ` Iain Sandoe
2023-08-25 7:50 ` FX Coudert
2023-08-25 16:28 ` Joseph Myers
2023-08-29 16:06 ` FX Coudert
2023-08-29 19:55 ` Joseph Myers
2023-08-29 20:17 ` FX Coudert
2023-09-12 17:52 ` FX Coudert
2023-09-20 13:52 ` FX Coudert
2023-10-08 13:07 ` Nathanael Nerode
2023-10-08 22:14 ` Iain Sandoe
2023-10-21 18:05 ` Jeff Law
2023-10-21 18:26 ` Iain Sandoe
2023-10-21 5:27 ` Alexandre Oliva
2023-10-22 21:18 ` FX Coudert
2023-11-30 19:43 ` Ian Lance Taylor
2023-11-30 19:56 ` Iain Sandoe
2023-11-30 19:58 ` Ian Lance Taylor
2023-11-30 21:25 ` Ian Lance Taylor
2023-10-30 16:17 ` Martin Jambor
[not found] ` <653fd72a.050a0220.a6a20.de86SMTPIN_ADDED_BROKEN@mx.google.com>
2023-10-30 16:19 ` Iain Sandoe
2023-10-30 16:31 ` FX Coudert
2023-10-30 19:08 ` Iain Sandoe
2023-11-15 20:11 ` Thomas Schwinge
2023-11-15 20:34 ` FX Coudert
2023-11-17 11:56 ` FX Coudert
2023-11-17 12:13 ` Thomas Schwinge
2023-11-17 14:20 ` FX Coudert
2023-11-22 10:52 ` Iain Sandoe
2023-11-22 10:55 ` FX Coudert
2023-11-13 15:27 ` gfortran.dg/dg.exp debug messages pollute test output Rainer Orth
2023-11-13 16:19 ` Iain Sandoe
2023-11-15 10:29 ` FX Coudert
2023-11-15 12:04 ` Rainer Orth
2023-11-17 12:36 ` Thomas Schwinge
2023-11-18 9:03 ` FX Coudert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).