ltinit.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/bin/sh
  2. # Copyright (C) 2011-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 that libtool support works correctly when "newer" libtool
  17. # interface (with LT_INIT etc.) is used (this interface has been
  18. # present since libtool 1.9b, circa 2004).
  19. required='cc libtoolize'
  20. . test-init.sh
  21. cat >>configure.ac <<'END'
  22. AC_PROG_CC
  23. AM_PROG_AR
  24. dnl Older libtool versions don't define LT_PREREQ :-(
  25. m4_ifdef([LT_PREREQ],
  26. [LT_PREREQ([2.0])],
  27. [m4_fatal([Libtool version too old], [63])])
  28. LT_INIT([dlopen])
  29. AC_OUTPUT
  30. END
  31. cat >Makefile.am <<'END'
  32. lib_LTLIBRARIES = libfoo.la
  33. END
  34. cat > libfoo.c <<'END'
  35. int foo (void)
  36. {
  37. return 1;
  38. }
  39. END
  40. libtoolize
  41. # Skip if older libtool (pre-2.0) is used.
  42. { $ACLOCAL && $AUTOCONF; } || {
  43. if test $? -eq 63; then
  44. skip_ "libtool is too old (probably < 2.0)"
  45. else
  46. exit 1
  47. fi
  48. }
  49. $EGREP 'LT_(INIT|PREREQ)' configure && exit 1 # Sanity check.
  50. $AUTOMAKE -a
  51. ./configure --prefix="$(pwd)/inst" >stdout || { cat stdout; exit 1; }
  52. cat stdout
  53. grep '^checking.*dlfcn\.h.* no$' stdout || grep '^checking.*dlopen' stdout
  54. $MAKE
  55. $MAKE install
  56. $MAKE distcheck
  57. :