Every tenant shall on ejectment be entitled to be paid as compensation the value of any building, which may have been erected by him and also the value of trees which may have been planted by him; in a suit for ejectment the court shall ascertain the amount of compensation payable 289 by the landlord to the tenant and the decree shall direct that the landlord shall be put in possession of the land only on payment of the said amount in court within the prescribed time; if the landlord is unable or unwilling to pay the compensation within the prescribed time, he may apply for fixing a reasonable rent for the occupation of the land by the tenant; a tenant, who is entitled to compensation and against whom a suit for ejectment has been instituted, may apply for an order that the landlord may be directed to sell the land to him for a price to be fixed by the court, and thereupon the court shall fix the price in the manner prescribed in section 9 and direct the said amount to be paid to the landlord by the tenant within a particular time and in default his application shall stand dismissed.