aclocal-serial.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. #! /bin/sh
  2. # Copyright (C) 2005-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 --install with #serial numbers.
  17. am_create_testdir=empty
  18. . test-init.sh
  19. cat > configure.ac << 'END'
  20. AC_INIT
  21. AM_MACRO1
  22. AM_MACRO2
  23. END
  24. mkdir 1 2 3 4 5 6
  25. cat >1/m1.m4 <<EOF
  26. #serial 1.8.1230.9
  27. AC_DEFUN([AM_MACRO1], [:macro11:])
  28. AC_DEFUN([AM_MACRO2], [:macro21:])
  29. EOF
  30. cat >2/m1.m4 <<EOF
  31. #serial 1.8.1231.9
  32. AC_DEFUN([AM_MACRO1], [:macro12:])
  33. EOF
  34. cat >3/m2.m4 <<EOF
  35. #serial 13
  36. AC_DEFUN([AM_MACRO2], [:macro23:])
  37. EOF
  38. cat >3/m1.m4 <<EOF
  39. #serial 1.8.1230.1
  40. AC_DEFUN([AM_MACRO1], [:macro13:])
  41. EOF
  42. cat >4/mumble.m4 <<EOF
  43. #serial 0
  44. AC_DEFUN([AM_MACRO1], [:macro14:])
  45. EOF
  46. cat >5/ill-formed.m4 <<EOF
  47. #serial bla
  48. #serial .2
  49. #serial
  50. AC_DEFUN([AM_MACRO1], [:macro15:])
  51. EOF
  52. cat >6/after-def.m4 <<EOF
  53. AC_DEFUN([AM_MACRO1], [:macro16:])
  54. #serial 1
  55. EOF
  56. clean_stale ()
  57. {
  58. rm -rf aclocal.m4 configure autom4te*.cache
  59. }
  60. $ACLOCAL -I 1 -I 2 -I 3 -I 4
  61. $AUTOCONF
  62. $FGREP ':macro11:' configure
  63. $FGREP ':macro21:' configure
  64. clean_stale
  65. $ACLOCAL -I 1 -I 2 -I 3 -I 4 --install
  66. $AUTOCONF
  67. $FGREP ':macro12:' configure
  68. $FGREP ':macro23:' configure
  69. cp -f aclocal.m4 aclocal-m4.sav
  70. clean_stale
  71. mv -f aclocal-m4.sav aclocal.m4
  72. $ACLOCAL -I 4 -I 1 -I 2 -I 3 --install --dry-run
  73. $AUTOCONF
  74. $FGREP ':macro12:' configure
  75. $FGREP ':macro23:' configure
  76. clean_stale
  77. $ACLOCAL -I 4 -I 1 -I 2 -I 3 --install
  78. $AUTOCONF
  79. $FGREP ':macro14:' configure
  80. $FGREP ':macro23:' configure
  81. clean_stale
  82. $ACLOCAL -I 4 -I 1 -I 2 --install 2>stderr && { cat stderr >&2; exit 1; }
  83. cat stderr >&2
  84. grep 'macro.*AM_MACRO2.*not found' stderr
  85. clean_stale
  86. $ACLOCAL -I 4 -I 1 --install
  87. $AUTOCONF
  88. $FGREP ':macro14:' configure
  89. $FGREP ':macro21:' configure
  90. mkdir acdir
  91. ACLOCAL="$ACLOCAL --system-acdir acdir"
  92. cat >acdir/m1.m4 <<EOF
  93. #serial 456
  94. AC_DEFUN([AM_MACRO1], [:macro1d:])
  95. AC_DEFUN([AM_MACRO2], [:macro2d:])
  96. EOF
  97. clean_stale
  98. $ACLOCAL -I 4 -I 1 --diff=diff >stdout 2>stderr || {
  99. cat stderr >&2
  100. cat stdout
  101. exit 1
  102. }
  103. cat stderr >&2
  104. cat stdout
  105. grep '#serial 456' stdout
  106. test ! -e 4/m1.m4
  107. grep 'installing.*4/m1\.m4' stderr
  108. $ACLOCAL -I 5 2>stderr && { cat stderr >&2; exit 1; }
  109. cat stderr >&2
  110. test $(grep -c 'ill-formed serial' stderr) -eq 3
  111. $ACLOCAL -I 6 2>stderr && { cat stderr >&2; exit 1; }
  112. cat stderr >&2
  113. grep 'serial.*before any macro definition' stderr
  114. :