subobj9.sh 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 PR 312.
  17. #
  18. # == Report ==
  19. # When using non-recursive make to build a libtoolize-library from
  20. # sources in a subdirectory, 'make distcheck' fails because of incomplete
  21. # cleanup. "make clean" tries to remove '*.o' and '.../<file>.lo' but
  22. # forgets '.../<file>.o'.
  23. required='c++ libtoolize'
  24. . test-init.sh
  25. cat > configure.ac << END
  26. AC_INIT([$me], [1.0])
  27. AM_INIT_AUTOMAKE([subdir-objects])
  28. AC_PROG_CXX
  29. AM_PROG_AR
  30. AM_PROG_LIBTOOL
  31. AC_CONFIG_FILES([Makefile])
  32. AC_OUTPUT
  33. END
  34. cat > Makefile.am << 'END'
  35. noinst_LTLIBRARIES = libfoo.la
  36. libfoo_la_SOURCES = src/foo.cc .//src/bar.cc # The './/' is meant.
  37. .PHONY: print
  38. print:
  39. @echo BEG1: "$(LTCXXCOMPILE)" :1END
  40. @echo BEG2: "$(CXXLINK)" :2END
  41. END
  42. mkdir src
  43. cat > src/foo.cc << 'END'
  44. int doit2 (void);
  45. int doit (void)
  46. {
  47. return doit2();
  48. }
  49. END
  50. cat > src/bar.cc << 'END'
  51. int doit2 (void)
  52. {
  53. return 23;
  54. }
  55. END
  56. libtoolize --force
  57. $ACLOCAL
  58. $AUTOCONF
  59. $AUTOMAKE -a
  60. ./configure
  61. # Ensure './libtool --help' will use the right tool versions.
  62. export AUTOCONF AUTOMAKE
  63. # Opportunistically check that --tag=CXX is used when supported.
  64. if ./libtool --help | grep tag=TAG; then
  65. run_make -O print
  66. grep 'BEG1: .*--tag=CXX.*--mode=compile.* :1END' stdout
  67. grep 'BEG2: .*--tag=CXX.*--mode=link.* :2END' stdout
  68. fi
  69. $MAKE
  70. run_make -M distcheck
  71. # GNU Make used to complain that the Makefile contained two rules
  72. # for 'src/.dirstamp' and './/src/.dirstamp'.
  73. grep 'overriding commands' output && exit 1
  74. :