posixsubst-ltlibraries.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 LTLIBRARIES primary in a "simple" way.
  18. # Keep this in sync with sister test 'posixsubst-libraries.sh'.
  19. required='cc libtool libtoolize'
  20. . test-init.sh
  21. cat >> configure.ac << 'END'
  22. AC_PROG_CC
  23. AM_PROG_AR
  24. AC_PROG_LIBTOOL
  25. AC_OUTPUT
  26. END
  27. cat > Makefile.am << 'END'
  28. foolibs = libfoo1 libfoo2
  29. barlibs = libbaz
  30. # Also try an empty match suffix, to ensure that the ':=' in there is
  31. # not confused by the parser with an unportable assignment operator.
  32. lib_LTLIBRARIES = $(foolibs:=.la) $(barlibs:z=r.la)
  33. libbar.c:
  34. echo 'int bar(void) { return 0; }' > $@
  35. CLEANFILES = libbar.c # For FreeBSD make.
  36. installcheck-local:
  37. ls -l $(libdir)
  38. test -f $(libdir)/libfoo1.la
  39. test -f $(libdir)/libfoo2.la
  40. test -f $(libdir)/libbar.la
  41. END
  42. echo 'int bar1(void) { return 0; }' > libfoo1.c
  43. echo 'int bar2(void) { return 0; }' > libfoo2.c
  44. libtoolize
  45. $ACLOCAL
  46. $AUTOCONF
  47. $AUTOMAKE -a
  48. cwd=$(pwd) || fatal_ "getting current working directory"
  49. ./configure --prefix="$cwd/_inst"
  50. $MAKE
  51. test -f libfoo2.c
  52. $MAKE install
  53. $MAKE installcheck
  54. $MAKE distcheck
  55. :