Fix resolving libncurses.5.4.dylib

clang on Xcode 5.1 requires libncurses.

When resolving libcurses.5.4.dylib, actually we need to load libtinfo.so
and libncurses.so.5. Since libncurses.so is a linker script, we cannot
do dlopen for it.

This was not a problem before Xcode 5.1, since clang for those does not
require libncurses.