Commit 731b0a773903a5e631071d6070d98563a7c3cb3e

Guillem Jover 2021-08-17T02:59:59

build: Detect sed at configure time Check whether sed is available and use the implementation matching the requirements via the SED variable.

diff --git a/configure.ac b/configure.ac
index 1591a93..645a95b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,6 +48,7 @@ AM_CONDITIONAL([HAVE_LINKER_VERSION_SCRIPT],
 
 # Checks for programs.
 AC_PROG_CC
+AC_PROG_SED
 AC_PROG_INSTALL
 AC_PROG_LN_S
 
diff --git a/man/Makefile.am b/man/Makefile.am
index 5dd37bf..9c6ad89 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -11,7 +11,7 @@ CLEANFILES = \
 SED_MD5_SUBST = -e 's/mdX/md5/g' -e 's/mdY/md4/g' -e 's/MDX/MD5/g'
 
 md5.3bsd: $(srcdir)/mdX.3bsd
-	$(AM_V_GEN) sed $(SED_MD5_SUBST) $< > $@
+	$(AM_V_GEN) $(SED) $(SED_MD5_SUBST) $< > $@
 
 dist_man_MANS = \
 	LIST_CLASS_ENTRY.3bsd \
diff --git a/src/Makefile.am b/src/Makefile.am
index 7ef2013..fe9d1e6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -136,7 +136,7 @@ install-exec-hook:
 		mv $(DESTDIR)$(libdir)/libbsd*.so.* \
 		   $(DESTDIR)$(runtimelibdir)/; \
 		soname=`readlink $(DESTDIR)$(libdir)/libbsd.so`; \
-		sorelprefix=`echo $(libdir) | sed -r -e 's:(^/)?[^/]+:..:g'`; \
+		sorelprefix=`echo $(libdir) | $(SED) -r -e 's:(^/)?[^/]+:..:g'`; \
 		ln -sf $$sorelprefix$(runtimelibdir)/$$soname \
 		       $(DESTDIR)$(libdir)/libbsd.so; \
 	fi