#! /bin/sh

set -e

. ${srcdir}/common

RESULT="-DOTHER -I/other/include -L/other/lib -Wl,--as-needed -lother"
run_test --cflags --libs other
run_test --libs --cflags other
run_test --cflags-only-I --cflags-only-other --libs-only-l --libs-only-L \
    --libs-only-other other

RESULT="-I/other/include -lother"
run_test --cflags-only-I --libs-only-l other
run_test --libs-only-l --cflags-only-I other

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

RESULT="-I/other/include -L/other/lib"
run_test --cflags-only-I --libs-only-L other
run_test --libs-only-L --cflags-only-I other

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

RESULT="-I/other/include -Wl,--as-needed"
run_test --cflags-only-I --libs-only-other other
run_test --libs-only-other --cflags-only-I other

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

RESULT="-I/other/include -L/other/lib -lother"
run_test --cflags-only-I --libs-only-L --libs-only-l other
run_test --libs-only-l --libs-only-L --cflags-only-I other

RESULT="-DOTHER -L/other/lib -lother"
run_test --cflags-only-other --libs-only-L --libs-only-l other
run_test --libs-only-l --libs-only-L --cflags-only-other other

RESULT="-I/other/include -Wl,--as-needed -lother"
run_test --cflags-only-I --libs-only-other --libs-only-l other
run_test --libs-only-l --libs-only-other --cflags-only-I other

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

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

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

RESULT="-DOTHER -I/other/include -lother"
run_test --cflags --libs-only-l other
run_test --cflags-only-I --cflags-only-other --libs-only-l other

RESULT="-DOTHER -I/other/include -L/other/lib"
run_test --cflags --libs-only-L other
run_test --cflags-only-I --cflags-only-other --libs-only-L other

RESULT="-DOTHER -I/other/include -Wl,--as-needed"
run_test --cflags --libs-only-other other
run_test --cflags-only-I --cflags-only-other --libs-only-other other

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

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