maint: Update HACKING
[automake.git] / t / rm-f-probe.sh
blobd8389ce46d8dc6f4a74c9b1e683b15db471abeec
1 #! /bin/sh
2 # Copyright (C) 2013-2017 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
17 # Verify our probe that checks that "rm -f" doesn't complain if called
18 # without file operands works as expected. See automake bug#10828.
20 . test-init.sh
22 echo AC_OUTPUT >> configure.ac
23 : > Makefile.am
25 $ACLOCAL
26 $AUTOCONF
27 $AUTOMAKE
29 mkdir bin
30 cat > bin/rm <<'END'
31 #!/bin/sh
32 set -e; set -u;
33 PATH=$original_PATH; export PATH
34 rm_opts=
35 while test $# -gt 0; do
36 case $1 in
37 -*) rm_opts="$rm_opts $1";;
38 *) break;;
39 esac
40 shift
41 done
42 if test $# -eq 0; then
43 echo "Oops, fake rm called without arguments" >&2
44 exit 1
45 else
46 exec rm $rm_opts "$@"
48 END
49 chmod a+x bin/rm
51 original_PATH=$PATH
52 PATH=$(pwd)/bin$PATH_SEPARATOR$PATH
53 export PATH original_PATH
55 rm -f && exit 99 # Sanity check.
57 ./configure 2>stderr && { cat stderr >&2; exit 1; }
58 cat stderr >&2
60 grep "'rm' program.* unable to run without file operands" stderr
61 $FGREP "tell bug-automake@gnu.org about your system" stderr
62 $FGREP "install GNU coreutils" stderr
63 $EGREP "(^| |')ACCEPT_INFERIOR_RM_PROGRAM($| |')" stderr
65 ACCEPT_INFERIOR_RM_PROGRAM=yes; export ACCEPT_INFERIOR_RM_PROGRAM
67 ./configure
68 $MAKE
69 $MAKE distcheck
71 # For the sake of our exit trap.
72 PATH=$original_PATH; export PATH