condd.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. # Test for bug in conditionals.
  17. . test-init.sh
  18. cat >> configure.ac << 'END'
  19. dnl Define a macro with the same name as the conditional to exhibit
  20. dnl any underquoted bug.
  21. AC_DEFUN([COND1], ["some'meaningless;characters`])
  22. AM_CONDITIONAL([COND1], [false])
  23. AC_CONFIG_FILES([foo/Makefile])
  24. AC_CONFIG_FILES([bar/Makefile])
  25. AC_OUTPUT
  26. END
  27. cat > Makefile.am << 'END'
  28. AUTOMAKE_OPTIONS = no-dependencies
  29. CC = false
  30. SUBDIRS = foo
  31. if COND1
  32. SUBDIRS += bar
  33. endif
  34. # Small example from the manual.
  35. bin_PROGRAMS = hello
  36. hello_SOURCES = hello-common.c
  37. if COND1
  38. hello_SOURCES += hello-cond1.c
  39. else
  40. hello_SOURCES += hello-generic.c
  41. endif
  42. .PHONY: test
  43. test: distdir
  44. test -f $(distdir)/foo/Makefile.am
  45. test -f $(distdir)/bar/Makefile.am
  46. test -f $(distdir)/hello-common.c
  47. test -f $(distdir)/hello-cond1.c
  48. test -f $(distdir)/hello-generic.c
  49. END
  50. mkdir foo bar
  51. : > foo/Makefile.am
  52. : > bar/Makefile.am
  53. : > hello-common.c
  54. : > hello-cond1.c
  55. : > hello-generic.c
  56. $ACLOCAL
  57. $AUTOCONF
  58. grep "meaningless;characters" configure && exit 1
  59. $AUTOMAKE
  60. ./configure
  61. $MAKE test
  62. :