Hill stability of coplanar four-body systems with application to the Solar System and extrasolar systems