Neutrino astrophysics with the MACRO detector in the Gran Sasso underground laboratory