Search for magnetic monopoles with the MACRO detector at Gran Sasso