configure should honor MACOSX_DEPLOYMENT_TARGET and also not #define it
If MACOSX_DEPLOYMENT_TARGET is set in the environment and --with-macosx-version-min=X.Y is not passed to configure, configure will clobber MACOSX_DEPLOYMENT_TARGET with 10.5
The configure script should honor the MACOSX_DEPLOYMENT_TARGET which already exists in the environment as the default. It looks like this is done in 2.1 and master. Can you please cherry-pick that change into the 2.0 branch?
Furthermore, you should not add -DMACOSX_DEPLOYMENT_TARGET=... to your CPPFLAGS here:
CFLAGS_save="${CFLAGS_save} -DMACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}"; CFLAGS="${CFLAGS_save}"
CXXFLAGS_save="${CXXFLAGS_save} -DMACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}"; CXXFLAGS="${CXXFLAGS_save}"
OBJCFLAGS_save="${OBJCFLAGS_save} -DMACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}"; OBJCFLAGS="${OBJCFLAGS_save}"
Instead, use __MAC_OS_X_VERSION_MIN_REQUIRED as provided to you by the compiler.
It looks like you're not even consuming that MACOSX_DEPLOYMENT_TARGET macro, so you should just drop it.