build: make sed calls portable

The `-i` option on sed isn't standard, and e.g. FreeBSD sed behaves
different regarding the parameter.  Avoid it.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
David Lamparter 2021-09-02 12:19:59 +02:00
parent e5af0fc869
commit 2554d1265c

View file

@ -487,9 +487,12 @@ LT_INIT
_LT_CONFIG_LIBTOOL([
patch -N -i "${srcdir}/m4/libtool-whole-archive.patch" libtool >&AS_MESSAGE_LOG_FD || \
AC_MSG_WARN([Could not patch libtool for static linking support. Loading modules into a statically linked daemon will fail.])
sed -e 's%func_warning "relinking%true #\0%' -i libtool || true
sed -e 's%func_warning "remember to run%true #\0%' -i libtool || true
sed -e 's%func_warning ".*has not been installed in%true #\0%' -i libtool || true
dnl the -i option is not POSIX sed and the BSDs implement it differently
dnl cat'ing the output back instead of mv/cp keeps permissions on libtool intact
sed -e 's%func_warning "relinking%true #\0%' libtool > libtool.sed && cat libtool.sed > libtool
sed -e 's%func_warning "remember to run%true #\0%' libtool > libtool.sed && cat libtool.sed > libtool
sed -e 's%func_warning ".*has not been installed in%true #\0%' libtool > libtool.sed && cat libtool.sed > libtool
test -f libtool.sed && rm libtool.sed
])
if test "$enable_static_bin" = "yes"; then
AC_LDFLAGS_EXEC="-static"
@ -2659,8 +2662,9 @@ if test "$enable_rpath" = "yes" ; then
true
else
# See https://old-en.opensuse.org/openSUSE:Packaging_Guidelines#Removing_Rpath
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool > libtool.sed && cat libtool.sed > libtool
sed -e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool > libtool.sed && cat libtool.sed > libtool
test -f libtool.sed && rm libtool.sed
fi
echo "