subpkg.sh 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. # Check subpackage handling.
  17. required=cc
  18. . test-init.sh
  19. mkdir m4
  20. cat >m4/foo.m4 <<'EOF'
  21. AC_DEFUN([FOO],[
  22. AC_PROG_CC
  23. AC_OUTPUT
  24. ])
  25. EOF
  26. cat >>configure.ac <<'END'
  27. AC_CONFIG_MACRO_DIR([m4])
  28. AC_CONFIG_SUBDIRS([lib])
  29. FOO
  30. END
  31. cat >Makefile.am <<'EOF'
  32. SUBDIRS = lib
  33. # Yes, This program is named LDADD. So what?
  34. bin_PROGRAMS = LDADD
  35. LDADD_LDADD = lib/liblib.a
  36. # It's ok to override distdir.
  37. distdir = subpack-1
  38. # Make sure $(distdir) and $(top_distdir) work as expected.
  39. dist-hook:
  40. test -f $(distdir)/LDADD.c
  41. test -f $(top_distdir)/LDADD.c
  42. EOF
  43. cat >LDADD.c <<'EOF'
  44. int lib (void);
  45. int main (void)
  46. {
  47. return lib ();
  48. }
  49. EOF
  50. mkdir lib
  51. mkdir lib/src
  52. cat >lib/configure.ac <<'EOF'
  53. AC_INIT([lib], [2.3])
  54. AM_INIT_AUTOMAKE([subdir-objects])
  55. AC_CONFIG_MACRO_DIR([../m4])
  56. AM_PROG_AR
  57. AC_PROG_RANLIB
  58. AC_CONFIG_HEADERS([config.h:config.hin])
  59. AC_CONFIG_FILES([Makefile])
  60. FOO
  61. EOF
  62. cat >lib/Makefile.am <<'EOF'
  63. noinst_LIBRARIES = liblib.a
  64. liblib_a_SOURCES = src/x.c
  65. dist-hook:
  66. test ! -f $(distdir)/LDADD.c
  67. test -f $(top_distdir)/LDADD.c
  68. test -f $(distdir)/src/x.c
  69. test ! -f $(top_distdir)/src/x.c
  70. EOF
  71. cat >lib/src/x.c <<'EOF'
  72. #include <config.h>
  73. int lib (void)
  74. {
  75. return 0;
  76. }
  77. EOF
  78. $ACLOCAL
  79. $AUTOCONF -Werror -Wall
  80. $AUTOMAKE -Wno-override
  81. cd lib
  82. $ACLOCAL
  83. $FGREP 'm4_include([../m4/foo.m4])' aclocal.m4
  84. $AUTOCONF
  85. $AUTOHEADER
  86. $AUTOMAKE -Wno-override --add-missing
  87. cd ..
  88. ./configure
  89. $MAKE
  90. $MAKE distcheck
  91. test ! -e subpack-1 # Make sure distcheck cleans up after itself.
  92. test -f subpack-1.tar.gz
  93. :