aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd/arcstat/Makefile.am2
-rw-r--r--cmd/dbufstat/Makefile.am2
-rw-r--r--config/always-sed.m416
-rw-r--r--config/zfs-build.m41
-rw-r--r--tests/test-runner/bin/Makefile.am2
5 files changed, 20 insertions, 3 deletions
diff --git a/cmd/arcstat/Makefile.am b/cmd/arcstat/Makefile.am
index 8166778a1..4b79f4bdd 100644
--- a/cmd/arcstat/Makefile.am
+++ b/cmd/arcstat/Makefile.am
@@ -8,6 +8,6 @@ dist_bin_SCRIPTS = arcstat
#
if USING_PYTHON_2
install-exec-hook:
- sed --in-place 's|^#!/usr/bin/env python3|#!/usr/bin/env python2|' \
+ sed ${ac_inplace} -e 's|^#!/usr/bin/env python3|#!/usr/bin/env python2|' \
$(DESTDIR)$(bindir)/arcstat
endif
diff --git a/cmd/dbufstat/Makefile.am b/cmd/dbufstat/Makefile.am
index a3f0c6e50..10c9fbabb 100644
--- a/cmd/dbufstat/Makefile.am
+++ b/cmd/dbufstat/Makefile.am
@@ -8,6 +8,6 @@ dist_bin_SCRIPTS = dbufstat
#
if USING_PYTHON_2
install-exec-hook:
- sed --in-place 's|^#!/usr/bin/env python3|#!/usr/bin/env python2|' \
+ sed ${ac_inplace} -e 's|^#!/usr/bin/env python3|#!/usr/bin/env python2|' \
$(DESTDIR)$(bindir)/dbufstat
endif
diff --git a/config/always-sed.m4 b/config/always-sed.m4
new file mode 100644
index 000000000..b9c7afd63
--- /dev/null
+++ b/config/always-sed.m4
@@ -0,0 +1,16 @@
+dnl #
+dnl # Set the flags used for sed in-place edits.
+dnl #
+AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_SED], [
+ ac_inplace=""
+ AC_CACHE_CHECK([for sed --in-place], [ac_cv_path_SED],
+ [AC_PATH_PROGS_FEATURE_CHECK([SED], [sed],
+ [[tmpfile=$(mktemp)
+ echo foo > $tmpfile
+ $ac_path_SED --in-place 's#foo#bar#' $tmpfile \
+ && ac_cv_path_SED=$ac_path_SED
+ rm $tmpfile]],
+ [ac_inplace="-i ''"])])
+ AS_IF([test "x$ac_inplace" = "x"], [ac_inplace="--in-place"])
+ AC_SUBST([ac_inplace])
+])
diff --git a/config/zfs-build.m4 b/config/zfs-build.m4
index f0c2066af..91fe04844 100644
--- a/config/zfs-build.m4
+++ b/config/zfs-build.m4
@@ -164,6 +164,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [
ZFS_AC_CONFIG_ALWAYS_ARCH
ZFS_AC_CONFIG_ALWAYS_PYTHON
ZFS_AC_CONFIG_ALWAYS_PYZFS
+ ZFS_AC_CONFIG_ALWAYS_SED
])
AC_DEFUN([ZFS_AC_CONFIG], [
diff --git a/tests/test-runner/bin/Makefile.am b/tests/test-runner/bin/Makefile.am
index 2c031f745..e7838e43d 100644
--- a/tests/test-runner/bin/Makefile.am
+++ b/tests/test-runner/bin/Makefile.am
@@ -9,7 +9,7 @@ dist_pkgdata_SCRIPTS = \
#
if USING_PYTHON_2
install-data-hook:
- sed --in-place 's|^#!/usr/bin/env python3|#!/usr/bin/env python2|' \
+ sed ${ac_inplace} -e 's|^#!/usr/bin/env python3|#!/usr/bin/env python2|' \
$(DESTDIR)$(pkgdatadir)/test-runner.py \
$(DESTDIR)$(pkgdatadir)/zts-report.py
endif