1#! /bin/sh 2# build-relink2.test - check to see whether shlibpath overrides runpath 3 4# Test script header. 5need_prefix=yes 6if test -z "$srcdir"; then 7 srcdir=`echo "$0" | sed 's%/[^/]*$%%'` 8 test "$srcdir" = "$0" && srcdir=. 9 test "${VERBOSE+set}" != "set" && VERBOSE=yes 10fi 11. $srcdir/defs || exit 1 12 13# Check that things are built. 14if (test -f $prefix/lib/extra/libl3.la || test -f $prefix/lib/libl3.la) \ 15 && cd ../depdemo && test -f l3/libl3.la; then : 16else 17 echo "You must run depdemo-inst.test before $0" 1>&2 18 exit 77 19fi 20 21# Check to make sure we have a dynamic library. 22library_names=NONE 23eval `grep '^library_names=' ./l3/libl3.la 2>/dev/null` 24 25if test "$library_names" = NONE; then 26 echo "library_names not set in ../depdemo/l3/libl3.la" 1>&2 27 exit 1 28elif test -z "$library_names"; then 29 echo "= Exiting: ../depdemo/l3/libl3.la is not a shared library" 30 exit 77 31fi 32 33# Unfortunately, we need access to libtool internals for this test. 34objdir=NONE 35eval `grep '^objdir=' ./libtool 2>/dev/null` 36if test "$objdir" = NONE; then 37 echo "objdir not set in ../depdemo/libtool" 1>&2 38 exit 1 39fi 40 41shlibpath_overrides_runpath=NONE 42eval `grep '^shlibpath_overrides_runpath=' ./libtool 2>/dev/null` 43if test "$shlibpath_overrides_runpath" = NONE; then 44 echo "shlibpath_overrides_runpath not set in ../depdemo/libtool" 1>&2 45 exit 1 46fi 47 48hardcode_action=NONE 49eval `grep '^hardcode_action=' ./libtool 2>/dev/null` 50if test "$hardcode_action" = NONE; then 51 echo "hardcode_action not set in ../depdemo/libtool" 1>&2 52 exit 1 53fi 54 55hardcode_direct=NONE 56eval `grep '^hardcode_direct=' ./libtool 2>/dev/null` 57if test "$hardcode_direct" = NONE; then 58 echo "hardcode_direct not set in ../depdemo/libtool" 1>&2 59 exit 1 60fi 61 62hardcode_into_libs=NONE 63eval `grep '^hardcode_into_libs=' ./libtool 2>/dev/null` 64if test "$hardcode_into_libs" = NONE; then 65 echo "hardcode_into_libs not set in ../depdemo/libtool" 1>&2 66 exit 1 67fi 68 69./depdemo # so that it links on-demand if needed 70 71echo "removing libl3.la from ../depdemo/l3" 72rm -rf l3/libl3.la l3/$objdir 73 74echo "running ../depdemo/depdemo" 75if ./depdemo || 76 # On AIX 4.1, when the installed copy of libl3 is loaded, it brings 77 # with it the installed copies of libl1 and libl2, with disjoint 78 # counters var_l1 and var_l2. This is arguably acceptable behavior, 79 # but it's definitely not enough of a reason for the test to fail. 80 ./depdemo -alt; then 81 : 82elif test "x,$hardcode_action,$hardcode_direct" = x,relink,yes; then 83 echo "Ok, uninstalled programs fail after uninstalled libraries are removed" 84 echo "This works in other configurations, but not in this particular one" 85else 86 echo "= Exiting: ../depdemo/depdemo does not run, maybe libl3 was not installed" 87 exit 1 88fi 89 90echo "linking a broken ../depdemo/l3/libl3.la" 91if (cd l3; $make libl3.la libl3_la_OBJECTS=../l2/l2.lo); then 92 : 93else 94 echo "= Exiting: cannot link broken libl3.la" 95 exit 1 96fi 97rm -f l3/libl3.la 98 99echo "running ../depdemo/depdemo with broken libl3.la" 100if (./depdemo) 2>&1; then 101 echo "= Exiting: ../depdemo/depdemo runs even though libl3.la is incomplete" 102 echo "shlibpath_overrides_runpath should be set to no" 103 exit 1 104else 105 echo "Failed, as expected" 106fi 107 108if test "x$hardcode_action" = xrelink; then 109 echo "= Exiting: install-time relinking is required" 110 exit 0 111fi 112 113if test "$shlibpath_overrides_runpath" != yes; then 114 rm -f $objdir/lt-depdemo || exit 1 115 cp $objdir/depdemo $objdir/lt-depdemo || exit 1 116 echo "running ../depdemo/depdemo with installed libl3.la" 117 if ./depdemo; then 118 echo "Worked, as expected" 119 else 120 echo "shlibpath_overrides_runpath should be set to yes" 121 status=1 122 fi 123 rm -f $objdir/lt-depdemo 124fi 125 126exit $status 127