subobj11b.sh 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #! /bin/sh
  2. # Copyright (C) 2010-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 that automake works around a bug of Solaris Make. The bug is the
  17. # following. If we have a Makefile containg a file inclusion like this:
  18. # include .//foo.mk
  19. # Solaris make fails with a message like:
  20. # make: ... can't find '/foo.mk': No such file or directory
  21. # make: fatal error ... read of include file '/foo.mk' failed
  22. # (even if the file 'foo.mk' exists). The error disappear by collapsing
  23. # the repeated slash '/' characters into a single one.
  24. #
  25. # See also "semantic" sister test 'subobj11a.sh', and related test
  26. # 'subobj11c.sh'.
  27. . test-init.sh
  28. echo AC_PROG_CC >> configure.ac
  29. cat > Makefile.am << 'END'
  30. AUTOMAKE_OPTIONS = subdir-objects
  31. bin_PROGRAMS = foo
  32. ## The 'zardoz' sources should activate a code paths in Automake that
  33. ## cannot be sensibly tested by sister test 'subobj11a.test'. The other
  34. ## sources provide some sort of stress testing.
  35. foo_SOURCES = \
  36. //server/zardoz0.c \
  37. //server//zardoz1.c \
  38. //server/path/to/zardoz2.c \
  39. //server/another//path///to////zardoz3.c \
  40. /foobar0.c \
  41. ///foobar1.c \
  42. ////foobar2.c \
  43. /sub///foobar3.c \
  44. ///sub/foobar4.c \
  45. .//foobar5.c \
  46. .//sub/foobar6.c \
  47. ./sub//foobar7.c \
  48. .//sub//foobar8.c \
  49. sub/sub//sub///sub////foobar9.c
  50. END
  51. $ACLOCAL
  52. $AUTOMAKE -a
  53. # Be lax in the regexp, to account for automake conditionals, the
  54. # use of @am__include@, and similar stuff.
  55. grep 'include.*//.*foobar' Makefile.in && exit 1
  56. # These checks depend on automake internals, but presently this is
  57. # the only way to test the code path we are interested in.
  58. # Please update these checks when (and if) the relevant automake
  59. # internals are changed.
  60. for x in zardoz0 zardoz1 path/to/zardoz2 another/path/to/zardoz3; do
  61. case $x in
  62. */*) d=$(echo $x | sed 's,[^/]*$,,'); b=$(echo $x | sed 's,^.*/,,');;
  63. *) d=''; b=$x;;
  64. esac
  65. # Be a little lax in the regexp, to account for automake conditionals,
  66. # quoting, and similar stuff.
  67. grep "^[^/]*am__include[^/]*//server/$d\\\$(DEPDIR)/$b\\.[^/]*$" Makefile.in
  68. done
  69. # Sanity checks.
  70. for i in 0 1 2 3 4 5 6 7 8 9; do
  71. grep "am__include.*/foobar$i\\." Makefile.in
  72. done
  73. :