Only search for libapp and libjson when dynamically linking to them

Otherwise static build fails if they are not installed system-wide.
Include local libapp and libjson when static building
Merge pull request #4 from hdhoang/master

Fix static building when libapp and libjson are not installed system-wide