libobj19.sh 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 support for AC_CONFIG_LIBOBJ_DIR.
  17. required=cc
  18. . test-init.sh
  19. cat >> configure.ac << 'END'
  20. AC_CONFIG_LIBOBJ_DIR([libobj-dir])
  21. AC_PROG_CC
  22. AM_PROG_AR
  23. AC_PROG_RANLIB
  24. AC_LIBOBJ([foobar])
  25. AC_OUTPUT
  26. END
  27. cat > Makefile.am << 'END'
  28. AUTOMAKE_OPTIONS = subdir-objects
  29. noinst_LIBRARIES = libtu.a
  30. libtu_a_SOURCES =
  31. libtu_a_LIBADD = $(LIBOBJS)
  32. ## Hack with this variable ans with extra make recursion in the check-local
  33. ## rule are required for when we move this Makefile in a subdir, later.
  34. my_distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)
  35. check-local:
  36. (cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) distdir)
  37. ls -l $(top_srcdir)/* $(top_builddir)/* $(my_distdir)/*
  38. test -f libtu.a
  39. test ! -r $(top_srcdir)/foobar.c
  40. test -f $(top_srcdir)/libobj-dir/foobar.c
  41. test ! -r $(my_distdir)/foobar.c
  42. test -f $(my_distdir)/libobj-dir/foobar.c
  43. $(AR) t libtu.a
  44. $(AR) t libtu.a | grep foobar
  45. END
  46. mkdir libobj-dir
  47. cat > libobj-dir/foobar.c << 'END'
  48. extern int dummy;
  49. END
  50. cp "$am_scriptdir/ar-lib" . || fatal_ "fetching auxiliary script 'ar-lib'"
  51. $ACLOCAL
  52. $AUTOCONF
  53. $AUTOMAKE
  54. ./configure
  55. $MAKE
  56. $MAKE check
  57. $MAKE distcheck
  58. # Same check, but with the Makefile.am using $(LIBOBJS) not being
  59. # the top-level one.
  60. $MAKE distclean
  61. rm -rf autom4te*.cache aclocal.m4 configure
  62. mkdir sub
  63. mv -f Makefile.am sub
  64. echo SUBDIRS = sub > Makefile.am
  65. sed '/^AC_OUTPUT/i\
  66. AC_CONFIG_FILES([sub/Makefile])
  67. ' configure.ac > t
  68. mv -f t configure.ac
  69. cat configure.ac # For debugging.
  70. $ACLOCAL
  71. $AUTOCONF
  72. $AUTOMAKE
  73. ./configure
  74. $MAKE
  75. $MAKE check
  76. $MAKE distcheck
  77. :