nobase.sh 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. #! /bin/sh
  2. # Copyright (C) 2001-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 nobase_* works.
  17. required=cc
  18. . test-init.sh
  19. cat >> configure.ac <<'EOF'
  20. AC_PROG_CC
  21. AM_PROG_AR
  22. AC_PROG_RANLIB
  23. AC_OUTPUT
  24. EOF
  25. cat > Makefile.am << 'EOF'
  26. foodir = $(prefix)/foo
  27. fooexecdir = $(prefix)/foo
  28. foo_HEADERS = sub/base.h sub/base-gen.h
  29. nobase_foo_HEADERS = sub/nobase.h sub/nobase-gen.h
  30. dist_foo_DATA = sub/base.dat sub/base-gen.dat
  31. nobase_dist_foo_DATA = sub/nobase.dat sub/nobase-gen.dat
  32. dist_fooexec_SCRIPTS = sub/base.sh sub/base-gen.sh
  33. nobase_dist_fooexec_SCRIPTS = sub/nobase.sh sub/nobase-gen.sh
  34. fooexec_PROGRAMS = sub/base
  35. nobase_fooexec_PROGRAMS = sub/nobase
  36. sub_base_SOURCES = source.c
  37. sub_nobase_SOURCES = source.c
  38. fooexec_LIBRARIES = sub/libbase.a
  39. nobase_fooexec_LIBRARIES = sub/libnobase.a
  40. sub_libbase_a_SOURCES = source.c
  41. sub_libnobase_a_SOURCES = source.c
  42. generated_files = sub/base-gen.h sub/nobase-gen.h sub/base-gen.dat \
  43. sub/nobase-gen.dat sub/base-gen.sh sub/nobase-gen.sh
  44. $(generated_files):
  45. $(MKDIR_P) sub
  46. echo "generated file $@" > $@
  47. CLEANFILES = $(generated_files)
  48. test-install-data: install-data
  49. test -f inst/foo/sub/nobase.h
  50. test ! -f inst/foo/nobase.h
  51. test -f inst/foo/sub/nobase-gen.h
  52. test ! -f inst/foo/nobase-gen.h
  53. test -f inst/foo/base.h
  54. test -f inst/foo/base-gen.h
  55. test -f inst/foo/sub/nobase.dat
  56. test ! -f inst/foo/nobase.dat
  57. test -f inst/foo/sub/nobase-gen.dat
  58. test ! -f inst/foo/nobase-gen.dat
  59. test -f inst/foo/base.dat
  60. test -f inst/foo/base-gen.dat
  61. test ! -f inst/foo/sub/pnobase.sh
  62. test ! -f inst/foo/sub/pnobase-gen.sh
  63. test ! -f inst/foo/pbase.sh
  64. test ! -f inst/foo/pbase-gen.sh
  65. test ! -f inst/foo/sub/pnobase$(EXEEXT)
  66. test ! -f inst/foo/pbase$(EXEEXT)
  67. test ! -f inst/foo/sub/libnobase.a
  68. test ! -f inst/foo/libbase.a
  69. test-install-exec: install-exec
  70. test -f inst/foo/sub/pnobase.sh
  71. test ! -f inst/foo/pnobase.sh
  72. test -f inst/foo/sub/pnobase-gen.sh
  73. test ! -f inst/foo/pnobase-gen.sh
  74. test -f inst/foo/pbase.sh
  75. test -f inst/foo/pbase-gen.sh
  76. test -f inst/foo/sub/pnobase$(EXEEXT)
  77. test ! -f inst/foo/pnobase$(EXEEXT)
  78. test -f inst/foo/pbase$(EXEEXT)
  79. test -f inst/foo/sub/libnobase.a
  80. test ! -f inst/foo/libnobase.a
  81. test -f inst/foo/libbase.a
  82. .PHONY: test-install-exec test-install-data
  83. EOF
  84. mkdir sub
  85. : > sub/base.h
  86. : > sub/nobase.h
  87. : > sub/base.dat
  88. : > sub/nobase.dat
  89. : > sub/base.sh
  90. : > sub/nobase.sh
  91. cat >source.c <<'EOF'
  92. int
  93. main (int argc, char *argv[])
  94. {
  95. return 0;
  96. }
  97. EOF
  98. cp source.c source2.c
  99. rm -f install-sh
  100. $ACLOCAL
  101. $AUTOCONF
  102. $AUTOMAKE -a --copy
  103. ./configure --prefix "$(pwd)/inst" --program-prefix=p
  104. $MAKE
  105. $MAKE test-install-data
  106. $MAKE test-install-exec
  107. $MAKE uninstall
  108. test $(find inst/foo -type f -print | wc -l) -eq 0
  109. $MAKE install-strip
  110. # Likewise, in a VPATH build.
  111. $MAKE uninstall
  112. $MAKE distclean
  113. mkdir build
  114. cd build
  115. ../configure --prefix "$(pwd)/inst" --program-prefix=p
  116. $MAKE
  117. $MAKE test-install-data
  118. $MAKE test-install-exec
  119. $MAKE uninstall
  120. test $(find inst/foo -type f -print | wc -l) -eq 0
  121. :