configure: Replace shell constructs with M4sh macros