It shall be lawful in the interests of efficiency and economy for any county and any one or more municipal corporations within such county or for any two or more such corporations within the county to jointly acquire real property by purchase, lease or condemnation for the purposes hereinafter specified and to establish, construct, equip, operate, maintain, control and supervise for the joint use and benefit of such corporations one or more jails at such place or places as may be equally accessible for each of such corporations to be specified in the agreement providing therefor or to utilize one or more existing jails, lock-ups, or workhouses therefor. The ordinance or resolution providing for such joint action shall be adopted by the governing boards of each of the several corporations affected and a committee, composed of at least one member of each of such boards, shall be created to acquire necessary real property, in the name of the municipal corporations affected and, as the joint agent of such corporations such committee shall have charge of the construction, equipment, maintenance, and operation of such jail or jails and shall supervise and control the same. The ordinance or resolution may specify matters as to which the action of the committee shall require the joint approval of such boards and shall prescribe the proportions of the cost of the construction and operation of such jail or jails to be borne by the several corporations affected. The moneys to pay the share to be borne by each corporation affected shall be provided by appropriation in such amounts and at such time as may be agreed upon. Any jail, penitentiary, workhouse, or lock-up, abandoned or rendered useless by reason of action taken pursuant to this section may be sold or otherwise disposed of or utilized by the corporation controlling the same. The ordinance or resolution may also provide for the transfer to and utilization in the proposed joint jail or jails of the books, papers and records and the vans, wagons, automobiles, equipment and personnel of any existing jail, penitentiary, workhouse, or lock-up whose continued operation will be rendered unnecessary by reason of action taken pursuant to this section. All of the provisions of the correction law and of every other general, special or local law shall so far as practicable, continue to apply with full force and effect to every jail established and maintained pursuant to this section as if the several constituent institutions consolidated by such jail had continued in operation as single units.