posixsubst-libraries.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 LIBRARIES primary in a "simple" way.
  18. # Keep this in sync with sister test 'posixsubst-ltlibraries.sh'.
  19. required=cc
  20. . test-init.sh
  21. cat >> configure.ac << 'END'
  22. AC_PROG_CC
  23. AC_PROG_RANLIB
  24. AM_PROG_AR
  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_LIBRARIES = $(foolibs:=.a) $(barlibs:z=r.a)
  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.a
  39. test -f $(libdir)/libfoo2.a
  40. test -f $(libdir)/libbar.a
  41. END
  42. echo 'int bar1(void) { return 0; }' > libfoo1.c
  43. echo 'int bar2(void) { return 0; }' > libfoo2.c
  44. $ACLOCAL
  45. $AUTOCONF
  46. $AUTOMAKE -a
  47. cwd=$(pwd) || fatal_ "getting current working directory"
  48. ./configure --prefix="$cwd/_inst"
  49. $MAKE
  50. test -f libfoo2.c
  51. $MAKE install
  52. $MAKE installcheck
  53. $MAKE distcheck
  54. :