Use the correct lib filename on darwin.

The dynamic linker on darwin was trying to load "libcurses.so", which doesn't work since on darwin it is called "libcurses.dylib". Added a case for darwin so that it uses the correct filenames.