summaryrefslogtreecommitdiffstats
path: root/include/osdep.h
blob: 73eff2891b73fdc3b77e374b254a4187df445a64 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86

#ifndef __OSDEP_H__
#define __OSDEP_H__

/* os dependant include file, define */
#ifdef __FreeBSD__
    #if __FreeBSD__ >= 5
        #include <sys/limits.h>
    #else
        #include <machine/limits.h>
    #endif

    #include <machine/param.h>

    #define _XOPEN_SOURCE
    #define _ISOC99_SOURCE
    
    #if BYTE_ORDER == BIG_ENDIAN
    #define _BIG_ENDIAN
    #else
    #define _LITTLE_ENDIAN
    #endif

    #define HAVE_SETPROCTITLE

#elif defined(__linux__)

    #define _GNU_SOURCE

    #include <sys/ioctl.h>
    #include <sys/file.h>      /* for flock() */
    #include <strings.h>       /* for strcasecmp() */
    #include <endian.h>        /* for __BYTE_ORDER */

    #if __BYTE_ORDER == __BIG_ENDIAN
    #define _BIG_ENDIAN
    #else
    #define _LITTLE_ENDIAN
    #endif

    #define NEED_STRCASESTR
    #define NEED_STRLCPY
    #define NEED_STRLCAT

#elif defined(Solaris)

    #include <alloca.h>
    #include <crypt.h>
    #include <sys/param.h>
    #include <sys/ioctl.h>
    #include <limits.h>
    #include <strings.h>       /* for strcasecmp() */             
                                      
    #define _ISOC99_SOURCE

    #define NEED_FLOCK
    #define NEED_UNSETENV
    #define NEED_SCANDIR
    #define NEED_STRCASESTR
    #define NEED_TIMEGM

    #if __OS_MAJOR_VERSION__ == 5 && __OS_MINOR_VERSION__ < 8
    #define NEED_STRLCPY
    #define NEED_STRLCAT
    #define NEED_INET_PTON
    #endif

    #if __OS_MAJOR_VERSION__ == 5 && __OS_MAJOR_VERSION__ < 6
    #define NEED_BSD_SIGNAL
    #endif

#else

    #error "Unknown OSTYPE"

#endif


#ifdef Solaris
    #define Signal (bsd_signal)
#else
    #define Signal (signal)
#endif


#endif