what happens to a call option upon merger

Question on call options....

Suppose I buy a call option on Company X, and if Company X gets acquired by Company Y, what happens to my call?

If it's a cash deal, I'd suppose I have to exercise it straight away rite, since there would be no stock left for me to call after the merger.

What if it's a stock deal? Does my call get converted into a call on Company Y based on the exchange ratio?