Also generate a .dll in MinGW builds

Previously only static a static library was produced on MinGW builds,
this PR makes sure that we also build a proper .dll
Merge pull request #531 from jin-eld/dll

Also generate a .dll in MinGW builds
Add /usr/local/* to search paths on FreeBSD

Seems that on FreeBSD those directories are not in the default search
paths, so we'll have to add them manually.
Merge pull request #532 from jin-eld/freebsd

Add /usr/local/* to search paths on FreeBSD