libtool7.sh 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #! /bin/sh
  2. # Copyright (C) 2003-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 we allow Libtool's -dlopen/-dlpreopen
  17. # Also check basic support for AM_LIBTOOLFLAGS/LIBTOOLFLAGS
  18. required='cc libtoolize'
  19. . test-init.sh
  20. cat >> configure.ac << 'END'
  21. AC_PROG_CC
  22. AM_PROG_AR
  23. AC_LIBTOOL_DLOPEN
  24. AM_PROG_LIBTOOL
  25. AC_OUTPUT
  26. END
  27. cat > Makefile.am << 'END'
  28. AUTOMAKE_OPTIONS = subdir-objects
  29. AM_LIBTOOLFLAGS = --silent
  30. lib_LTLIBRARIES = libmod1.la mod2.la
  31. libmod1_la_SOURCES = sub/mod1.c
  32. libmod1_la_LDFLAGS = -module
  33. libmod1_la_LIBADD = -dlopen mod2.la
  34. mod2_la_SOURCES = mod2.c
  35. mod2_la_LDFLAGS = -module
  36. mod2_la_LIBTOOLFLAGS =
  37. bin_PROGRAMS = prg
  38. prg_SOURCES = prg.c
  39. prg_LDADD = -dlopen libmod1.la -dlpreopen mod2.la
  40. .PHONY: print
  41. print:
  42. @echo 1BEG: $(prg_DEPENDENCIES) :END1
  43. @echo 2BEG: $(libmod1_la_DEPENDENCIES) :END2
  44. @echo 3BEG: $(LTCOMPILE) :END3
  45. END
  46. mkdir sub liba
  47. cat > sub/mod1.c << 'END'
  48. int mod1 (void)
  49. {
  50. return 1;
  51. }
  52. END
  53. cat > mod2.c << 'END'
  54. int mod2 (void)
  55. {
  56. return 2;
  57. }
  58. END
  59. cat > prg.c << 'END'
  60. int main (void)
  61. {
  62. return 0;
  63. }
  64. END
  65. libtoolize --force --copy
  66. $ACLOCAL
  67. $AUTOCONF
  68. $AUTOMAKE --add-missing --copy
  69. ./configure "--prefix=$(pwd)/_inst"
  70. run_make -M print LIBTOOLFLAGS=--silent
  71. grep '1BEG: libmod1.la mod2.la :END1' output
  72. grep '2BEG: mod2.la :END2' output
  73. grep '3BEG: .*silent.*silent.* :END3' output
  74. test 2 -le $(grep mod2_la_LIBTOOLFLAGS Makefile | wc -l)
  75. $MAKE
  76. run_make -M install LIBTOOLFLAGS=--silent
  77. grep 'silent.*silent.*prg' output
  78. grep 'silent.*silent.*libmod1' output
  79. run_make -M uninstall LIBTOOLFLAGS=--silent
  80. grep 'silent.*silent.*libmod1' output
  81. :