cond15.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. # Regression test for conditionally defined overriding of automatic rules.
  17. . test-init.sh
  18. cat >> configure.ac << 'END'
  19. AC_PROG_CC
  20. AM_CONDITIONAL([COND1], [true])
  21. AM_CONDITIONAL([COND2], [true])
  22. END
  23. cat > Makefile.am << 'END'
  24. if COND1
  25. if COND2
  26. bin_SCRIPTS = helldl
  27. helldl$(EXEEXT):
  28. rm -f $@
  29. echo '#! /bin/sh' > $@
  30. echo '-dlopen is unsupported' >> $@
  31. chmod +x $@
  32. endif
  33. else
  34. if COND2
  35. else
  36. bin_SCRIPTS = helldl
  37. helldl$(EXEEXT):
  38. rm -f $@
  39. echo '#! /bin/sh' > $@
  40. echo '-dlopen is unsupported' >> $@
  41. chmod +x $@
  42. endif
  43. endif
  44. bin_PROGRAMS = helldl
  45. END
  46. $ACLOCAL
  47. $AUTOMAKE
  48. $FGREP helldl Makefile.in # For debugging.
  49. num1=$($FGREP -c 'helldl$(EXEEXT):' Makefile.in)
  50. num2=$($FGREP -c '@COND1_FALSE@@COND2_TRUE@helldl$(EXEEXT):' Makefile.in)
  51. test $num1 -eq 4
  52. test $num2 -eq 1
  53. :