cond30.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/sh
  2. # Copyright (C) 2003-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. # For PR/352: make sure we support bin_PROGRAMS being defined conditionally.
  17. . test-init.sh
  18. cat >>configure.ac <<'EOF'
  19. AM_CONDITIONAL([C1], [test -z "$two"])
  20. AM_CONDITIONAL([C2], [test -n "$two"])
  21. AC_OUTPUT
  22. EOF
  23. cat > Makefile.am <<'EOF'
  24. AUTOMAKE_OPTIONS = no-dependencies
  25. CC = false
  26. EXEEXT = .foo
  27. if C1
  28. bin_PROGRAMS = a
  29. endif
  30. if C2
  31. bin_PROGRAMS = b $(undefined)
  32. endif
  33. .PHONY: test-a test-b
  34. test-a:
  35. test a.foo = $(bin_PROGRAMS)
  36. test-b:
  37. test b.foo = $(bin_PROGRAMS)
  38. EOF
  39. $ACLOCAL
  40. $AUTOCONF
  41. $AUTOMAKE
  42. $FGREP 'a_SOURCES = a.c' Makefile.in
  43. $FGREP 'b_SOURCES = b.c' Makefile.in
  44. ./configure
  45. $MAKE test-a
  46. ./configure two=yes
  47. $MAKE test-b
  48. :