ccnoco-deps.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #! /bin/sh
  2. # Copyright (C) 2013-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 that dependency tracking can also work with compilers that
  17. # doesn't understand '-c -o', even if the AM_PROG_CC_C_O macro is not
  18. # explicitly called.
  19. required=gcc # For 'cc-no-c-o'.
  20. . test-init.sh
  21. echo '#define myStr "Hello"' > foobar.h
  22. cat > foo.c << 'END'
  23. #include <stdio.h>
  24. #include "foobar.h"
  25. int main (void)
  26. {
  27. printf ("%s\n", myStr);
  28. return 0;
  29. }
  30. END
  31. cat > Makefile.am <<'END'
  32. bin_PROGRAMS = foo
  33. foo_SOURCES = foo.c foobar.h
  34. check-deps: all
  35. test -n '$(DEPDIR)' && test -d '$(DEPDIR)'
  36. ls -l $(DEPDIR)
  37. grep 'stdio\.h' $(DEPDIR)/foo.Po
  38. grep 'foobar\.h' $(DEPDIR)/foo.Po
  39. check-updated: all
  40. is_newest foo$(EXEEXT) foobar.h
  41. END
  42. # We deliberately don't invoke AM_PROG_CC_C_O here.
  43. cat >> configure.ac << 'END'
  44. AC_PROG_CC
  45. AC_OUTPUT
  46. END
  47. $ACLOCAL
  48. $AUTOCONF
  49. $AUTOMAKE --add-missing
  50. # Make sure the compiler doesn't understand '-c -o'.
  51. CC=$am_testaux_builddir/cc-no-c-o; export CC
  52. ./configure >stdout || { cat stdout; exit 1; }
  53. cat stdout
  54. $EGREP 'understands? -c and -o together.* no$' stdout
  55. grep '^checking dependency style .*\.\.\. gcc' stdout
  56. $MAKE check-deps
  57. if ! cross_compiling; then
  58. ./foo
  59. test "$(./foo)" = Hello
  60. fi
  61. $sleep
  62. echo '#define myStr "Howdy"' > foobar.h
  63. $MAKE check-updated
  64. if ! cross_compiling; then
  65. ./foo
  66. test "$(./foo)" = Howdy
  67. fi
  68. :