#! /bin/sh

set -e

. ${srcdir}/common

RESULT="-lsimple"
if [ "$list_indirect_deps" = no ]; then
    run_test --libs simple
fi

RESULT="-lsimple -lm"
if [ "$list_indirect_deps" = yes ]; then
    run_test --libs simple
fi
run_test --libs --static simple

RESULT=""
run_test --libs fields-blank

RESULT="-L/other/lib -Wl,--as-needed -lother"
run_test --libs other

RESULT="-lother"
run_test --libs-only-l other

RESULT="-L/other/lib"
run_test --libs-only-L other

RESULT="-Wl,--as-needed"
run_test --libs-only-other other

# Try various mixed combinations
RESULT="-L/other/lib -lother"
run_test --libs-only-l --libs-only-L other
run_test --libs-only-L --libs-only-l other

RESULT="-Wl,--as-needed -lother"
run_test --libs-only-l --libs-only-other other
run_test --libs-only-other --libs-only-l other

RESULT="-L/other/lib -Wl,--as-needed"
run_test --libs-only-L --libs-only-other other
run_test --libs-only-other --libs-only-L other

RESULT="-L/other/lib -Wl,--as-needed -lother"
run_test --libs-only-l --libs-only-L --libs-only-other other
run_test --libs --libs-only-l --libs-only-L --libs-only-other other
run_test --libs --libs-only-l other
run_test --libs --libs-only-L other
run_test --libs --libs-only-other other
