diff options
author | Mike Frysinger <vapier@gentoo.org> | 2022-02-17 03:50:55 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2022-02-20 19:57:40 -0500 |
commit | 3099097d74c96bbb30aa38233091f96634eda27a (patch) | |
tree | ccbfc36511854bed963a6d21495b0acf460babcd /m4 | |
parent | 31237ca48d1ec04c8498312aa7e3e5b5174a37d6 (diff) | |
download | automake-3099097d74c96bbb30aa38233091f96634eda27a.tar.gz |
rm: handle -f w/no arguments gracefully
Fixes automake bug https://bugs.gnu.org/10828.
Delete the configure check that would abort if `rm -f` does not work,
and delete the plans to make this a hard requirement in the future.
Instead, test to see if `rm -f` fails w/out arguments. If it does,
define am__rm_f such that it always passes at least the "" argument
when deleting files. If it doesn't fail, then we can omit the "".
Then go through lib/am/ and update places where we use the pattern
`test -z ... || rm -f ...` and replace with $(am__rm_f).
* NEWS: Mention support for `rm -f` w/out arguments.
* PLANS/rm-f-without-args.txt: Remove.
* lib/am/check.am: Use new $(am__rm_f) helper.
* lib/am/clean.am: Likewise.
* lib/am/header-vars.am: Likewise.
* lib/am/inst-vars.am: Likewise.
* lib/am/libs.am: Likewise.
* lib/am/ltlib.am: Likewise.
* lib/am/progs.am: Likewise.
* lib/am/texinfos.am: Likewise.
* m4/init.m4: Delete `rm -f` checks and call _AM_PROG_RM_F.
* m4/rmf.m4: Define new _AM_PROG_RM_F macro.
* t/rm-f-probe.sh: Update test.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/init.m4 | 41 | ||||
-rw-r--r-- | m4/rmf.m4 | 16 |
2 files changed, 17 insertions, 40 deletions
diff --git a/m4/init.m4 b/m4/init.m4 index 6ef46d669..e576b935d 100644 --- a/m4/init.m4 +++ b/m4/init.m4 @@ -142,47 +142,8 @@ AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl -# POSIX will say in a future version that running "rm -f" with no argument -# is OK; and we want to be able to make that assumption in our Makefile -# recipes. So use an aggressive probe to check that the usage we want is -# actually supported "in the wild" to an acceptable degree. -# See automake bug#10828. -# To make any issue more visible, cause the running configure to be aborted -# by default if the 'rm' program in use doesn't match our expectations; the -# user can still override this though. -if rm -f && rm -fr && rm -rf; then : OK; else - cat >&2 <<'END' -Oops! +AC_REQUIRE([_AM_PROG_RM_F]) -Your 'rm' program seems unable to run without file operands specified -on the command line, even when the '-f' option is present. This is contrary -to the behaviour of most rm programs out there, and not conforming with -the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542> - -Please tell bug-automake@gnu.org about your system, including the value -of your $PATH and any error possibly output before this message. This -can help us improve future automake versions. - -END - if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then - echo 'Configuration will proceed anyway, since you have set the' >&2 - echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 - echo >&2 - else - cat >&2 <<'END' -Aborting the configuration process, to ensure you take notice of the issue. - -You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: <https://www.gnu.org/software/coreutils/>. - -If you want to complete the configuration process using your problematic -'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM -to "yes", and re-run configure. - -END - AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) - fi -fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. diff --git a/m4/rmf.m4 b/m4/rmf.m4 new file mode 100644 index 000000000..2437a9f76 --- /dev/null +++ b/m4/rmf.m4 @@ -0,0 +1,16 @@ +## -*- Autoconf -*- +# Copyright (C) 2022 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_PROG_RM_F +# --------------- +# Check whether 'rm -f' without any arguments works. +# https://bugs.gnu.org/10828 +AC_DEFUN([_AM_PROG_RM_F], +[am__rm_f_notfound= +AS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""']) +AC_SUBST(am__rm_f_notfound) +]) |