refactor zts related config
generalize --with-php-build option handling
eliminate duplicated identical function definitions
fix datatype mismatch and unused var warning
fix printf spec