silent-lt.sh 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #!/bin/sh
  2. # Copyright (C) 2009-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. # Check silent-rules mode for C, with libtool, both with and without
  17. # automatic dependency tracking.
  18. required='cc libtoolize'
  19. . test-init.sh
  20. mkdir sub
  21. cat >>configure.ac <<'EOF'
  22. AC_CONFIG_FILES([sub/Makefile])
  23. AC_PROG_CC
  24. AM_PROG_AR
  25. AC_PROG_LIBTOOL
  26. AC_OUTPUT
  27. EOF
  28. cat > Makefile.am <<'EOF'
  29. # Need generic and non-generic rules.
  30. lib_LTLIBRARIES = libfoo.la libbar.la
  31. libbar_la_CFLAGS = $(AM_CFLAGS)
  32. SUBDIRS = sub
  33. EOF
  34. cat > sub/Makefile.am <<'EOF'
  35. AUTOMAKE_OPTIONS = subdir-objects
  36. # Need generic and non-generic rules.
  37. lib_LTLIBRARIES = libbaz.la libbla.la
  38. libbla_la_CFLAGS = $(AM_CFLAGS)
  39. EOF
  40. cat > libfoo.c <<'EOF'
  41. int main ()
  42. {
  43. return 0;
  44. }
  45. EOF
  46. cp libfoo.c libbar.c
  47. cp libfoo.c sub/libbaz.c
  48. cp libfoo.c sub/libbla.c
  49. libtoolize
  50. $ACLOCAL
  51. $AUTOMAKE --add-missing
  52. $AUTOCONF
  53. for config_args in \
  54. '--enable-dependency-tracking' \
  55. '--disable-dependency-tracking' \
  56. ; do
  57. ./configure --enable-silent-rules $config_args
  58. run_make -O
  59. $EGREP ' (-c|-o)' stdout && exit 1
  60. grep 'mv ' stdout && exit 1
  61. grep ' CC .*foo\.' stdout
  62. grep ' CC .*bar\.' stdout
  63. grep ' CC .*baz\.' stdout
  64. grep ' CC .*bla\.' stdout
  65. grep ' CCLD .*foo' stdout
  66. grep ' CCLD .*bar' stdout
  67. grep ' CCLD .*baz' stdout
  68. grep ' CCLD .*bla' stdout
  69. $MAKE clean
  70. run_make -O V=1
  71. grep ' -c' stdout
  72. grep ' -o libfoo' stdout
  73. # The libtool command line can contain e.g. a '--tag=CC' option.
  74. sed 's/--tag=[^ ]*/--tag=x/g' stdout | $EGREP '(CC|LD) ' && exit 1
  75. $MAKE distclean
  76. done
  77. :