diff --git a/api b/api index 06243e2..1d7c4a7 160000 --- a/api +++ b/api @@ -1 +1 @@ -Subproject commit 06243e2673ffa4b050c957276d6cb18b0feb981f +Subproject commit 1d7c4a7986d35403dadb29d0d7d67a6c092ad42d diff --git a/build b/build index 789677e..f3a040e 100755 --- a/build +++ b/build @@ -186,13 +186,20 @@ cc() ( ### DEPENDENCIES use() { local option=$1 requisite=$2 lib=$3; shift 3 - local enabled=${!option} + local enabled=${!option} found=0 _cflags _ldflags if (( enabled )); then - if haslib "$lib"; then - for lib in "$lib" "$@"; do - haslib "$lib" && ldflags+=( -l"$lib" ) - done + for lib in "$lib" "$@"; do + if _cflags=$(pkg-config --cflags "$lib" 2>/dev/null) && _ldflags=$(pkg-config --libs "$lib" 2>/dev/null); then + cflags+=( $_cflags ) ldflags+=( $_ldflags ); found=1 + elif _cflags=$(pkg-config --cflags "lib$lib" 2>/dev/null) && _ldflags=$(pkg-config --libs "lib$lib" 2>/dev/null); then + cflags+=( $_cflags ) ldflags+=( $_ldflags ); found=1 + elif haslib "$lib"; then + ldflags+=( -l"$lib" ); found=1 + fi + done + + if (( found )); then echo "INFO: Enabled $option (lib$lib)." return 0