sync: use matching #ifdefs in source as in header

Fixes github issue #298