For GCC you must specify in LIBRARY_PATH the location of the the libraries, normally writing in your .bashrc the next line will make the trick:
export LIBRARY_PATH=/usr/local/lib
As for Clang++ compiler, things are a bit harder since it does not read LIBRARY_PATH. In that case, write in your .bashrc:
export CONFIG_SITE="~/.clang_fix"
Then create that ~/.clang_fix file and write inside:
#!/bin/bash export LDFLAGS+="-L/usr/local/lib"