cond3.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #! /bin/sh
  2. # Copyright (C) 1997-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 sources listed in conditional.
  17. # Report from Rob Savoye <rob@cygnus.com>, and Lars J. Aas.
  18. . test-init.sh
  19. cat >> configure.ac << 'END'
  20. AC_PROG_CC
  21. AM_CONDITIONAL([ONE], [true])
  22. AM_CONDITIONAL([TWO], [false])
  23. AM_CONDITIONAL([THREE], [maybe])
  24. AC_OUTPUT
  25. END
  26. cat > Makefile.am << 'END'
  27. bin_PROGRAMS = targ
  28. if ONE
  29. SONE = one.c
  30. else
  31. SONE =
  32. endif
  33. if TWO
  34. STWO = two.c
  35. else
  36. STWO =
  37. endif
  38. if THREE
  39. STHREE = three.c
  40. else
  41. STHREE =
  42. endif
  43. targ_SOURCES = $(SONE) $(STWO) $(STHREE)
  44. END
  45. $ACLOCAL
  46. $AUTOMAKE
  47. # 'b top' so that
  48. sed -n '
  49. /[oO][bB][jJ][eE][cC][tT].* =/ {
  50. : loop
  51. /\\$/ {
  52. p
  53. n
  54. b loop
  55. }
  56. p
  57. }' Makefile.in >produced
  58. cat >expected << 'EOF'
  59. @ONE_TRUE@am__objects_1 = one.$(OBJEXT)
  60. @TWO_TRUE@am__objects_2 = two.$(OBJEXT)
  61. @THREE_TRUE@am__objects_3 = three.$(OBJEXT)
  62. am_targ_OBJECTS = $(am__objects_1) $(am__objects_2) $(am__objects_3)
  63. targ_OBJECTS = $(am_targ_OBJECTS)
  64. EOF
  65. diff expected produced
  66. :