extra-deps.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 EXTRA_*_DEPENDENCIES. See 'extra-deps-lt.sh' for libtool variant.
  17. required=cc
  18. . test-init.sh
  19. cat >> configure.ac << 'END'
  20. AC_PROG_CC
  21. AM_PROG_AR
  22. AC_PROG_RANLIB
  23. AC_SUBST([deps], [bardep])
  24. AM_CONDITIONAL([COND], [test -n "$cond"])
  25. AC_OUTPUT
  26. END
  27. cat > Makefile.am << 'END'
  28. noinst_LIBRARIES = libfoo.a
  29. EXTRA_libfoo_a_DEPENDENCIES = libfoodep
  30. libfoodep:
  31. @echo making $@
  32. @: > $@
  33. CLEANFILES = libfoodep
  34. bin_PROGRAMS = foo bar
  35. EXTRA_foo_DEPENDENCIES = foodep
  36. if COND
  37. EXTRA_foo_DEPENDENCIES += foodep2
  38. endif
  39. bar_LDADD = libfoo.a
  40. EXTRA_bar_DEPENDENCIES = $(deps)
  41. EXTRA_DIST = foodep bardep
  42. .PHONY: bar-has-been-updated
  43. bar-has-been-updated:
  44. is_newest bar$(EXEEXT) libfoo.a
  45. END
  46. cat >libfoo.c <<'END'
  47. int libfoo () { return 0; }
  48. END
  49. cat >foo.c <<'END'
  50. int main () { return 0; }
  51. END
  52. cat >bar.c <<'END'
  53. extern int libfoo ();
  54. int main () { return libfoo (); }
  55. END
  56. $ACLOCAL
  57. $AUTOMAKE --add-missing
  58. $AUTOCONF
  59. ./configure cond=yes
  60. # Hypotheses:
  61. # - EXTRA_*_DEPENDENCIES are honored.
  62. # - Conditionals and substitutions are honored.
  63. # - *_DEPENDENCIES are not overwritten by their EXTRA_* counterparts.
  64. : >foodep
  65. : >foodep2
  66. : >bardep
  67. run_make -O
  68. grep 'making libfoodep' stdout
  69. rm -f foodep
  70. $MAKE && exit 1
  71. : >foodep
  72. rm -f foodep2
  73. $MAKE && exit 1
  74. : >foodep2
  75. rm -f bardep
  76. $MAKE && exit 1
  77. : >bardep
  78. $MAKE
  79. $sleep
  80. touch libfoo.a
  81. $MAKE
  82. $MAKE bar-has-been-updated
  83. $MAKE distcheck
  84. :