~ubuntu-branches/debian/squeeze/ntp/squeeze-201010051545

« back to all changes in this revision

Viewing changes to ports/winnt/include/config.h

  • Committer: Bazaar Package Importer
  • Author(s): Kurt Roeckx
  • Date: 2009-11-26 22:16:37 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20091126221637-lbtdp0ax1yg9t0bx
Tags: 1:4.2.4p7+dfsg-4
* Use uname -s instead of dpkg-architecture to found the kernel we're
  running on.  dpkg-architecture is part of dpkg-dev. (Closes: #558145)
* Make the package fail to build on hurd since it does not provided
  the needed system calls for ntpd to work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
#define __CONFIG_H
5
5
 
6
6
/*
 
7
 * For newer compilers we may we want newer prototypes from Windows
 
8
 * so we target _WIN32_WINNT at WINXP, but we also want our binary to
 
9
 * run on NT 4, so newer functions are runtime linked and the linker
 
10
 * /version:0x0400 * switch is used to override the .exe file minimum
 
11
 * version. For older compilers we leave it at NT 4.0.
 
12
 */
 
13
#ifndef _WIN32_WINNT
 
14
#if _MSC_VER > 1400             /* At least VS 2005 */
 
15
#define _WIN32_WINNT 0x0501
 
16
#else                           /* NT 4.0 */
 
17
#define _WIN32_WINNT 0x0400 
 
18
#endif
 
19
#endif
 
20
 
 
21
 
 
22
#define _CRT_SECURE_NO_DEPRECATE 1
 
23
/*
 
24
 * ANSI C compliance enabled
 
25
 */
 
26
#define __STDC__ 1
 
27
 
 
28
/*
 
29
 * We need to include string.h first before we override strerror
 
30
 * otherwise we can get errors during the build
 
31
 */
 
32
#include <string.h>
 
33
 
 
34
/*
 
35
 * We need to include stdio.h first before we #define snprintf
 
36
 * otherwise we can get errors during the build
 
37
 */
 
38
#include <stdio.h>
 
39
 
 
40
/* Prevent inclusion of winsock.h in windows.h */
 
41
#ifndef _WINSOCKAPI_
 
42
#define _WINSOCKAPI_  
 
43
#endif
 
44
 
 
45
#ifndef __RPCASYNC_H__
 
46
#define __RPCASYNC_H__
 
47
#endif
 
48
 
 
49
/*
 
50
 * VS.NET's version of wspiapi.h has a bug in it
 
51
 * where it assigns a value to a variable inside
 
52
 * an if statement. It should be comparing them.
 
53
 * We prevent inclusion since we are not using this
 
54
 * code so we don't have to see the warning messages
 
55
 */
 
56
#ifndef _WSPIAPI_H_
 
57
/* #define _WSPIAPI_H_ */ /* need these wrappers for ntpd.exe to load on w2k */
 
58
#endif
 
59
 
 
60
/* Include Windows headers */
 
61
#include <windows.h>
 
62
#include <winsock2.h>
 
63
#include <ws2tcpip.h>
 
64
 
 
65
/*
 
66
 * Some definitions we are using are missing in the headers
 
67
 * shipping with VC6. However, if the SDK is installed then the 
 
68
 * SDK's headers may declare the missing types. This is at least 
 
69
 * the case in the Oct 2001 SDK. That SDK and all subsequent 
 
70
 * versions also define the symbol _W64, so we can use that one
 
71
 * to determine whether some types need to be defined, or not.
 
72
 */
 
73
#ifdef _W64
 
74
/* VC6 can include wspiapi.h only if the SDK is installed */
 
75
#include <wspiapi.h>
 
76
#endif
 
77
 
 
78
/* #include <runtimelink.h> */  /* must come after ws2tcpip.h */
 
79
#undef interface
 
80
#include <process.h>
 
81
 
 
82
/* ---------------------------------------------------------------------
 
83
 * Above this line are #include lines and the few #define lines
 
84
 * needed before including headers.
 
85
 */
 
86
 
 
87
/*
7
88
 * IPv6 requirements
8
89
 */
9
90
/*
10
 
 * For VS.NET most of the IPv6 types and structures are defined
 
91
 * For VS.NET most of the IPv6 types and structures are defined.
 
92
 * This should depend on the contrents of the available headers, 
 
93
 * not on the compiler version.
11
94
 */
12
 
#if _MSC_VER > 1200
 
95
#if defined _MSC_VER && _MSC_VER > 1200
13
96
#define HAVE_STRUCT_SOCKADDR_STORAGE
14
97
#define ISC_PLATFORM_HAVEIPV6
15
98
#define ISC_PLATFORM_HAVEIN6PKTINFO
16
99
#define NO_OPTION_NAME_WARNINGS
17
 
#else
18
 
typedef int socklen_t;  /* VS 6.0 doesn't know about socklen_t */
19
100
#endif
20
101
 
21
 
/*
22
 
 * Some types don't exist in VS V6
23
 
 */
24
 
#if _MSC_VER < 1300
25
 
typedef unsigned int    uintptr_t;
 
102
#ifndef _W64
 
103
/* VC6 doesn't know about socklen_t, except if the SDK is installed */
 
104
typedef int socklen_t;
26
105
#endif
27
106
 
28
107
#define ISC_PLATFORM_NEEDIN6ADDRANY
33
112
 * is int for VS compilers on Windows but the type is already declared 
34
113
 */
35
114
#define GETSOCKNAME_SOCKLEN_TYPE socklen_t
 
115
 
 
116
#if defined _MSC_VER && _MSC_VER < 1400
 
117
/*
 
118
 * Use 32-bit time definitions for versions prior to VS 2005
 
119
 * VS 2005 defaults to 64-bit time
 
120
 */
 
121
# define SIZEOF_TIME_T 4
 
122
#else
 
123
# define SIZEOF_TIME_T 8
 
124
#endif
 
125
 
 
126
 
36
127
/*
37
128
 * An attempt to cut down the number of warnings generated during compilation.
38
129
 * All of these should be benign to disable.
41
132
#pragma warning(disable: 4100) /* unreferenced formal parameter */
42
133
#pragma warning(disable: 4101) /* unreferenced local variable */
43
134
#pragma warning(disable: 4127) /* conditional expression is constant */
 
135
#pragma warning(disable: 4996) /* more secure replacement available */
44
136
 
45
137
/*
46
138
 * Windows NT Configuration Values
48
140
#if defined _DEBUG /* Use VC standard macro definitions */
49
141
# define DEBUG 1
50
142
#endif
51
 
#if !defined _WIN32_WINNT || _WIN32_WINNT < 0x0400
52
 
# error Please define _WIN32_WINNT in the project settings/makefile
53
 
#endif
54
143
 
55
144
#define __windows__ 1
56
 
/*
57
 
 * ANSI C compliance enabled
58
 
 */
59
 
#define __STDC__ 1
60
145
/* Define if you have the ANSI C header files.  */
61
146
#define STDC_HEADERS 1
62
147
 
63
 
/* Prevent inclusion of winsock.h in windows.h */
64
 
#ifndef _WINSOCKAPI_
65
 
#define _WINSOCKAPI_  
66
 
#endif
67
 
 
68
 
#ifndef __RPCASYNC_H__
69
 
#define __RPCASYNC_H__
70
 
#endif
71
 
 
72
 
/*
73
 
 * VS.NET's version of wspiapi.h has a bug in it
74
 
 * where it assigns a value to a variable inside
75
 
 * an if statement. It should be comparing them.
76
 
 * We prevent inclusion since we are not using this
77
 
 * code so we don't have to see the warning messages
78
 
 */
79
 
#ifndef _WSPIAPI_H_
80
 
#define _WSPIAPI_H_
81
 
#endif
82
 
 
83
 
#define OPEN_BCAST_SOCKET       1 /* for        ntp_io.c */
84
 
#define TYPEOF_IP_MULTICAST_LOOP BOOL                                                                                           
85
 
#define SETSOCKOPT_ARG_CAST (const char *)
 
148
#define OPEN_BCAST_SOCKET               1       /* for ntp_io.c */
 
149
#define TYPEOF_IP_MULTICAST_LOOP        BOOL
 
150
#define SETSOCKOPT_ARG_CAST             (const char *)
86
151
#define HAVE_RANDOM 
87
 
#define MAXHOSTNAMELEN 64
 
152
#define MAXHOSTNAMELEN                  64
88
153
#define AUTOKEY
89
154
 
90
155
/*
91
156
 * Multimedia timer enable
92
157
 */
93
158
#define USE_MM_TIMER
94
 
/*
95
 
 * Use 32-bit time definitions
96
 
 * VS 2005 defaults to 64-bit time
97
 
 * Leave commented out for now
98
 
 */
99
 
//#define _USE_32BIT_TIME_T
100
159
 
101
160
/* Enable OpenSSL */
102
161
#define OPENSSL 1
103
162
 
104
163
/*
105
 
 * Include standard stat information
106
 
 */
107
 
#include <isc/stat.h>
108
 
/*
109
 
 * Miscellaneous functions that Microsoft maps
 
164
 * Keywords and functions that Microsoft maps
110
165
 * to other names
111
166
 */
112
 
#define inline __inline
113
 
#define vsnprintf _vsnprintf
114
 
#define snprintf _snprintf
115
 
#define stricmp _stricmp
116
 
#define strcasecmp _stricmp
117
 
#define isascii __isascii
118
 
#define finite _finite
119
 
#define random      rand
120
 
#define srandom     srand
121
 
#define fdopen  _fdopen
122
 
#define read    _read
123
 
#define open    _open
124
 
#define close   _close
125
 
#define write   _write
126
 
#define strdup  _strdup
127
 
#define stat    _stat       /* struct stat from <sys/stat.h> */
128
 
#define unlink  _unlink
129
 
#define fchmod( _x, _y );
130
 
#define lseek   _lseek
131
 
#define pipe    _pipe
132
 
#define dup2    _dup2
133
 
#define sleep(x) Sleep((DWORD) x * 1000 /* milliseconds */ );
 
167
#define inline          __inline
 
168
#define vsnprintf       _vsnprintf
 
169
#define snprintf        _snprintf
 
170
#define stricmp         _stricmp
 
171
#define strcasecmp      _stricmp
 
172
#define isascii         __isascii
 
173
#define finite          _finite
 
174
#define random          rand
 
175
#define srandom         srand
 
176
#define fdopen          _fdopen
 
177
#define read            _read
 
178
#define open            _open
 
179
#ifndef close
 
180
#define close           _close
 
181
#endif
 
182
#define write           _write
 
183
#define strdup          _strdup
 
184
#define stat            _stat           /*struct stat from  <sys/stat.h> */
 
185
#define unlink          _unlink
 
186
/*
 
187
 * punt on fchmod on Windows
 
188
 */
 
189
#define fchmod(x,y)     {}
 
190
#define lseek           _lseek
 
191
#define pipe            _pipe
 
192
#define dup2            _dup2
 
193
/*
 
194
 * scale, unix sleep is seconds, Windows Sleep is msec
 
195
 */
 
196
#define sleep(x)        Sleep((unsigned)(x) * 1000)
 
197
#define fileno          _fileno
 
198
#define isatty          _isatty
 
199
#define mktemp          _mktemp
 
200
#define getpid          _getpid
134
201
 
135
 
#define pid_t   int             /* PID is an int */
136
 
#define ssize_t int             /* ssize is an int */
 
202
typedef int pid_t;              /* PID is an int */
 
203
typedef int ssize_t;            /* ssize is an int */
137
204
typedef __int32 int32_t;        /* define a typedef for int32_t */
138
205
#define HAVE_INT32_T   1
139
206
 
143
210
#define STDOUT_FILENO   _fileno(stdout)
144
211
#define STDERR_FILENO   _fileno(stderr)
145
212
 
146
 
/*
147
 
 * We need to include string.h first before we override strerror
148
 
 * otherwise we can get errors during the build
149
 
 */
150
 
#include <string.h>
151
213
/* Point to a local version for error string handling */
152
214
# define strerror       NTstrerror
153
 
 
154
215
char *NTstrerror(int errnum);
155
216
 
156
217
int NT_set_process_priority(void);      /* Define this function */
161
222
# define REFCLOCK                       /* from ntpd.mak */
162
223
 
163
224
# define CLOCK_LOCAL                    /* from ntpd.mak */
164
 
//# define CLOCK_PARSE 
 
225
/* # define CLOCK_PARSE  */
165
226
/* # define CLOCK_ATOM */
 
227
/* # define HAVE_TIMEPPS_H */
 
228
/* # define HAVE_PPSAPI */
166
229
/* # define CLOCK_SHM   */               /* from ntpd.mak */
167
230
# define CLOCK_HOPF_SERIAL      /* device 38, hopf DCF77/GPS serial line receiver  */
168
231
# define CLOCK_HOPF_PCI         /* device 39, hopf DCF77/GPS PCI-Bus receiver  */
177
240
# define NTP_POSIX_SOURCE
178
241
 
179
242
# define SYSLOG_FILE                    /* from libntp.mak */
180
 
# define SYSV_TIMEOFDAY                 /* for ntp_unixtime.h */
181
 
 
182
 
# define SIZEOF_SIGNED_CHAR 1
183
 
# define SIZEOF_TIME_T 4
184
 
# define SIZEOF_INT 4                   /* for ntp_types.h */
185
 
 
186
 
//# define HAVE_NET_IF_H
 
243
# define SYSV_TIMEOFDAY                 /* for ntp_unixtime.h */
 
244
 
 
245
# define SIZEOF_SIGNED_CHAR     1
 
246
# define SIZEOF_INT             4       /* for ntp_types.h */
 
247
 
187
248
# define QSORT_USES_VOID_P
188
249
# define HAVE_SETVBUF
189
250
# define HAVE_VSPRINTF
202
263
# define ISC_PLATFORM_NEEDPTON
203
264
# define HAVE_VPRINTF
204
265
 
205
 
#define HAVE_LIMITS_H   1
206
 
#define HAVE_STRDUP     1
207
 
#define HAVE_STRCHR     1
208
 
#define HAVE_FCNTL_H    1
209
 
 
210
 
 
211
 
# define NEED_S_CHAR_TYPEDEF
212
 
 
213
 
# define USE_PROTOTYPES                 /* for ntp_types.h */                                                                                                           
 
266
#define HAVE_LIMITS_H   1
 
267
#define HAVE_STRDUP     1
 
268
#define HAVE_STRCHR     1
 
269
#define HAVE_FCNTL_H    1
 
270
 
 
271
#ifndef _INTPTR_T_DEFINED
 
272
typedef long intptr_t;
 
273
#define _INTPTR_T_DEFINED
 
274
#endif
 
275
#define HAVE_INTPTR_T
 
276
 
 
277
#ifndef _UINTPTR_T_DEFINED
 
278
typedef unsigned long uintptr_t;
 
279
#define _UINTPTR_T_DEFINED
 
280
#endif
 
281
#define HAVE_UINTPTR_T
 
282
 
 
283
#if !defined( _W64 )
 
284
  /*
 
285
   * if DWORD_PTR needs to be defined then the build environment
 
286
   * is pure 32 bit Windows. Since DWORD_PTR and DWORD have 
 
287
   * the same size in 32 bit Windows we can safely define
 
288
   * a replacement.
 
289
   */
 
290
  typedef DWORD DWORD_PTR;
 
291
#endif
 
292
 
 
293
#define NEED_S_CHAR_TYPEDEF
 
294
 
 
295
#define USE_PROTOTYPES          /* for ntp_types.h */
 
296
 
 
297
/* Directory separator, usually / or \ */
 
298
#define DIR_SEP '\\'
 
299
 
214
300
 
215
301
#define ULONG_CONST(a) a ## UL
216
302
 
217
 
# define NOKMEM
218
 
# define RETSIGTYPE void
219
 
# ifndef STR_SYSTEM
220
 
#  define STR_SYSTEM "WINDOWS/NT"
221
 
# endif
 
303
#define NOKMEM
 
304
#define RETSIGTYPE void
 
305
 
 
306
#ifndef STR_SYSTEM
 
307
#define STR_SYSTEM "Windows"
 
308
#endif
 
309
 
 
310
#ifndef STR_PROCESSOR
 
311
 
 
312
#define STRINGIZE(arg)  #arg
 
313
 
 
314
#ifdef _M_IX86
 
315
#ifndef _M_IX86_FP
 
316
#define STR_PROCESSOR "x86"
 
317
#else
 
318
#if !_M_IX86_FP 
 
319
#define STR_PROCESSOR "x86"
 
320
#else 
 
321
#if _M_IX86_FP > 2
 
322
#define STR_PROCESSOR "x86-FP-" STRINGIZE(_M_IX86_FP)
 
323
#else
 
324
#if _M_IX86_FP == 2
 
325
#define STR_PROCESSOR "x86-SSE2"
 
326
#else
 
327
#define STR_PROCESSOR "x86-SSE"
 
328
#endif /* _M_IX86 == 2 */
 
329
#endif /* _M_IX86_FP > 2 */
 
330
#endif /* !_M_IX86_FP */
 
331
#endif /* !defined(_M_IX86_FP) */
 
332
#endif /* !defined(_M_IX86) */
 
333
 
 
334
#ifdef _M_IA64
 
335
#define STR_PROCESSOR "Itanium"
 
336
#endif
 
337
 
 
338
#ifdef _M_X64
 
339
#define STR_PROCESSOR "x64"
 
340
#endif
 
341
 
 
342
#endif /* !defined(STR_PROCESSOR) */
 
343
 
222
344
#define  SIOCGIFFLAGS SIO_GET_INTERFACE_LIST /* used in ntp_io.c */
223
 
 
224
 
/* Include Windows headers */
225
 
#include <windows.h>
226
 
#include <winsock2.h>
227
 
 
228
 
#endif /* __config */
 
345
/*
 
346
 * Below this line are includes which must happen after the bulk of
 
347
 * config.h is processed.  If you need to add another #include to this
 
348
 * file the preferred location is near the top, above the similar
 
349
 * line of hyphens.
 
350
 * ---------------------------------------------------------------------
 
351
 */
 
352
 
 
353
/*
 
354
 * Include standard stat information
 
355
 */
 
356
#include <isc/stat.h>
 
357
 
 
358
#endif /* __CONFIG_H */