source: trunk/synergy/lib/common/common.h@ 2751

Last change on this file since 2751 was 2749, checked in by bird, 19 years ago

synergy v1.3.1 sources (zip).

File size: 3.6 KB
Line 
1/*
2 * synergy -- mouse and keyboard sharing utility
3 * Copyright (C) 2002 Chris Schoeneman
4 *
5 * This package is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * found in the file COPYING that should have accompanied this file.
8 *
9 * This package is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef COMMON_H
16#define COMMON_H
17
18// this file should be included, directly or indirectly by every other.
19
20#if HAVE_CONFIG_H
21# include "config.h"
22
23 // don't use poll() on mac
24# if defined(__APPLE__)
25# undef HAVE_POLL
26# endif
27#else
28 // we may not have run configure on win32
29# if defined(_WIN32)
30# define SYSAPI_WIN32 1
31# define WINAPI_MSWINDOWS 1
32# endif
33
34 // we may not have run configure on OS X
35# if defined(__APPLE__)
36# define SYSAPI_UNIX 1
37# define WINAPI_CARBON 1
38
39# define HAVE_CXX_BOOL 1
40# define HAVE_CXX_CASTS 1
41# define HAVE_CXX_EXCEPTIONS 1
42# define HAVE_CXX_MUTABLE 1
43# define HAVE_CXX_STDLIB 1
44# define HAVE_GETPWUID_R 1
45# define HAVE_GMTIME_R 1
46# define HAVE_INET_ATON 1
47# define HAVE_INTTYPES_H 1
48# define HAVE_ISTREAM 1
49# define HAVE_MEMORY_H 1
50# define HAVE_NANOSLEEP 1
51# define HAVE_OSTREAM 1
52# define HAVE_POSIX_SIGWAIT 1
53# define HAVE_PTHREAD 1
54# define HAVE_PTHREAD_SIGNAL 1
55# include <sys/types.h>
56# include <sys/socket.h>
57# if defined(_SOCKLEN_T)
58# define HAVE_SOCKLEN_T 1
59# endif
60# define HAVE_SSTREAM 1
61# define HAVE_STDINT_H 1
62# define HAVE_STDLIB_H 1
63# define HAVE_STRINGS_H 1
64# define HAVE_STRING_H 1
65# define HAVE_SYS_SELECT_H 1
66# define HAVE_SYS_SOCKET_H 1
67# define HAVE_SYS_STAT_H 1
68# define HAVE_SYS_TIME_H 1
69# define HAVE_SYS_TYPES_H 1
70# define HAVE_SYS_UTSNAME_H 1
71# define HAVE_UNISTD_H 1
72# define HAVE_VSNPRINTF 1
73/* disable this so we can build with the 10.2.8 SDK */
74/*# define HAVE_WCHAR_H 1*/
75
76# define SELECT_TYPE_ARG1 int
77# define SELECT_TYPE_ARG234 (fd_set *)
78# define SELECT_TYPE_ARG5 (struct timeval *)
79# define SIZEOF_CHAR 1
80# define SIZEOF_INT 4
81# define SIZEOF_LONG 4
82# define SIZEOF_SHORT 2
83# define STDC_HEADERS 1
84# define TIME_WITH_SYS_TIME 1
85# define X_DISPLAY_MISSING 1
86# endif
87#endif
88
89// VC++ specific
90#if (_MSC_VER >= 1200)
91 // work around for statement scoping bug
92# define for if (false) { } else for
93
94 // turn off bonehead warnings
95# pragma warning(disable: 4786) // identifier truncated in debug info
96# pragma warning(disable: 4514) // unreferenced inline function removed
97
98 // this one's a little too aggressive
99# pragma warning(disable: 4127) // conditional expression is constant
100
101 // emitted incorrectly under release build in some circumstances
102# if defined(NDEBUG)
103# pragma warning(disable: 4702) // unreachable code
104# pragma warning(disable: 4701) // variable maybe used uninitialized
105# endif
106#endif // (_MSC_VER >= 1200)
107
108// VC++ has built-in sized types
109#if defined(_MSC_VER)
110# include <wchar.h>
111# define TYPE_OF_SIZE_1 __int8
112# define TYPE_OF_SIZE_2 __int16
113# define TYPE_OF_SIZE_4 __int32
114#else
115# define SIZE_OF_CHAR 1
116# define SIZE_OF_SHORT 2
117# define SIZE_OF_INT 4
118# define SIZE_OF_LONG 4
119#endif
120
121// FIXME -- including fp.h from Carbon.h causes a undefined symbol error
122// on my build system. the symbol is scalb. since we don't need any
123// math functions we define __FP__, the include guard macro for fp.h, to
124// prevent fp.h from being included.
125#if defined(__APPLE__)
126#define __FP__
127#endif
128
129// define NULL
130#ifndef NULL
131#define NULL 0
132#endif
133
134// make assert available since we use it a lot
135#include <assert.h>
136
137#endif
Note: See TracBrowser for help on using the repository browser.