2
0

posixsubst-ldadd.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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
  17. # when used in LDADD.
  18. required=cc
  19. . test-init.sh
  20. cat >> configure.ac << 'END'
  21. AC_PROG_CC
  22. AC_PROG_RANLIB
  23. AM_PROG_AR
  24. AC_OUTPUT
  25. END
  26. cat > Makefile.am << 'END'
  27. u = libquux1.lib libquux2.lib
  28. v = libquux1
  29. w = none
  30. zardozdir = $(prefix)/zardoz
  31. zardoz_PROGRAMS = foo bar
  32. noinst_LIBRARIES = libquux1.a libquux2.a libquux3.a
  33. # Also try an empty match suffix, to ensure that the ':=' in there is
  34. # not confused by the parser with an unportable assignment operator.
  35. LDADD = $(u:.lib=.a)
  36. bar_LDADD = $(v:=.a) libquux2.a $(w:none=libquux3.a)
  37. libquux1.c:
  38. echo 'int quux1(void) { return 0; }' > $@
  39. CLEANFILES = libquux1.c # For FreeBSD make.
  40. END
  41. cat > foo.c <<'END'
  42. int main(void)
  43. {
  44. int quux1(void), quux2(void);
  45. return quux1() + quux2();
  46. }
  47. END
  48. cat > bar.c <<'END'
  49. int main(void)
  50. {
  51. int quux1(void), quux2(void), quux3(void);
  52. return quux1() + quux2() + quux3();
  53. }
  54. END
  55. echo 'int quux2(void) { return 0; }' > libquux2.c
  56. echo 'int quux3(void) { return 0; }' > libquux3.c
  57. $ACLOCAL
  58. $AUTOCONF
  59. $AUTOMAKE -a
  60. ./configure
  61. $MAKE
  62. test -f libquux1.c
  63. $MAKE distcheck
  64. :