#! /bin/sh # link-order.test - make sure that library linking order matches # Test script header. need_prefix=no if test -z "$srcdir"; then srcdir=`echo "$0" | sed 's%/[^/]*$%%'` test "$srcdir" = "$0" && srcdir=. test "${VERBOSE+set}" != "set" && VERBOSE=yes fi . $srcdir/defs || exit 1 retcode=0 eval `$libtool --config | $EGREP '^(hardcode_direct|shrext_cmds)='` module=no eval shared_ext=\"$shrext_cmds\" rm -rf linkorder.dir mkdir linkorder.dir top_dir=`pwd`/linkorder.dir prefix_old=$top_dir/old prefix_new=$top_dir/new srcdir=linkorder.dir/src mkdir $srcdir $prefix_old $prefix_new $prefix_old/lib $prefix_new/lib cat >$srcdir/c.c <$srcdir/a_$i.c <$srcdir/b_$i.c <$srcdir/stdout 2>$srcdir/stderr || retcode=1 cat $srcdir/stdout cat $srcdir/stderr >&2 done case $host in *-*-aix* | *-*-interix*) ;; # These systems have different path syntax *) # Do not error if we do not relink (e.g. static-only systems) case $hardcode_direct in yes) if $EGREP relinking $srcdir/stderr; then if $EGREP " .*\/new\/lib/libb$shared_ext .*\/old\/lib/libcee$shared_ext" $srcdir/stdout; then :; else echo "$0: wrong link order" 1>&2 retcode=1 fi fi ;; *) if $EGREP relinking $srcdir/stderr; then if $EGREP ' -L.*\/new\/lib -lb -L.*\/old\/lib -lcee' $srcdir/stdout; then :; else echo "$0: wrong link order" 1>&2 retcode=1 fi fi ;; esac ;; esac for i in old new; do cat >$srcdir/main_$i.c <&2 if test "X$host" != "X$build"; then echo "This may be ok since you seem to be cross-compiling." 1>&2 retcode=77 else retcode=1 fi fi done rm -rf $top_dir exit $retcode