posixsubst-programs.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. # Test that POSIX variable expansion '$(var:str=rpl)' works when used
  17. # with the PROGRAMS primary.
  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. t1 = foo1 foo2
  26. t2 = barx bar2
  27. # Also try an empty match suffix, to ensure that the ':=' in there is
  28. # not confused by the parser with an unportable assignment operator.
  29. bin_PROGRAMS = $(t1:=-p) $(t2:2=y)
  30. installcheck-local:
  31. ls -l $(prefix)/bin
  32. test -f $(prefix)/bin/foo1-p$(EXEEXT)
  33. test -x $(prefix)/bin/foo1-p$(EXEEXT)
  34. test -f $(prefix)/bin/foo2-p$(EXEEXT)
  35. test -x $(prefix)/bin/foo2-p$(EXEEXT)
  36. test -f $(prefix)/bin/barx$(EXEEXT)
  37. test -x $(prefix)/bin/barx$(EXEEXT)
  38. test -f $(prefix)/bin/bary$(EXEEXT)
  39. test -x $(prefix)/bin/bary$(EXEEXT)
  40. END
  41. for f in foo1-p.c foo2-p.c barx.c bary.c; do
  42. echo 'int main(void) { return 0; }' > $f
  43. done
  44. $ACLOCAL
  45. $AUTOCONF
  46. $AUTOMAKE
  47. cwd=$(pwd) || fatal_ "getting current working directory"
  48. ./configure --prefix="$cwd/_inst"
  49. $MAKE
  50. $MAKE install
  51. $MAKE installcheck
  52. $MAKE distcheck
  53. :