pr300-lib.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. # Make sure that installing subdirectory libraries works.
  17. # PR/300
  18. required=cc
  19. . test-init.sh
  20. cat >> configure.ac << 'END'
  21. AC_PROG_RANLIB
  22. AC_PROG_CC
  23. AM_PROG_AR
  24. AC_OUTPUT
  25. END
  26. cat > Makefile.am << 'END'
  27. lib_LIBRARIES = subdir/liba.a
  28. subdir_liba_a_SOURCES = a.c
  29. nobase_lib_LIBRARIES = subdir/libb.a
  30. subdir_libb_a_SOURCES = a.c
  31. END
  32. cat > a.c << 'END'
  33. int i = 3;
  34. END
  35. ## A rule in the Makefile should create subdir
  36. # mkdir subdir
  37. $ACLOCAL
  38. $AUTOCONF
  39. $AUTOMAKE --copy --add-missing
  40. # We pass '--libdir' explicitly, to avoid spurious failures due to users
  41. # or distributions possibly overriding '${libdir}' in their $CONFIG_SITE
  42. # file (for example, defining it to '${prefix}/lib64' on 64-bit systems,
  43. # as is the case with openSUSE 12.1). See automake bug#10426.
  44. cwd=$(pwd) || fatal_ "getting current working directory"
  45. ./configure --prefix "$cwd/inst" --libdir "$cwd/inst/lib"
  46. $MAKE
  47. test -f subdir/liba.a
  48. test -f subdir/libb.a
  49. $MAKE install
  50. test -f inst/lib/liba.a
  51. test -f inst/lib/subdir/libb.a
  52. $MAKE uninstall
  53. test -f inst/lib/liba.a && exit 1
  54. test -f inst/lib/subdir/libb.a && exit 1
  55. $MAKE install-strip
  56. test -f inst/lib/liba.a
  57. test -f inst/lib/subdir/libb.a
  58. :