2
0

cond33.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/bin/sh
  2. # Copyright (C) 2004-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 conditionally-defined install directories are handled
  17. # correctly.
  18. # Report from Ralf Corsepius.
  19. . test-init.sh
  20. cat >>configure.ac <<'EOF'
  21. AM_CONDITIONAL([INC], [test -z "$two"])
  22. AC_OUTPUT
  23. EOF
  24. cat > Makefile.am <<'EOF'
  25. if INC
  26. include_foodir = $(includedir)/foo
  27. include_foo_HEADERS = foo.h
  28. else
  29. bardir = $(bindir)
  30. dist_bar_SCRIPTS = x.sh
  31. endif
  32. foo.h x.sh:
  33. :>$@
  34. .PHONY: distdircheck
  35. distdircheck: distdir
  36. test -f $(distdir)/foo.h
  37. test -f $(distdir)/x.sh
  38. EOF
  39. $ACLOCAL
  40. $AUTOCONF
  41. $AUTOMAKE
  42. cwd=$(pwd) || fatal_ "cannot get current directory"
  43. mkdir nowhere
  44. chmod a-w nowhere
  45. ./configure --prefix="$cwd"/nowhere --bindir="$cwd"/bin \
  46. --includedir="$cwd"/inc
  47. $MAKE installdirs
  48. test ! -e bin
  49. test -d inc/foo
  50. test ! -e inc/foo/foo.h
  51. rm -rf inc
  52. $MAKE install
  53. test ! -e bin
  54. test -f inc/foo/foo.h
  55. $MAKE distdircheck
  56. rm -rf inc
  57. ./configure two=two --prefix="$cwd"/nowhere --bindir="$cwd"/bin \
  58. --includedir="$cwd"/inc
  59. $MAKE install
  60. test ! -e inc
  61. test -f bin/x.sh
  62. rm -rf inc
  63. $MAKE installdirs
  64. test ! -e inc
  65. test -d bin
  66. $MAKE distdircheck
  67. :