rm-f-probe.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #! /bin/sh
  2. # Copyright (C) 2013-2017 Free Software Foundation, Inc.
  3. #
  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.
  8. #
  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.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. # Verify our probe that checks that "rm -f" doesn't complain if called
  17. # without file operands works as expected. See automake bug#10828.
  18. . test-init.sh
  19. echo AC_OUTPUT >> configure.ac
  20. : > Makefile.am
  21. $ACLOCAL
  22. $AUTOCONF
  23. $AUTOMAKE
  24. mkdir bin
  25. cat > bin/rm <<'END'
  26. #!/bin/sh
  27. set -e; set -u;
  28. PATH=$original_PATH; export PATH
  29. rm_opts=
  30. while test $# -gt 0; do
  31. case $1 in
  32. -*) rm_opts="$rm_opts $1";;
  33. *) break;;
  34. esac
  35. shift
  36. done
  37. if test $# -eq 0; then
  38. echo "Oops, fake rm called without arguments" >&2
  39. exit 1
  40. else
  41. exec rm $rm_opts "$@"
  42. fi
  43. END
  44. chmod a+x bin/rm
  45. original_PATH=$PATH
  46. PATH=$(pwd)/bin$PATH_SEPARATOR$PATH
  47. export PATH original_PATH
  48. rm -f && exit 99 # Sanity check.
  49. ./configure 2>stderr && { cat stderr >&2; exit 1; }
  50. cat stderr >&2
  51. grep "'rm' program.* unable to run without file operands" stderr
  52. $FGREP "tell bug-automake@gnu.org about your system" stderr
  53. $FGREP "install GNU coreutils" stderr
  54. $EGREP "(^| |')ACCEPT_INFERIOR_RM_PROGRAM($| |')" stderr
  55. ACCEPT_INFERIOR_RM_PROGRAM=yes; export ACCEPT_INFERIOR_RM_PROGRAM
  56. ./configure
  57. $MAKE
  58. $MAKE distcheck
  59. # For the sake of our exit trap.
  60. PATH=$original_PATH; export PATH
  61. :