Example: Jef Poskanzer's mini_httpd 1.19

port.h
 3| #if defined(__FreeBSD__)
 4| # define OS_FreeBSD
 5| # define ARCH "FreeBSD"
 6| #elif defined(__OpenBSD__)
 7| # define OS_OpenBSD
 8| # define ARCH "OpenBSD"
 9| #elif defined(__NetBSD__)
10| # define OS_NetBSD
11| # define ARCH "NetBSD"
12| #elif defined(linux)
13| # define OS_Linux
14| # define ARCH "Linux"
15| #elif defined(sun)
16| # define OS_Solaris
17| # define ARCH "Solaris"
18| #elif defined(__osf__)
19| # define OS_DigitalUnix
20| # define ARCH "DigitalUnix"
21| #elif defined(__svr4__)
22| # define OS_SysV
23| # define ARCH "SysV"
24| #else
25| # define OS_UNKNOWN
26| # define ARCH "UNKNOWN"
27| #endif

29| #ifdef OS_FreeBSD
30| # include <osreldate.h>
31| # define HAVE_DAEMON
32| # define HAVE_SETSID
33| # define HAVE_SETLOGIN
34| # define HAVE_WAITPID
35| # define HAVE_HSTRERROR
36| # define HAVE_TM_GMTOFF
37| # define HAVE_SENDFILE
38| # define HAVE_SCANDIR
39| # define HAVE_INT64T
40| # ifdef SO_ACCEPTFILTER
41| #  define HAVE_ACCEPT_FILTERS
42| #  if ( __FreeBSD_version >= 411000 )
43| #	define ACCEPT_FILTER_NAME "httpready"
44| #  else
45| #	define ACCEPT_FILTER_NAME "dataready"
46| #  endif
47| # endif /* SO_ACCEPTFILTER */
48| #endif /* OS_FreeBSD */
49|
50| #ifdef OS_OpenBSD
51| # define HAVE_DAEMON
52| # define HAVE_SETSID

