Modifications to allow crosscompiling with mingw

Reviewed-by: bjorn.
Fixed configure with old cmake