cond40.sh 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #! /bin/sh
  2. # Copyright (C) 2008-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 AM_COND_IF.
  17. . test-init.sh
  18. cat >>configure.ac <<'END'
  19. AC_DEFUN([FOO],
  20. [AC_CONFIG_FILES([$1])])
  21. AM_CONDITIONAL([COND], [test "$cond" = yes])
  22. # Next lines should not cause a shell syntax error.
  23. AM_COND_IF([COND])
  24. AM_COND_IF([COND],
  25. [AC_SUBST([BAR])])
  26. AM_COND_IF([COND],
  27. [AC_CONFIG_FILES([file1])])
  28. # Things should work even at a time when the shell expressions
  29. # for the conditional are not valid any more.
  30. ok=$cond1
  31. AM_CONDITIONAL([COND1], [test "$ok" = yes])
  32. ok=$cond2
  33. AM_CONDITIONAL([COND2], [test "$ok" = yes])
  34. ok=$cond3
  35. AM_CONDITIONAL([COND3], [test "$ok" = yes])
  36. AM_COND_IF([COND1],
  37. [AM_COND_IF([COND2], [FOO([file2])],
  38. [AM_COND_IF([COND3],
  39. [FOO([file3])])])])
  40. AC_OUTPUT
  41. END
  42. : >Makefile.am
  43. : >file1.in
  44. : >file2.in
  45. : >file3.in
  46. $ACLOCAL
  47. $AUTOCONF
  48. $AUTOMAKE -a
  49. ./configure cond=yes cond1=yes cond2=no cond3=yes
  50. test -f file1
  51. test ! -e file2
  52. test -f file3
  53. rm -f file1 file3
  54. $MAKE file1 file3
  55. $MAKE file2 && exit 1
  56. test -f file1
  57. test ! -e file2
  58. test -f file3
  59. $MAKE distclean
  60. ./configure cond=no cond1=yes cond2=yes
  61. test ! -e file1
  62. test -f file2
  63. test ! -e file3
  64. rm -f file2
  65. $MAKE file1 && exit 1
  66. $MAKE file2
  67. $MAKE file3 && exit 1
  68. test ! -e file1
  69. test -f file2
  70. test ! -e file3
  71. :