pr220.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #! /bin/sh
  2. # Copyright (C) 2001-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. # Test for PR automake/220.
  17. # Test for problems when conditionals are not actually defined.
  18. # Check that the problems is diagnosed by configure.
  19. # This isn't perfect (ideally we'd like an error from autoconf),
  20. # but it is the best we can do. It certainly makes it easier
  21. # to debug the problem.
  22. # Note that this should be also in the documentation.
  23. . test-init.sh
  24. cat > Makefile.am << 'EOF'
  25. if NEVER_TRUE
  26. NEVER_DEFINED = foo.txt
  27. endif
  28. data_DATA = $(NEVER_DEFINED)
  29. EOF
  30. cat >> configure.ac << 'EOF'
  31. AC_ARG_ENABLE([foo],
  32. [ --enable-foo Enable foo],
  33. [ if test "foo" = "bar" ; then
  34. AM_CONDITIONAL([NEVER_TRUE], [true])
  35. else
  36. AM_CONDITIONAL([NEVER_TRUE], [false])
  37. fi
  38. ])
  39. AC_OUTPUT
  40. EOF
  41. mkdir build
  42. $ACLOCAL
  43. $AUTOCONF
  44. $AUTOMAKE -a
  45. cd build
  46. # configure should fail since we've done something invalid.
  47. ../configure 2>stderr && { cat stderr >&2; exit 1; }
  48. cat stderr >&2
  49. grep 'conditional.*NEVER_TRUE' stderr
  50. :