cond19.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 substitution references to conditional variables.
  17. # Report from Richard Boulton.
  18. . test-init.sh
  19. cat >> configure.ac << 'END'
  20. AC_SUBST([CC], [false])
  21. AC_SUBST([OBJEXT], [o])
  22. AM_CONDITIONAL([COND1], [test "x$CONDITION1" = "xtrue"])
  23. AM_CONDITIONAL([COND2], [test "x$CONDITION2" = "xtrue"])
  24. AC_OUTPUT
  25. END
  26. cat > Makefile.am << 'END'
  27. bin_PROGRAMS = helldl
  28. var1 = dlmain
  29. if COND1
  30. var2 = $(var1:=.c)
  31. else
  32. var2 = $(var1:=.c)
  33. endif
  34. if COND2
  35. var3 = $(var2:.c=a.c)
  36. var4 = $(var2:.c=b.c)
  37. else
  38. var3 = $(var2:.c=b.c)
  39. var4 = $(var2:.c=a.c)
  40. endif
  41. helldl_SOURCES = $(var3:.c=1.c) $(var4:.c=2.c)
  42. .PHONY: test
  43. test:
  44. is $(exp) == $(helldl_SOURCES) $(helldl_OBJECTS)
  45. END
  46. $ACLOCAL
  47. $AUTOCONF
  48. $AUTOMAKE -a -i
  49. CONDITION1=true CONDITION2=true ./configure
  50. $MAKE test exp='dlmaina1.c dlmainb2.c dlmaina1.o dlmainb2.o'
  51. CONDITION1=true CONDITION2=false ./configure
  52. $MAKE test exp='dlmainb1.c dlmaina2.c dlmainb1.o dlmaina2.o'
  53. CONDITION1=false CONDITION2=true ./configure
  54. $MAKE test exp='dlmaina1.c dlmainb2.c dlmaina1.o dlmainb2.o'
  55. CONDITION1=false CONDITION2=false ./configure
  56. $MAKE test exp='dlmainb1.c dlmaina2.c dlmainb1.o dlmaina2.o'
  57. :