Fixes a bug introduced in #19614 (D10060)
The LevelDB-specific fdatasync check was only using AC_SUBST, which works for Makefiles, but doesn't define anything for C++. Furthermore, the #define is typically 0 or 1, never undefined.
This fixes both issues by defining it and checking its value instead of whether it is merely defined.
This is a backport of core#19803