The boards of county commissioners of such counties and the city council or other governing body of such city, are hereby authorized and empowered to enter into all necessary contracts or agreements with respect thereto and also all necessary contracts and agreements as between such counties and city for apportioning the expenses of acquiring such site and constructing such buildings for the maintenance, operation and use thereof, and may from time to time, modify or change such agreements as they may deem best.