Mercurial > octave
changeset 30368:15ae4d97a632 stable
mkoctfile: Correctly handle relocation in cross-compiler.
* configure.ac: Add new makefile variable AMCOND_RELOCATE_ALL.
* src/module.mk (mkoctfile CROSS): Optionally, set OCTAVE_REPLACE_PREFIX.
* src/mkoctfile.in.cc (replace_prefix): Simplify code. Style fix.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Fri, 26 Nov 2021 22:08:49 +0100 |
parents | aedfb5b870ad |
children | 25ebd2cdf255 dbff48b54dd2 |
files | configure.ac src/mkoctfile.in.cc src/module.mk |
diffstat | 3 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.ac Fri Nov 26 20:50:42 2021 +0100 +++ b/configure.ac Fri Nov 26 22:08:49 2021 +0100 @@ -2627,6 +2627,7 @@ if test $OCTAVE_RELOCATE_ALL = yes; then AC_DEFINE(OCTAVE_REPLACE_PREFIX, 1, [Replace prefix in mkoctfile flags.]) fi +AM_CONDITIONAL([AMCOND_RELOCATE_ALL], [test $OCTAVE_RELOCATE_ALL = yes]) ### Determine whether Mercurial ID should be embedded in library binaries.
--- a/src/mkoctfile.in.cc Fri Nov 26 20:50:42 2021 +0100 +++ b/src/mkoctfile.in.cc Fri Nov 26 22:08:49 2021 +0100 @@ -160,11 +160,11 @@ { #if defined (OCTAVE_REPLACE_PREFIX) const std::string match = "${prefix}"; - const std::string repl = prepend_octave_exec_home (""); + const std::string repl = Voctave_exec_home; std::size_t pos = s.find (match); while (pos != std::string::npos ) { - s.replace(pos, match.length (), repl); + s.replace (pos, match.length (), repl); pos = s.find (match); } #endif
--- a/src/module.mk Fri Nov 26 20:50:42 2021 +0100 +++ b/src/module.mk Fri Nov 26 22:08:49 2021 +0100 @@ -176,8 +176,12 @@ OCTAVE_CROSS_TOOLS += %reldir%/$(host_triplet)-mkoctfile$(BUILD_EXEEXT) +if AMCOND_RELOCATE_ALL + OCTAVE_REPLACE_PREFIX_CPPFLAGS = -DOCTAVE_REPLACE_PREFIX +endif + %reldir%/$(host_triplet)-mkoctfile$(BUILD_EXEEXT): %reldir%/$(host_triplet)-mkoctfile.cc - $(BUILD_CXX) -o %reldir%/$(host_triplet)-mkoctfile$(BUILD_EXEEXT) -DCROSS=1 $(DEFAULT_INCLUDES) $(BUILD_CXXFLAGS) $(BUILD_LDFLAGS) -I$(srcdir)/src %reldir%/$(host_triplet)-mkoctfile.cc + $(BUILD_CXX) -o %reldir%/$(host_triplet)-mkoctfile$(BUILD_EXEEXT) $(OCTAVE_REPLACE_PREFIX_CPPFLAGS) -DCROSS=1 $(DEFAULT_INCLUDES) $(BUILD_CXXFLAGS) $(BUILD_LDFLAGS) -I$(srcdir)/src %reldir%/$(host_triplet)-mkoctfile.cc %reldir%/$(host_triplet)-mkoctfile.cc: %reldir%/mkoctfile.in.cc build-aux/subst-cross-config-vals.sh | %reldir%/$(octave_dirstamp) $(AM_V_GEN)$(call simple-filter-rule,build-aux/subst-cross-config-vals.sh)