Fix check for sed --in-place
The test added in commit
4313a5b4c5
("Detect if sed supports --in-place")
doesn't work at least on my system (autoconfig-2.69).
The issue is that SED has already been found and cached before this
function is evaluated, with the result that the test is completely
skipped.
...
checking for a sed that does not truncate output... /usr/bin/sed
...
checking for sed --in-place... (cached) /usr/bin/sed
The first test is executed by libtool.m4. This looks to have been around
in libtool for at least 15 years or so, not sure why this was not
encountered at the time of the original commit.
Fix this by caching the value of the ac_inplace flag rather than the
path to SED. Also use $SED and add AC_REQUIRE to ensure that we use the
sed that was located by the standard configure test.
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Closes #10493
This commit is contained in:
parent
9642beef2b
commit
5ca349f95d
|
@ -89,7 +89,7 @@ all-local:
|
||||||
${top_builddir}/scripts/zfs-tests.sh -c
|
${top_builddir}/scripts/zfs-tests.sh -c
|
||||||
|
|
||||||
dist-hook:
|
dist-hook:
|
||||||
sed ${ac_inplace} -e 's/Release:[[:print:]]*/Release: $(RELEASE)/' \
|
$(SED) ${ac_inplace} -e 's/Release:[[:print:]]*/Release: $(RELEASE)/' \
|
||||||
$(distdir)/META
|
$(distdir)/META
|
||||||
|
|
||||||
if BUILD_LINUX
|
if BUILD_LINUX
|
||||||
|
|
|
@ -8,6 +8,6 @@ dist_bin_SCRIPTS = arcstat
|
||||||
#
|
#
|
||||||
if USING_PYTHON_2
|
if USING_PYTHON_2
|
||||||
install-exec-hook:
|
install-exec-hook:
|
||||||
sed ${ac_inplace} -e '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
|
$(DESTDIR)$(bindir)/arcstat
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -8,6 +8,6 @@ dist_bin_SCRIPTS = dbufstat
|
||||||
#
|
#
|
||||||
if USING_PYTHON_2
|
if USING_PYTHON_2
|
||||||
install-exec-hook:
|
install-exec-hook:
|
||||||
sed ${ac_inplace} -e '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
|
$(DESTDIR)$(bindir)/dbufstat
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -2,15 +2,15 @@ dnl #
|
||||||
dnl # Set the flags used for sed in-place edits.
|
dnl # Set the flags used for sed in-place edits.
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_SED], [
|
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_SED], [
|
||||||
ac_inplace=""
|
AC_REQUIRE([AC_PROG_SED])dnl
|
||||||
AC_CACHE_CHECK([for sed --in-place], [ac_cv_path_SED],
|
AC_CACHE_CHECK([for sed --in-place], [ac_cv_inplace], [
|
||||||
[AC_PATH_PROGS_FEATURE_CHECK([SED], [sed],
|
tmpfile=$(mktemp conftest.XXX)
|
||||||
[[tmpfile=$(mktemp)
|
echo foo >$tmpfile
|
||||||
echo foo > $tmpfile
|
AS_IF([$SED --in-place 's#foo#bar#' $tmpfile 2>/dev/null],
|
||||||
$ac_path_SED --in-place 's#foo#bar#' $tmpfile \
|
[ac_cv_inplace="--in-place"],
|
||||||
&& ac_cv_path_SED=$ac_path_SED
|
[$SED -i '' 's#foo#bar#' $tmpfile 2>/dev/null],
|
||||||
rm $tmpfile]],
|
[ac_cv_inplace="-i ''"],
|
||||||
[ac_inplace="-i ''"])])
|
[AC_MSG_ERROR([$SED does not support in-place])])
|
||||||
AS_IF([test "x$ac_inplace" = "x"], [ac_inplace="--in-place"])
|
])
|
||||||
AC_SUBST([ac_inplace])
|
AC_SUBST([ac_inplace], [$ac_cv_inplace])
|
||||||
])
|
])
|
||||||
|
|
|
@ -9,7 +9,7 @@ dist_pkgdata_SCRIPTS = \
|
||||||
#
|
#
|
||||||
if USING_PYTHON_2
|
if USING_PYTHON_2
|
||||||
install-data-hook:
|
install-data-hook:
|
||||||
sed ${ac_inplace} -e '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)/test-runner.py \
|
||||||
$(DESTDIR)$(pkgdatadir)/zts-report.py
|
$(DESTDIR)$(pkgdatadir)/zts-report.py
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in New Issue