Identifying loci under positive selection in complex population histories