libobj12.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #! /bin/sh
  2. # Copyright (C) 2002-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 if a file can be mentioned in LIBOBJS and explicitly.
  17. # (See libobj13.sh for the LTLIBRARIES check.)
  18. . test-init.sh
  19. cat >> configure.ac << 'END'
  20. AC_PROG_CC
  21. AM_PROG_AR
  22. AC_PROG_RANLIB
  23. AC_LIBOBJ([foo])
  24. AC_LIBOBJ([bar])
  25. AC_OUTPUT
  26. END
  27. cat > Makefile.am << 'END'
  28. noinst_LIBRARIES = libfoo.a libbar.a
  29. noinst_PROGRAMS = p1 p2
  30. libfoo_a_SOURCES =
  31. libfoo_a_LIBADD = @LIBOBJS@
  32. libbar_a_SOURCES = foo.c
  33. p1_SOURCES =
  34. p1_LDADD = @LIBOBJS@
  35. p2_SOURCES = bar.c
  36. END
  37. : > ar-lib
  38. : > foo.c
  39. : > bar.c
  40. $ACLOCAL
  41. # This however should be diagnosed, since foo.c and bar.c are in @LIBOBJS@.
  42. cat >> Makefile.am << 'END'
  43. libfoo_a_SOURCES += foo.c
  44. p1_SOURCES += bar.c
  45. END
  46. AUTOMAKE_fails
  47. grep 'foo\.c.*explicitly mentioned' stderr
  48. grep 'bar\.c.*explicitly mentioned' stderr
  49. # Global 'LDADD' can also come into play.
  50. cat > Makefile.am << 'END'
  51. noinst_PROGRAMS = a b
  52. LDADD = @LIBOBJS@
  53. END
  54. $AUTOMAKE
  55. grep 'a_DEPENDENCIES.*LIBOBJS' Makefile.in
  56. cat >> Makefile.am << 'END'
  57. a_SOURCES = foo.c
  58. END
  59. AUTOMAKE_fails
  60. grep 'foo\.c.*explicitly mentioned' stderr
  61. :