libtool3.sh 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. # Try to build and package a program linked to a Libtool library.
  17. # Also make sure we do not bloat the Makefile with unneeded rules.
  18. required='cc libtoolize'
  19. . test-init.sh
  20. cat >> configure.ac << 'END'
  21. AC_PROG_CC
  22. AM_PROG_AR
  23. AM_PROG_LIBTOOL
  24. AC_OUTPUT
  25. END
  26. cat > Makefile.am << 'END'
  27. # FIXME: stop disabling the warnings in the 'unsupported' category
  28. # FIXME: once the 'subdir-objects' option has been mandatory.
  29. AUTOMAKE_OPTIONS = -Wno-unsupported
  30. lib_LTLIBRARIES = lib0.la liba/liba.la
  31. lib0_la_SOURCES = 0.c
  32. liba_liba_la_SOURCES = liba/a.c
  33. bin_PROGRAMS = 1
  34. 1_SOURCES = sub/1.c
  35. 1_LDADD = lib0.la liba/liba.la
  36. END
  37. mkdir liba sub
  38. cat > 0.c << 'END'
  39. int
  40. zero (void)
  41. {
  42. return 0;
  43. }
  44. END
  45. cat > sub/1.c << 'END'
  46. int zero ();
  47. int
  48. main (void)
  49. {
  50. return zero ();
  51. }
  52. END
  53. cat > liba/a.c << 'END'
  54. int
  55. a (void)
  56. {
  57. return 'a';
  58. }
  59. END
  60. # Use --copy to workaround a bug in Cygwin's 'cp -p' during distcheck.
  61. # (This bug is already exhibited by subobj9.sh.) In brief: Cygwin's
  62. # 'cp -p' tries to preserve group and owner of the source and fails
  63. # to do so under normal accounts. With --copy we ensure we own all files.
  64. libtoolize --force --copy
  65. $ACLOCAL
  66. $AUTOCONF
  67. $AUTOMAKE --add-missing --copy
  68. # We need explicit rules to build 1.o and a.lo. Make sure
  69. # Automake did not output additional rules for 1.lo and and a.lo.
  70. $FGREP '1.o:' Makefile.in
  71. $FGREP '1.lo:' Makefile.in && exit 1
  72. $FGREP 'a.o:' Makefile.in && exit 1
  73. $FGREP 'a.lo:' Makefile.in
  74. ./configure
  75. $MAKE
  76. $MAKE distcheck
  77. :