Fixes for compiling with recent LLVM/clang versions

In particular, this makes it possible to build Halide with prebuilt LLVM 3.4 packages.

Main changes:

- use llvm-config --ldflags to determine additional dependencies of LLVM, in particular for terminfo and curses if needed
- small changes to apps/{blur,wavelet}/Makefile to make them compile with CXX=clang++