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