Reworked path logic in configure, fixes building in-tree on win32