depend5.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #! /bin/sh
  2. # Copyright (C) 2008-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 _AM_OUTPUT_DEPENDENCY_COMMANDS works with eval-style
  17. # quoting in $CONFIG_FILES, done by newer Autoconf.
  18. required=cc
  19. . test-init.sh
  20. cat >>configure.ac << END
  21. AC_PROG_CC
  22. AC_OUTPUT
  23. END
  24. cat > Makefile.am << END
  25. bin_PROGRAMS = foo
  26. foo_SOURCES = foo.c foo.h
  27. END
  28. cat >foo.c << END
  29. #include "foo.h"
  30. END
  31. : >foo.h
  32. $ACLOCAL
  33. $AUTOMAKE
  34. $AUTOCONF
  35. ./configure --enable-dependency-tracking
  36. if test -d .deps; then
  37. depdir=.deps
  38. elif test -d _deps; then
  39. depdir=_deps
  40. else
  41. depdir=
  42. fi
  43. # For the fun of it, we should also cope with Makefile names
  44. # that contain weird characters and newer.
  45. # Pick the first name that the file system will accept.
  46. for name in \
  47. 'weird name with $ `#() &! characters"' \
  48. 'weird name with $ `#() characters"' \
  49. 'weird name with characters'
  50. do
  51. cp Makefile.in "$name.in" && break || :
  52. done
  53. for arg in Makefile \
  54. --file=Makefile \
  55. "--file=$name"
  56. do
  57. rm -rf .deps _deps
  58. ./config.status "$arg" depfiles >stdout 2>stderr ||
  59. { cat stdout; cat stderr >&2; exit 1; }
  60. cat stdout
  61. cat stderr >&2
  62. grep '[Nn]o such file' stderr && exit 1
  63. if test -n "$depdir"; then
  64. test -d $depdir || exit 1
  65. fi
  66. done
  67. :