aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2021-03-28 14:48:17 +0100
committerIain Sandoe <iain@sandoe.co.uk>2023-10-22 19:30:02 +0100
commit6a6d3817afa02bbcd2388c8e005da6faf88932f1 (patch)
treef5997d899baddd1788da7a28f48bfbaa278355f9
parent829b0c4cbabbe5056b79a8a1ec4cd9e9d928a5fb (diff)
Config,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.
-rwxr-xr-xconfigure14
-rw-r--r--configure.ac14
-rw-r--r--gcc/Makefile.in11
-rw-r--r--gcc/aclocal.m450
-rw-r--r--gcc/ada/gcc-interface/Makefile.in5
-rw-r--r--gcc/config/darwin.h32
-rw-r--r--gcc/config/darwin.opt4
-rwxr-xr-xgcc/configure133
-rw-r--r--gcc/configure.ac2
-rw-r--r--gcc/jit/Make-lang.in2
-rw-r--r--libatomic/Makefile.am7
-rw-r--r--libatomic/Makefile.in7
-rwxr-xr-xlibatomic/configure76
-rw-r--r--libatomic/configure.ac2
-rwxr-xr-xlibbacktrace/configure76
-rw-r--r--libbacktrace/configure.ac2
-rwxr-xr-xlibcc1/configure118
-rw-r--r--libffi/Makefile.am7
-rw-r--r--libffi/Makefile.in6
-rwxr-xr-xlibffi/configure132
-rw-r--r--libffi/configure.ac1
-rw-r--r--libffi/doc/version.texi4
-rw-r--r--libgcc/config.host23
-rw-r--r--libgcc/config/t-darwin-rpath2
-rw-r--r--libgcc/config/t-slibgcc-darwin28
-rw-r--r--libgfortran/Makefile.am7
-rw-r--r--libgfortran/Makefile.in28
-rwxr-xr-xlibgfortran/configure131
-rw-r--r--libgfortran/configure.ac6
-rw-r--r--libgm2/Makefile.am9
-rw-r--r--libgm2/Makefile.in15
-rw-r--r--libgm2/aclocal.m410
-rwxr-xr-xlibgm2/configure145
-rw-r--r--libgm2/configure.ac6
-rw-r--r--libgm2/libm2cor/Makefile.am4
-rw-r--r--libgm2/libm2cor/Makefile.in17
-rw-r--r--libgm2/libm2iso/Makefile.am4
-rw-r--r--libgm2/libm2iso/Makefile.in17
-rw-r--r--libgm2/libm2log/Makefile.am3
-rw-r--r--libgm2/libm2log/Makefile.in17
-rw-r--r--libgm2/libm2min/Makefile.am3
-rw-r--r--libgm2/libm2min/Makefile.in17
-rw-r--r--libgm2/libm2pim/Makefile.am3
-rw-r--r--libgm2/libm2pim/Makefile.in17
-rwxr-xr-xlibgo/configure18
-rw-r--r--libgo/configure.ac1
-rw-r--r--libgomp/Makefile.am7
-rw-r--r--libgomp/Makefile.in5
-rwxr-xr-xlibgomp/configure126
-rw-r--r--libgomp/configure.ac1
-rw-r--r--libitm/Makefile.am7
-rw-r--r--libitm/Makefile.in7
-rwxr-xr-xlibitm/configure132
-rw-r--r--libitm/configure.ac1
-rwxr-xr-xlibobjc/configure112
-rw-r--r--libobjc/configure.ac36
-rwxr-xr-xlibphobos/configure126
-rw-r--r--libphobos/configure.ac1
-rw-r--r--libphobos/libdruntime/Makefile.am5
-rw-r--r--libphobos/libdruntime/Makefile.in3
-rw-r--r--libphobos/src/Makefile.am5
-rw-r--r--libphobos/src/Makefile.in3
-rw-r--r--libquadmath/Makefile.am7
-rw-r--r--libquadmath/Makefile.in5
-rwxr-xr-xlibquadmath/configure218
-rw-r--r--libquadmath/configure.ac3
-rw-r--r--libsanitizer/asan/Makefile.am7
-rw-r--r--libsanitizer/asan/Makefile.in7
-rwxr-xr-xlibsanitizer/configure133
-rw-r--r--libsanitizer/configure.ac2
-rw-r--r--libsanitizer/hwasan/Makefile.am6
-rw-r--r--libsanitizer/hwasan/Makefile.in5
-rw-r--r--libsanitizer/lsan/Makefile.am8
-rw-r--r--libsanitizer/lsan/Makefile.in8
-rw-r--r--libsanitizer/tsan/Makefile.am6
-rw-r--r--libsanitizer/tsan/Makefile.in5
-rw-r--r--libsanitizer/ubsan/Makefile.am7
-rw-r--r--libsanitizer/ubsan/Makefile.in7
-rw-r--r--libssp/Makefile.am6
-rw-r--r--libssp/Makefile.in5
-rwxr-xr-xlibssp/configure76
-rw-r--r--libssp/configure.ac2
-rwxr-xr-xlibstdc++-v3/configure144
-rw-r--r--libstdc++-v3/configure.ac1
-rw-r--r--libstdc++-v3/src/Makefile.am7
-rw-r--r--libstdc++-v3/src/Makefile.in5
-rw-r--r--libtool.m457
-rwxr-xr-xlibvtv/configure132
-rw-r--r--libvtv/configure.ac1
-rwxr-xr-xlto-plugin/configure75
-rw-r--r--lto-plugin/configure.ac1
-rwxr-xr-xzlib/configure75
-rw-r--r--zlib/configure.ac1
93 files changed, 2556 insertions, 279 deletions
diff --git a/configure b/configure
index 8fc163d36bd..18fc7d6c468 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 1d16530140a..692dc716343 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 a25a1e32fbc..bc6a76f8644 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1198,6 +1198,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.
@@ -2027,9 +2029,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 2ee66c1a3d1..ae7d5c65d15 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 %<force_cpusubtype_ALL %<multiply_defined* %<dynamiclib"
+/* 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 9f5b7081992..13085f39f0e 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -744,6 +744,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
@@ -1009,6 +1011,7 @@ enable_static
with_pic
enable_fast_install
enable_libtool_lock
+enable_darwin_at_rpath
enable_ld
enable_gold
with_plugin_ld
@@ -1744,6 +1747,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
@@ -16393,7 +16399,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'
@@ -18098,6 +18104,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
@@ -18115,9 +18164,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
@@ -19923,7 +19976,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19926 "configure"
+#line 19979 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -20029,7 +20082,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 20032 "configure"
+#line 20085 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -20905,6 +20958,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
@@ -20922,12 +21018,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
@@ -23298,6 +23402,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.
@@ -32995,6 +33108,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 c10e007f9bf..0ac589a64ae 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2632,6 +2632,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 a676b2f8980..6afe8e56f7e 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 de060aaccba..d2eadfc51aa 100644
--- a/libgm2/Makefile.am
+++ b/libgm2/Makefile.am
@@ -48,6 +48,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.
@@ -95,7 +101,8 @@ AM_MAKEFLAGS = \
"TARGET_LIB_PATH=$(TARGET_LIB_PATH)" \
"TARGET_LIB_PATH_libgm2=$(TARGET_LIB_PATH_libgm2)" \
"TARGET_LONGDOUBLE_ABI=$(TARGET_LONGDOUBLE_ABI)" \
- "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 0900c027faa..47fbf6915a3 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 \
@@ -344,6 +344,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
@@ -392,7 +394,8 @@ AM_MAKEFLAGS = \
"TARGET_LIB_PATH=$(TARGET_LIB_PATH)" \
"TARGET_LIB_PATH_libgm2=$(TARGET_LIB_PATH_libgm2)" \
"TARGET_LONGDOUBLE_ABI=$(TARGET_LONGDOUBLE_ABI)" \
- "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 4c36c549d3e..a515bd2c886 100644
--- a/libgm2/libm2cor/Makefile.am
+++ b/libgm2/libm2cor/Makefile.am
@@ -129,6 +129,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 eaf980e3c48..449a26bc2ad 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
@@ -475,8 +476,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_CORLIB_TRUE@ -fm2-g -g -Wcase-enum -Wreturn-type -fcase -fm2-prefix=m2cor \
@BUILD_CORLIB_TRUE@ $(TARGET_LONGDOUBLE_ABI)
-@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 933f6949879..ddd24629849 100644
--- a/libgm2/libm2iso/Makefile.am
+++ b/libgm2/libm2iso/Makefile.am
@@ -203,6 +203,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 b150c691946..6700664cb07 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
@@ -576,8 +577,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_ISOLIB_TRUE@ -fiso -fextended-opaque -fm2-g -g -Wcase-enum -Wreturn-type -fcase -fm2-prefix=m2iso \
@BUILD_ISOLIB_TRUE@ $(TARGET_LONGDOUBLE_ABI)
-@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 a95e5c8f939..9571d50585c 100644
--- a/libgm2/libm2log/Makefile.am
+++ b/libgm2/libm2log/Makefile.am
@@ -144,6 +144,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 4e5580d6393..9b9b416bd1a 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
@@ -479,8 +480,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_LOGLIB_TRUE@ -Wcase-enum -Wreturn-type -fcase -fm2-prefix=m2log \
@BUILD_LOGLIB_TRUE@ $(TARGET_LONGDOUBLE_ABI)
-@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 8caaf7aac88..ab627e88222 100644
--- a/libgm2/libm2min/Makefile.am
+++ b/libgm2/libm2min/Makefile.am
@@ -115,6 +115,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 790cfb3cb0f..4a909c7cd27 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
@@ -443,8 +444,10 @@ libm2min_la_M2FLAGS = \
-fno-m2-plugin -fno-scaffold-dynamic -fno-scaffold-main -fm2-prefix=m2min \
$(TARGET_LONGDOUBLE_ABI)
-@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 f940dd29aa6..dd1fd08e90e 100644
--- a/libgm2/libm2pim/Makefile.am
+++ b/libgm2/libm2pim/Makefile.am
@@ -180,6 +180,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 5fc026ebcb2..e64722e5c52 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
@@ -544,8 +545,10 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@BUILD_PIMLIB_TRUE@ -fm2-g -g -Wcase-enum -Wreturn-type -fcase -fm2-prefix=m2pim \
@BUILD_PIMLIB_TRUE@ $(TARGET_LONGDOUBLE_ABI)
-@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 2f1609b42b5..db89eae2a4f 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -709,6 +709,8 @@ glibgo_toolexecdir
WERROR
WARN_FLAGS
CC_FOR_BUILD
+ENABLE_DARWIN_AT_RPATH_FALSE
+ENABLE_DARWIN_AT_RPATH_TRUE
enable_static
enable_shared
CPP
@@ -11545,7 +11547,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11548 "configure"
+#line 11550 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11651,7 +11653,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11654 "configure"
+#line 11656 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13780,6 +13782,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}
@@ -16389,6 +16399,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 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)
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 431bc87b629..186937da4e9 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 498bc084a86..c69a13cfe14 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -683,6 +683,8 @@ FC
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
@@ -13458,6 +13519,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
@@ -13475,9 +13579,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
@@ -17121,6 +17229,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 49f7fb0dc82..a42e26771b4 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 0aefbf22ca6..f57c640f363 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 39066dd33cc..363a4a09aa1 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 13fc03b2a3f..9f12c5baa3f 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; };
@@ -75218,6 +75330,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 b3991ccab48..c8b36333019 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 32de5304122..706c05ef812 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -154,8 +154,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 c5d01e7beba..31819c93450 100644
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -562,8 +562,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.