condman3.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #! /bin/sh
  2. # Copyright (C) 2010-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. # Make sure conditionals work with man pages.
  17. . test-init.sh
  18. cat >> configure.ac << 'END'
  19. AM_CONDITIONAL([COND], [test x"$FOO" = x"true"])
  20. AC_OUTPUT
  21. END
  22. cat > Makefile.am << 'END'
  23. if COND
  24. man_MANS = foo.1
  25. man4_MANS = 6.man
  26. else
  27. man_MANS = bar.2 baz.1
  28. man5_MANS = zap.5
  29. endif
  30. .PHONY: test1 test2
  31. test1:
  32. find $(mandir) ;: For debugging.
  33. test -f $(mandir)/man1/foo.1
  34. test -f $(mandir)/man4/6.4
  35. test ! -f $(mandir)/man2/bar.2
  36. test ! -f $(mandir)/man1/baz.1
  37. test ! -f $(mandir)/man5/zap.5
  38. test2:
  39. find $(mandir) ;: For debugging.
  40. test -f $(mandir)/man2/bar.2
  41. test -f $(mandir)/man1/baz.1
  42. test -f $(mandir)/man5/zap.5
  43. test ! -f $(mandir)/man1/foo.1
  44. test ! -f $(mandir)/man4/6.4
  45. test ! -f $(mandir)/man4/6.man
  46. END
  47. $ACLOCAL
  48. $AUTOMAKE
  49. $AUTOCONF
  50. $EGREP 'MANS|\.([123456789]|man)' Makefile.in # For debugging.
  51. mkdir build
  52. cd build
  53. ../configure FOO=true --prefix="$(pwd)/_inst"
  54. $EGREP 'MANS|\.([123456789]|man)' Makefile # For debugging.
  55. touch foo.1 6.man
  56. $MAKE install
  57. $MAKE test1
  58. cd ..
  59. ./configure FOO=false --prefix="$(pwd)/_inst"
  60. $EGREP 'MANS|\.([123456789]|man)' Makefile # For debugging.
  61. touch bar.2 baz.1 zap.5
  62. $MAKE install
  63. $MAKE test2
  64. :