Rescuers are searching for survivors as the death toll from the Indonesian earthquake reaches 40.