switch headers + avoid duplicate definition
include config before testing macro
Merge pull request #2793 from remicollet/issue-non-free3

switch headers + avoid duplicate definition