Section 118. In a town which accepts this section or has accepted corresponding provisions of earlier laws, a stationary engine, propelled by steam or other motive power, shall not be erected or put up for use within five hundred feet of a dwelling house or public building unless a license therefor has been first granted and recorded in the manner provided in section one hundred and fifteen.