gnits3.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #! /bin/sh
  2. # Copyright (C) 2002-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. # Check that AM_INSTALLCHECK_STD_OPTIONS_EXEMPT works.
  17. required=cc
  18. . test-init.sh
  19. cat >> configure.ac << 'END'
  20. AC_PROG_CC
  21. AC_OUTPUT
  22. END
  23. # We use the same basename for all targets on purpose. This way
  24. # we make sure that 'AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = nok'
  25. # will not match anything containing 'nok'.
  26. cat > Makefile.am << 'END'
  27. AUTOMAKE_OPTIONS = gnits
  28. nobase_bin_PROGRAMS = nok sub/nok
  29. nok_SOURCES = nok.c
  30. sub_nok_SOURCES = nok.c
  31. nobase_bin_SCRIPTS = nok.sh sub/nok.sh
  32. AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = nok$(EXEEXT) nok.sh
  33. grep-stderr:
  34. grep 'sub/pnok$(EXEEXT) does not support' stderr
  35. grep 'sub/pnok\.sh does not support' stderr
  36. ## Only two failures please.
  37. test `grep 'does not support --help' stderr | wc -l` = 2
  38. test `grep 'does not support --version' stderr | wc -l` = 2
  39. END
  40. cat > nok.c <<'END'
  41. int main (void)
  42. {
  43. return 0;
  44. }
  45. END
  46. mkdir sub
  47. cat >nok.sh <<EOF
  48. #!/bin/sh
  49. echo "Which version? Which usage?"
  50. exit 1
  51. EOF
  52. cp nok.sh sub/nok.sh
  53. chmod +x nok.sh
  54. chmod +x sub/nok.sh
  55. # Files required by Gnits.
  56. : > INSTALL
  57. : > NEWS
  58. : > README
  59. : > COPYING
  60. : > AUTHORS
  61. : > ChangeLog
  62. : > THANKS
  63. $ACLOCAL
  64. $AUTOCONF
  65. $AUTOMAKE -a
  66. mkdir build
  67. cd build
  68. # Use --program-prefix to make sure the std-options check honors it.
  69. ../configure "--prefix=$(pwd)/../inst-dir" --program-prefix=p
  70. $MAKE
  71. $MAKE install
  72. $MAKE installcheck && exit 1
  73. # Don't trust th exit status of "make -k" for non-GNU makes.
  74. if using_gmake; then status=FAIL; else status=IGNORE; fi
  75. run_make -e $status -E -- -k installcheck
  76. $MAKE grep-stderr
  77. # Make sure there is no more error when all targets are exempted.
  78. cd ..
  79. cat >> Makefile.am <<'END'
  80. AM_INSTALLCHECK_STD_OPTIONS_EXEMPT += sub/nok$(EXEEXT) sub/nok.sh
  81. END
  82. $AUTOMAKE
  83. cd build
  84. ./config.status # Don't rely on the rebuild rules (they need GNU make).
  85. $MAKE installcheck
  86. :