pkg-config provides a way to link to libraries independent of a particular system's directory heirarchy.
The relevant manual pages on NetBSD are pkgconf(1), pc(5), and pkg.m4(7).
pkgconf(1)
pc(5)
pkg.m4(7)