auxdir-autodetect.sh 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. # Make sure that, if AC_CONFIG_AUX_DIR is not specified, Automake tries
  17. # to use '.', '..' and '../..', in precisely that order.
  18. . test-init.sh
  19. nil=__no_such_program
  20. unset NONESUCH
  21. cat >>configure.ac << END
  22. AM_MISSING_PROG([NONESUCH],[$nil])
  23. AC_OUTPUT
  24. END
  25. mkdir d3
  26. mkdir d3/d2
  27. mkdir d3/d2/d1
  28. mkdir d3/d2/d1/d0
  29. echo 'echo %%d3%% $*' > d3/missing
  30. chmod +x d3/missing
  31. echo 'echo %%d2%% $*' > d3/d2/missing
  32. chmod +x d3/d2/missing
  33. echo 'echo %%d1%% $*' > d3/d2/d1/missing
  34. chmod +x d3/d2/d1/missing
  35. echo 'echo %%d0%% $*' > d3/d2/d1/d0/missing
  36. chmod +x d3/d2/d1/d0/missing
  37. mv configure.ac d3/d2/d1/d0/
  38. cd d3/d2/d1/d0
  39. cat > Makefile.am << 'EOF'
  40. .PHONY: test
  41. test:
  42. $(NONESUCH) >$(out)
  43. EOF
  44. $ACLOCAL
  45. $AUTOCONF
  46. # ------------------------------------------- #
  47. : We must end up with AC_CONFIG_AUX_DIR = . #
  48. # ------------------------------------------- #
  49. : > install-sh
  50. $AUTOMAKE
  51. ./configure
  52. out=out0 $MAKE test
  53. cat out0
  54. grep "%%d0%%.*$nil" out0
  55. grep '%%d[123]' out0 && exit 1
  56. rm -f missing install-sh
  57. # -------------------------------------------- #
  58. : We must end up with AC_CONFIG_AUX_DIR = .. #
  59. # -------------------------------------------- #
  60. # Automake finds 'install-sh' in '.', so it assumes that auxdir is '.';
  61. # but it won't find 'missing' in '.', so it will fail.
  62. : > install-sh
  63. AUTOMAKE_fails
  64. grep 'required file.*[^.]\./missing.*not found' stderr
  65. rm -f install-sh
  66. # Now things should work.
  67. : > ../install-sh
  68. $AUTOMAKE
  69. ./configure
  70. out=out1 $MAKE test
  71. cat out1
  72. grep "%%d1%%.*$nil" out1
  73. grep '%%d[023]' out1 && exit 1
  74. rm -f ../missing ../install-sh
  75. # ----------------------------------------------- #
  76. : We must end up with AC_CONFIG_AUX_DIR = ../.. #
  77. # ----------------------------------------------- #
  78. # Automake finds 'install-sh' in '.', so it assumes that auxdir is '.';
  79. # but it won't find 'missing' in '.', so it will fail.
  80. : > install-sh
  81. AUTOMAKE_fails
  82. grep 'required file.*[^.]\./missing.*not found' stderr
  83. rm -f install-sh
  84. # Automake finds 'install-sh' in '..', so it assumes that auxdir is '..';
  85. # but it won't find 'missing' in '.', so it will fail.
  86. : > ../install-sh
  87. AUTOMAKE_fails
  88. grep 'required file.*[^.]\.\./missing.*not found' stderr
  89. rm -f ../install-sh
  90. # Now things should work.
  91. : > ../../install-sh
  92. $AUTOMAKE
  93. ./configure
  94. out=out2 $MAKE test
  95. cat out2
  96. grep "%%d2%%.*$nil" out2
  97. grep '%%d[013]' out2 && exit 1
  98. rm -f ../../missing ../../install-sh
  99. # --------------------------------------------------------- #
  100. : AC_CONFIG_AUX_DIR will not be found: Automake must fail #
  101. # --------------------------------------------------------- #
  102. AUTOMAKE_fails
  103. grep 'required file.*missing.*not found' stderr
  104. :