Add dl to LIBS when compiling for mingw.