if

How I can include one head file if this program compiles on freeBSD and other if on the Linux platform.

#include <some.h>

I know that very often it does configure script, but can I do it directly in cpp code?

Use the preprocessor provided conditional statements for that...

#if machine == freeBSD
     #define HDR "somefile.h"
#elif machine == Linux
     #define HDR "otherfile.h"
#else
     #define HDR "default.h"
#endif

#include HDR