location.sh 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #! /bin/sh
  2. # Copyright (C) 2002-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 locations in error messages.
  17. . test-init.sh
  18. cat >> configure.ac << 'END'
  19. AM_CONDITIONAL([COND1], [true])
  20. AM_CONDITIONAL([COND2], [true])
  21. AC_PROG_CC
  22. AM_PROG_AR
  23. AC_PROG_RANLIB
  24. END
  25. cat > Makefile.am << 'END'
  26. bin_PROGRAMS = libfoo.a
  27. if COND2
  28. lib_LIBRARIES = libfoo.a
  29. endif
  30. if COND1
  31. bin_PROGRAMS += ctags
  32. endif
  33. VAR = 1 \
  34. 2 \
  35. 3
  36. VAR = 1 \
  37. 2 \
  38. 3
  39. END
  40. : > ar-lib
  41. # Smash the useless difference of lib file locations.
  42. smash_useless_diffs ()
  43. {
  44. sed -e "s,^$am_amdir/\\([a-z]*\.am\\),\\1," \
  45. -e "s,^automake-$APIVERSION:,automake:," ${1+"$@"};
  46. }
  47. $ACLOCAL
  48. AUTOMAKE_fails -Wno-error
  49. smash_useless_diffs stderr >observed
  50. # Apparently useless use of sed here required to avoid spuriously
  51. # triggering some maintainer-checks failures.
  52. sed 's/^> //' > expected << 'END'
  53. > Makefile.am:12: warning: VAR multiply defined in condition TRUE ...
  54. > Makefile.am:8: ... 'VAR' previously defined here
  55. > automake: error: libfoo_a_OBJECTS should not be defined
  56. > Makefile.am:3: while processing library 'libfoo.a'
  57. > automake: error: use 'libfoo_a_LDADD', not 'libfoo_a_LIBADD'
  58. > Makefile.am:3: while processing library 'libfoo.a'
  59. > library.am: warning: deprecated feature: target 'libfoo.a' overrides 'libfoo.a$(EXEEXT)'
  60. > library.am: change your target to read 'libfoo.a$(EXEEXT)'
  61. > Makefile.am:3: while processing library 'libfoo.a'
  62. > program.am: target 'libfoo.a$(EXEEXT)' was defined here
  63. > Makefile.am:1: while processing program 'libfoo.a'
  64. > program.am: warning: redefinition of 'libfoo.a$(EXEEXT)' ...
  65. > Makefile.am:1: while processing program 'libfoo.a'
  66. > library.am: ... 'libfoo.a' previously defined here
  67. > Makefile.am:3: while processing library 'libfoo.a'
  68. > tags.am: warning: redefinition of 'ctags' ...
  69. > program.am: ... 'ctags$(EXEEXT)' previously defined here
  70. > Makefile.am:6: while processing program 'ctags'
  71. END
  72. cat expected
  73. cat observed
  74. diff expected observed || exit 1
  75. AUTOMAKE_fails -Werror
  76. smash_useless_diffs stderr >observed
  77. (echo 'automake: warnings are treated as errors' && cat expected) > t
  78. mv -f t expected
  79. cat expected
  80. cat observed
  81. diff expected observed || exit 1
  82. :