libobj17.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 AC_LIBOBJ accept non-literal arguments.
  17. required=cc
  18. . test-init.sh
  19. cat >> configure.ac << 'END'
  20. AC_PROG_CC
  21. AC_PROG_RANLIB
  22. AM_PROG_AR
  23. foo=${FOO-oops}
  24. AC_LIBSOURCES([quux.c, zardoz.c])
  25. AC_LIBOBJ([$foo])
  26. AC_OUTPUT
  27. END
  28. cat > Makefile.am << 'END'
  29. noinst_LIBRARIES = libtu.a
  30. libtu_a_SOURCES =
  31. libtu_a_LIBADD = $(LIBOBJS)
  32. .PHONY: check-quux check-zardoz
  33. check-quux:
  34. $(AR) t libtu.a | grep quux
  35. $(AR) t libtu.a | grep zardoz && exit 1; exit 0
  36. check-zardoz:
  37. $(AR) t libtu.a | grep zardoz
  38. $(AR) t libtu.a | grep quux && exit 1; exit 0
  39. END
  40. cat > quux.c <<'END'
  41. extern int dummy;
  42. END
  43. cat > zardoz.c <<'END'
  44. extern int dummy;
  45. END
  46. # These might print warnings, but should not error out.
  47. $ACLOCAL
  48. $AUTOMAKE -a
  49. $AUTOCONF
  50. ./configure FOO=quux
  51. $MAKE
  52. ls -l # For debugging.
  53. test -f libtu.a
  54. $MAKE check-quux
  55. $MAKE distclean
  56. ./configure FOO=zardoz
  57. $MAKE
  58. ls -l # For debugging.
  59. test -f libtu.a
  60. $MAKE check-zardoz
  61. :