#! /bin/sh# build-relink.test - check to see whether shlibpath overrides runpath# Test script header.need_prefix=yesif test -z "$srcdir"; thensrcdir=`echo "$0" | sed 's%/[^/]*$%%'`test "$srcdir" = "$0" && srcdir=.test "${VERBOSE+set}" != "set" && VERBOSE=yesfi. $srcdir/defs || exit 1# Check that things are built.if test -f $prefix/lib/libhello.la && cd ../demo && test -f libhello.la; then :elseecho "You must run demo-inst.test before $0" 1>&2exit 77fi# Check to make sure we have a dynamic library.library_names=NONEeval `grep '^library_names=' ./libhello.la 2>/dev/null`if test "$library_names" = NONE; thenecho "library_names not set in ../demo/libhello.la" 1>&2exit 1elif test -z "$library_names"; thenecho "= Exiting: ../demo/libhello.la is not a shared library"exit 77fi# Unfortunately, we need access to libtool internals for this test.objdir=NONEeval `grep '^objdir=' ./libtool 2>/dev/null`if test "$objdir" = NONE; thenecho "objdir not set in ../demo/libtool" 1>&2exit 1fishlibpath_overrides_runpath=NONEeval `grep '^shlibpath_overrides_runpath=' ./libtool 2>/dev/null`if test "$shlibpath_overrides_runpath" = NONE; thenecho "shlibpath_overrides_runpath not set in ../demo/libtool" 1>&2exit 1fihardcode_action=NONEeval `grep '^hardcode_action=' ./libtool 2>/dev/null`if test "$hardcode_action" = NONE; thenecho "hardcode_action not set in ../demo/libtool" 1>&2exit 1fihardcode_direct=NONEeval `grep '^hardcode_direct=' ./libtool 2>/dev/null`if test "$hardcode_direct" = NONE; thenecho "hardcode_direct not set in ../demo/libtool" 1>&2exit 1fihardcode_into_libs=NONEeval `grep '^hardcode_into_libs=' ./libtool 2>/dev/null`if test "$hardcode_into_libs" = NONE; thenecho "hardcode_into_libs not set in ../demo/libtool" 1>&2exit 1fi./hell # so that it links on-demand if neededecho "removing libhello.la from ../demo"rm -f libhello.la $objdir/libhello.*echo "running ../demo/hell"if ./hell; then:elif test "x,$hardcode_action,$hardcode_direct" = x,relink,yes; thenecho "Ok, uninstalled programs fail after uninstalled libraries are removed"echo "This works in other configurations, but not in this particular one"elseecho "= Exiting: ../demo/hell does not run, maybe libhello was not installed"exit 1fiecho "linking a broken ../demo/libhello.la"if $make libhello.la libhello_la_OBJECTS=hello.lo; then:elseecho "= Exiting: cannot link broken libhello.la"exit 1firm -f libhello.laecho "running ../demo/hell with broken libhello.la"if (./hell) 2>&1; thenecho "= Exiting: ../demo/hell runs even though libhello.la is incomplete"echo "shlibpath_overrides_runpath should be set to no"exit 1elseecho "Failed, as expected"fiif test "x$hardcode_action" = xrelink; thenecho "= Exiting: install-time relinking is required"exit 0fiif test "$shlibpath_overrides_runpath" != yes; thenrm -f $objdir/lt-hell$EXEEXT || exit 1cp $objdir/hell$EXEEXT $objdir/lt-hell$EXEEXT || exit 1echo "running ../demo/hell with installed libhello.la"if ./hell; thenecho "Worked, as expected"elseecho "shlibpath_overrides_runpath should be set to yes"status=1firm -f $objdir/lt-hell$EXEEXTfiexit $status