help4.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #! /bin/sh
  2. # Copyright (C) 2010-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 the first among --help and --version to be specified on
  17. # the command line takes precedence over the following one.
  18. . test-init.sh
  19. # Ensure we run in an empty directory.
  20. mkdir emptydir
  21. cd emptydir
  22. # Honour user overrides for $ACLOCAL and $AUTOMAKE, but without
  23. # adding extra options.
  24. ACLOCAL=$am_original_ACLOCAL
  25. AUTOMAKE=$am_original_AUTOMAKE
  26. escape_dots () { sed 's/\./\\./g'; } # Avoid issues with "\" in backquotes.
  27. apiversion_rx=$(echo "$APIVERSION" | escape_dots)
  28. $ACLOCAL --version --help >stdout || { cat stdout; exit 1; }
  29. cat stdout
  30. grep "^aclocal.*$apiversion_rx" stdout
  31. grep "^Usage" stdout && exit 1
  32. $ACLOCAL --help --version >stdout || { cat stdout; exit 1; }
  33. cat stdout
  34. grep "^Usage" stdout
  35. grep "^aclocal.*$apiversion_rx" stdout && exit 1
  36. $AUTOMAKE --version --help >stdout || { cat stdout; exit 1; }
  37. cat stdout
  38. grep "^automake.*$apiversion_rx" stdout
  39. grep "^Usage" stdout && exit 1
  40. $AUTOMAKE --help --version >stdout || { cat stdout; exit 1; }
  41. cat stdout
  42. grep "^Usage" stdout
  43. grep "^automake.*$apiversion_rx" stdout && exit 1
  44. :