xref: /freebsd/sys/contrib/openzfs/config/always-sed.m4 (revision 7877fdebeeb35fad1cbbafce22598b1bdf97c786)
1eda14cbcSMatt Macydnl #
2eda14cbcSMatt Macydnl # Set the flags used for sed in-place edits.
3eda14cbcSMatt Macydnl #
4eda14cbcSMatt MacyAC_DEFUN([ZFS_AC_CONFIG_ALWAYS_SED], [
5eda14cbcSMatt Macy	AC_REQUIRE([AC_PROG_SED])dnl
6eda14cbcSMatt Macy	AC_CACHE_CHECK([for sed --in-place], [ac_cv_inplace], [
7*7877fdebSMatt Macy		tmpfile=$(mktemp conftest.XXXXXX)
8eda14cbcSMatt Macy		echo foo >$tmpfile
9eda14cbcSMatt Macy		AS_IF([$SED --in-place 's#foo#bar#' $tmpfile 2>/dev/null],
10eda14cbcSMatt Macy		      [ac_cv_inplace="--in-place"],
11eda14cbcSMatt Macy		      [$SED -i '' 's#foo#bar#' $tmpfile 2>/dev/null],
12eda14cbcSMatt Macy		      [ac_cv_inplace="-i ''"],
13eda14cbcSMatt Macy		      [AC_MSG_ERROR([$SED does not support in-place])])
14eda14cbcSMatt Macy	])
15eda14cbcSMatt Macy	AC_SUBST([ac_inplace], [$ac_cv_inplace])
16eda14cbcSMatt Macy])
17