From 535a2f96387b68255142a2624017d38d7cb8ed9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Sun, 29 Sep 2024 21:51:07 +0200 Subject: [PATCH] bundle_loader? --- build-aux/subst-config-vals.in.sh | 10 ++++++---- build-aux/subst-cross-config-vals.in.sh | 10 ++++++---- configure.ac | 13 ++++++++++++- m4/acinclude.m4 | 6 +++--- src/mkoctfile.in.cc | 9 ++++++--- test/mex/module.mk | 1 + 6 files changed, 34 insertions(+), 15 deletions(-) diff --git a/build-aux/subst-config-vals.in.sh b/build-aux/subst-config-vals.in.sh index 1b52cae23e..a172fc4a64 100644 --- a/build-aux/subst-config-vals.in.sh +++ b/build-aux/subst-config-vals.in.sh @@ -87,6 +87,8 @@ if [ "x@OCTAVE_RELOCATE_ALL@" = "xyes" ]; then flibs=`echo '@FLIBS@' | $SED "s|@prefix@|\$\{prefix\}|g" | $SED 's|\"|\\\\\\\"|g'` ldflags=`echo '@LDFLAGS@' | $SED "s|@prefix@|\$\{prefix\}|g" | $SED 's|\"|\\\\\\\"|g'` oct_link_opts=`echo '@OCT_LINK_OPTS@' | $SED "s|@prefix@|\$\{prefix\}|g" | $SED 's|\"|\\\\\\\"|g'` + mkoctfile_octave_link_deps=`echo '@MKOCTFILE_OCTAVE_LINK_DEPS@' | $SED "s|@prefix@|\$\{prefix\}|g" | $SED 's|\"|\\\\\\\"|g'` + mkoctfile_oct_link_deps=`echo '@MKOCTFILE_OCT_LINK_DEPS@' | $SED "s|@prefix@|\$\{prefix\}|g" | $SED 's|\"|\\\\\\\"|g'` else cppflags=`echo '@CPPFLAGS@' | $SED 's|\"|\\\\\\\"|g'` fftw3f_ldflags=`echo '@FFTW3F_LDFLAGS@' | $SED 's|\"|\\\\\\\"|g'` @@ -94,6 +96,8 @@ else flibs=`echo '@FLIBS@' | $SED 's|\"|\\\\\\\"|g'` ldflags=`echo '@LDFLAGS@' | $SED 's|\"|\\\\\\\"|g'` oct_link_opts=`echo '@OCT_LINK_OPTS@' | $SED 's|\"|\\\\\\\"|g'` + mkoctfile_octave_link_deps=`echo '@MKOCTFILE_OCTAVE_LINK_DEPS@' | $SED 's|\"|\\\\\\\"|g'` + mkoctfile_oct_link_deps=`echo '@MKOCTFILE_OCT_LINK_DEPS@' | $SED 's|\"|\\\\\\\"|g'` fi @@ -190,8 +194,6 @@ MKOCTFILE_CXX="@MKOCTFILE_CXX@" MKOCTFILE_DL_LDFLAGS="@MKOCTFILE_DL_LDFLAGS@" MKOCTFILE_F77="@MKOCTFILE_F77@" MKOCTFILE_RANLIB="@MKOCTFILE_RANLIB@" -MKOCTFILE_OCTAVE_LINK_DEPS="@MKOCTFILE_OCTAVE_LINK_DEPS@" -MKOCTFILE_OCT_LINK_DEPS="@MKOCTFILE_OCT_LINK_DEPS@" OCTAVE_LINK_DEPS="@OCTAVE_LINK_DEPS@" OCTAVE_LINK_OPTS="@OCTAVE_LINK_OPTS@" OCT_LINK_DEPS="@OCT_LINK_DEPS@" @@ -346,8 +348,8 @@ $SED \ -e "s|%OCTAVE_CONF_MKOCTFILE_CXX%|\"${MKOCTFILE_CXX}\"|" \ -e "s|%OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS%|\"${MKOCTFILE_DL_LDFLAGS}\"|" \ -e "s|%OCTAVE_CONF_MKOCTFILE_F77%|\"${MKOCTFILE_F77}\"|" \ - -e "s|%OCTAVE_CONF_MKOCTFILE_OCTAVE_LINK_DEPS%|\"${MKOCTFILE_OCTAVE_LINK_DEPS}\"|" \ - -e "s|%OCTAVE_CONF_MKOCTFILE_OCT_LINK_DEPS%|\"${MKOCTFILE_OCT_LINK_DEPS}\"|" \ + -e "s|%OCTAVE_CONF_MKOCTFILE_OCTAVE_LINK_DEPS%|\"${mkoctfile_octave_link_deps}\"|" \ + -e "s|%OCTAVE_CONF_MKOCTFILE_OCT_LINK_DEPS%|\"${mkoctfile_oct_link_deps}\"|" \ -e "s|%OCTAVE_CONF_MKOCTFILE_RANLIB%|\"${MKOCTFILE_RANLIB}\"|" \ -e "s|%OCTAVE_CONF_OCTAVE_LINK_DEPS%|\"${OCTAVE_LINK_DEPS}\"|" \ -e "s|%OCTAVE_CONF_OCTAVE_LINK_OPTS%|\"${OCTAVE_LINK_OPTS}\"|" \ diff --git a/build-aux/subst-cross-config-vals.in.sh b/build-aux/subst-cross-config-vals.in.sh index f263511eaa..a09cbe66a9 100644 --- a/build-aux/subst-cross-config-vals.in.sh +++ b/build-aux/subst-cross-config-vals.in.sh @@ -97,6 +97,8 @@ if [ "x@OCTAVE_RELOCATE_ALL@" = "xyes" ]; then flibs=`echo '@FLIBS@' | $SED "s|@prefix@|\$\{prefix\}|g" | $SED 's|\"|\\\\\\\"|g'` ldflags=`echo '@LDFLAGS@' | $SED "s|@prefix@|\$\{prefix\}|g" | $SED 's|\"|\\\\\\\"|g'` oct_link_opts=`echo '@OCT_LINK_OPTS@' | $SED "s|@prefix@|\$\{prefix\}|g" | $SED 's|\"|\\\\\\\"|g'` + mkoctfile_octave_link_deps=`echo '@MKOCTFILE_OCTAVE_LINK_DEPS@' | $SED "s|@prefix@|\$\{prefix\}|g" | $SED 's|\"|\\\\\\\"|g'` + mkoctfile_oct_link_deps=`echo '@MKOCTFILE_OCT_LINK_DEPS@' | $SED "s|@prefix@|\$\{prefix\}|g" | $SED 's|\"|\\\\\\\"|g'` else cppflags=`echo '@CPPFLAGS@' | $SED 's|\"|\\\\\\\"|g'` fftw3f_ldflags=`echo '@FFTW3F_LDFLAGS@' | $SED 's|\"|\\\\\\\"|g'` @@ -104,6 +106,8 @@ else flibs=`echo '@FLIBS@' | $SED 's|\"|\\\\\\\"|g'` ldflags=`echo '@LDFLAGS@' | $SED 's|\"|\\\\\\\"|g'` oct_link_opts=`echo '@OCT_LINK_OPTS@' | $SED 's|\"|\\\\\\\"|g'` + mkoctfile_octave_link_deps=`echo '@MKOCTFILE_OCTAVE_LINK_DEPS@' | $SED 's|\"|\\\\\\\"|g'` + mkoctfile_oct_link_deps=`echo '@MKOCTFILE_OCT_LINK_DEPS@' | $SED 's|\"|\\\\\\\"|g'` fi @@ -194,8 +198,6 @@ LN_S="@LN_S@" MAGICK_CPPFLAGS="@MAGICK_CPPFLAGS@" MAGICK_LDFLAGS="@MAGICK_LDFLAGS@" MAGICK_LIBS="@MAGICK_LIBS@" -MKOCTFILE_OCTAVE_LINK_DEPS="@MKOCTFILE_OCTAVE_LINK_DEPS@" -MKOCTFILE_OCT_LINK_DEPS="@MKOCTFILE_OCT_LINK_DEPS@" OCTAVE_LINK_DEPS="@OCTAVE_LINK_DEPS@" OCTAVE_LINK_OPTS="@OCTAVE_LINK_OPTS@" OCT_LINK_DEPS="@OCT_LINK_DEPS@" @@ -350,8 +352,8 @@ $SED \ -e "s|%OCTAVE_CONF_MKOCTFILE_CXX%|\"${CXX}\"|" \ -e "s|%OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS%|\"${DL_LDFLAGS}\"|" \ -e "s|%OCTAVE_CONF_MKOCTFILE_F77%|\"${F77}\"|" \ - -e "s|%OCTAVE_CONF_MKOCTFILE_OCTAVE_LINK_DEPS%|\"${MKOCTFILE_OCTAVE_LINK_DEPS}\"|" \ - -e "s|%OCTAVE_CONF_MKOCTFILE_OCT_LINK_DEPS%|\"${MKOCTFILE_OCT_LINK_DEPS}\"|" \ + -e "s|%OCTAVE_CONF_MKOCTFILE_OCTAVE_LINK_DEPS%|\"${mkoctfile_octave_link_deps}\"|" \ + -e "s|%OCTAVE_CONF_MKOCTFILE_OCT_LINK_DEPS%|\"${mkoctfile_oct_link_deps}\"|" \ -e "s|%OCTAVE_CONF_MKOCTFILE_RANLIB%|\"${RANLIB}\"|" \ -e "s|%OCTAVE_CONF_OCTAVE_LINK_DEPS%|\"${OCTAVE_LINK_DEPS}\"|" \ -e "s|%OCTAVE_CONF_OCTAVE_LINK_OPTS%|\"${OCTAVE_LINK_OPTS}\"|" \ diff --git a/configure.ac b/configure.ac index 2aba86f637..b079441d76 100644 --- a/configure.ac +++ b/configure.ac @@ -3048,10 +3048,21 @@ if test $link_all_deps = yes; then AC_DEFINE(OCTAVE_LINK_ALL_DEPS, 1, [Link with all dependencies.]) OCT_LINK_DEPS="libinterp/liboctinterp.la liboctave/liboctave.la" - OCT_GUI_LINK_DEPS="libgui/liboctgui.la libinterp/liboctinterp.la liboctave/liboctave.la" + case $canonical_host_type in + *-*-darwin*) + OCT_LINK_DEPS="$OCT_LINK_DEPS -bundle_loader ${abs_top_builddir}/src/octave${EXEEXT}" + ;; + esac + OCT_GUI_LINK_DEPS="libgui/liboctgui.la $OCT_LINK_DEPS" MKOCTFILE_OCTAVE_LINK_DEPS="$LIBOCTINTERP_LINK_DEPS $MKOCTFILE_LIBOCTAVE_LINK_DEPS" MKOCTFILE_OCT_LINK_DEPS="$LIBOCTINTERP $LIBOCTAVE" + case $canonical_host_type in + *-*-darwin*) + MKOCTFILE_OCTAVE_LINK_DEPS="$MKOCTFILE_OCTAVE_LINK_DEPS "'-bundle_loader ${bindir}/octave-${version}'"${EXEEXT}" + MKOCTFILE_OCT_LINK_DEPS="$MKOCTFILE_OCT_LINK_DEPS "'-bundle_loader ${bindir}/octave-${version}'"${EXEEXT}" + ;; + esac LIBOCTINTERP_LINK_DEPS="$LIBOCTINTERP_LINK_DEPS $LIBOCTAVE_LINK_DEPS" LIBOCTINTERP_LINK_OPTS="$LIBOCTINTERP_LINK_OPTS $LIBOCTAVE_LINK_OPTS" diff --git a/m4/acinclude.m4 b/m4/acinclude.m4 index 740a1faa40..95821fd48b 100644 --- a/m4/acinclude.m4 +++ b/m4/acinclude.m4 @@ -2784,9 +2784,9 @@ AC_DEFUN_ONCE([OCTAVE_DEFINE_MKOCTFILE_DYNAMIC_LINK_OPTIONS], [ dnl Contains variables that are defined and undefined at this point, dnl so use appropriate quoting to defer expansion of dnl ${abs_top_builddir}, ${bindir}, and ${version}. - DL_LDFLAGS='-bundle -undefined dynamic_lookup -bind_at_load -bundle_loader ${abs_top_builddir}/src/octave'"${EXEEXT} ${LDFLAGS}" - MKOCTFILE_DL_LDFLAGS='-bundle -undefined dynamic_lookup -bind_at_load -bundle_loader ${bindir}/octave-${version}'"${EXEEXT}" - SH_LDFLAGS="-dynamiclib -single_module ${LDFLAGS}" + DL_LDFLAGS="-bundle -undefined dynamic_lookup -bind_at_load" + MKOCTFILE_DL_LDFLAGS="-bundle -undefined dynamic_lookup -bind_at_load" + SH_LDFLAGS="-dynamiclib -single_module" case $canonical_host_type in powerpc-*) CXXPICFLAG= diff --git a/src/mkoctfile.in.cc b/src/mkoctfile.in.cc index 22793b5360..10153fbe01 100644 --- a/src/mkoctfile.in.cc +++ b/src/mkoctfile.in.cc @@ -345,13 +345,13 @@ make_vars_map (bool link_stand_alone, bool verbose, bool debug) replace_prefix (%OCTAVE_CONF_FLIBS%)); vars["OCTAVE_LINK_DEPS"] = get_variable ("OCTAVE_LINK_DEPS", - %OCTAVE_CONF_MKOCTFILE_OCTAVE_LINK_DEPS%); + replace_prefix (%OCTAVE_CONF_MKOCTFILE_OCTAVE_LINK_DEPS%)); vars["OCTAVE_LINK_OPTS"] = get_variable ("OCTAVE_LINK_OPTS", %OCTAVE_CONF_OCTAVE_LINK_OPTS%); vars["OCT_LINK_DEPS"] = get_variable ("OCT_LINK_DEPS", - %OCTAVE_CONF_MKOCTFILE_OCT_LINK_DEPS%); + replace_prefix (%OCTAVE_CONF_MKOCTFILE_OCT_LINK_DEPS%)); vars["OCT_LINK_OPTS"] = get_variable ("OCT_LINK_OPTS", @@ -1364,7 +1364,10 @@ main (int argc, char **sys_argv) + pass_on_options + " -o " + octfile + ' ' + objfiles + ' ' + libfiles + ' ' + ldflags + ' ' + vars["DL_LDFLAGS"] + ' ' + vars["LDFLAGS"] + ' ' + octave_libs + ' ' - + vars["OCT_LINK_OPTS"] + ' ' + vars["OCT_LINK_DEPS"]); + + vars["OCT_LINK_OPTS"]); + + if (! creating_mex_file) + cmd += ' ' + vars["OCT_LINK_DEPS"]; #if defined (OCTAVE_USE_WINDOWS_API) || defined (CROSS) if (! f77files.empty () && ! vars["FLIBS"].empty ()) diff --git a/test/mex/module.mk b/test/mex/module.mk index 22fc595c60..ba8fba010c 100644 --- a/test/mex/module.mk +++ b/test/mex/module.mk @@ -50,6 +50,7 @@ MKMEXFILELDFLAGS = \ -L$(top_builddir)/libmex/.libs MKMEXFILE = \ + OCT_LINK_DEPS="" \ DL_LDFLAGS="$(DL_LDFLAGS)" \ $(top_builddir)/src/mkoctfile --mex $(MKMEXFILECPPFLAGS) $(MKMEXFILELDFLAGS)