diff options
author | Ryan Moeller <[email protected]> | 2019-10-16 22:19:48 -0400 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-10-16 19:19:48 -0700 |
commit | 4313a5b4c51e2093f1b45ef9845fc77d32b09330 (patch) | |
tree | acca9b414759ed7d2251e9a213815eb681268b08 /config/always-sed.m4 | |
parent | 08f530c6996a41c1050a11fc5b02b31a6b68fe45 (diff) |
Detect if sed supports --in-place
Not all versions of sed have the --in-place flag. Detect support for
the flag during ./configure and provide a fallback mechanism for those
systems where sed's behavior differs. The autoconf variable
${ac_inplace} can be used to choose the correct flags for editing a
file in place with sed.
Replace violating usages in Makefile.am with ${ac_inplace}.
Reviewed-by: Chris Dunlop <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes #9463
Diffstat (limited to 'config/always-sed.m4')
-rw-r--r-- | config/always-sed.m4 | 16 |
1 files changed, 16 insertions, 0 deletions
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]) +]) |