The problem was caused by the environmental variable F77.
It seems that configure, sets the appropriate values when this variable is not set, but get into trouble when we set it. I solved it deleting the line in the script that sets the F77 variable.
Thaks to everybody who tired to find a solution, specially to Sadiq Huq.