cond34.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/bin/sh
  2. # Copyright (C) 2004-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 for _DEPENDENCIES definition with conditional _LDADD.
  17. # Report from Elena A. Vengerova.
  18. . test-init.sh
  19. cat >>configure.ac <<'EOF'
  20. AM_CONDITIONAL([TWO], [test -n "$two"])
  21. AC_OUTPUT
  22. EOF
  23. cat > Makefile.am <<'EOF'
  24. OBJEXT=z
  25. CC=false
  26. AUTOMAKE_OPTIONS=no-dependencies
  27. bin_PROGRAMS = test1 test2
  28. if TWO
  29. test1_LDADD = two.$(OBJEXT)
  30. test2_LDADD = two.$(OBJEXT)
  31. test2_DEPENDENCIES = $(test2_LDADD) somethingelse.a
  32. else !TWO
  33. test1_LDADD = one.$(OBJEXT)
  34. test2_LDADD = three.$(OBJEXT)
  35. endif !TWO
  36. test1_DEPENDENCIES = $(test1_LDADD) somethingelse.a
  37. .PHONY: dep-test1 dep-test2
  38. dep-test1:
  39. echo BEG: $(test1_DEPENDENCIES) :END
  40. dep-test2:
  41. echo BEG: $(test2_DEPENDENCIES) :END
  42. EOF
  43. $ACLOCAL
  44. $AUTOCONF
  45. $AUTOMAKE
  46. ./configure
  47. run_make -O dep-test1
  48. $FGREP 'BEG: one.z somethingelse.a :END' stdout
  49. run_make -O dep-test2
  50. $FGREP 'BEG: three.z :END' stdout
  51. ./configure two=2
  52. run_make -O dep-test1
  53. $FGREP 'BEG: two.z somethingelse.a :END' stdout
  54. run_make -O dep-test2
  55. $FGREP 'BEG: two.z somethingelse.a :END' stdout
  56. :