]> code.delx.au - gnu-emacs/blob - src/s/ms-w32.h
Move LD_SWITCH_SYSTEM from cpp to configure.
[gnu-emacs] / src / s / ms-w32.h
1 /* System description file for Windows NT.
2 Copyright (C) 1993, 1994, 1995, 2001, 2002, 2003, 2004, 2005, 2006,
3 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4
5 This file is part of GNU Emacs.
6
7 GNU Emacs is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 GNU Emacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19
20 /*
21 * Define symbols to identify the version of Unix this is.
22 * Define all the symbols that apply correctly.
23 */
24
25 #ifndef WINDOWSNT
26 #define WINDOWSNT
27 #endif
28 #ifndef DOS_NT
29 #define DOS_NT /* MSDOS or WINDOWSNT */
30 #endif
31
32 /* If you are compiling with a non-C calling convention but need to
33 declare vararg routines differently, put it here */
34 #define _VARARGS_ __cdecl
35
36 /* If you are providing a function to something that will call the
37 function back (like a signal handler and signal, or main) its calling
38 convention must be whatever standard the libraries expect */
39 #define _CALLBACK_ __cdecl
40
41 /* SYSTEM_TYPE should indicate the kind of system you are using.
42 It sets the Lisp variable system-type. */
43
44 #define SYSTEM_TYPE "windows-nt"
45 #define SYMS_SYSTEM syms_of_ntterm ()
46
47 #define NO_MATHERR 1
48
49 /* Letter to use in finding device name of first pty,
50 if system supports pty's. 'a' means it is /dev/ptya0 */
51
52 #define FIRST_PTY_LETTER 'a'
53
54 /*
55 * Define HAVE_TIMEVAL if the system supports the BSD style clock values.
56 * Look in <sys/time.h> for a timeval structure.
57 */
58
59 #define HAVE_TIMEVAL 1
60
61 /* NT supports Winsock which is close enough (with some hacks) */
62
63 #define HAVE_SOCKETS 1
64
65 /* But our select implementation doesn't allow us to make non-blocking
66 connects. So until that is fixed, this is necessary: */
67
68 #define BROKEN_NON_BLOCKING_CONNECT 1
69
70 /* And the select implementation does 1-byte read-ahead waiting
71 for received packets, so datagrams are broken too. */
72
73 #define BROKEN_DATAGRAM_SOCKETS 1
74
75 /* Define this symbol if your system has the functions bcopy, etc. */
76
77 #define BSTRING
78 #define bzero(b, l) memset(b, 0, l)
79 #define bcopy(s, d, l) memmove(d, s, l)
80 #define bcmp(a, b, l) memcmp(a, b, l)
81
82 /* bcopy (aka memmove aka memcpy at least on x86) under MSVC is quite safe */
83 #define GAP_USE_BCOPY 1
84 #define BCOPY_UPWARD_SAFE 1
85 #define BCOPY_DOWNWARD_SAFE 1
86
87 /* If your system uses COFF (Common Object File Format) then define the
88 preprocessor symbol "COFF". */
89
90 #define COFF 1
91
92 /* define MAIL_USE_FLOCK if the mailer uses flock
93 to interlock access to /usr/spool/mail/$USER.
94 The alternative is that a lock file named
95 /usr/spool/mail/$USER.lock. */
96
97 /* #define MAIL_USE_FLOCK */
98 #define MAIL_USE_POP 1
99 #define MAIL_USE_SYSTEM_LOCK 1
100
101 /* If the character used to separate elements of the executable path
102 is not ':', #define this to be the appropriate character constant. */
103 #define SEPCHAR ';'
104
105 #define ORDINARY_LINK 1
106
107 /* ============================================================ */
108
109 /* Here, add any special hacks needed
110 to make Emacs work on this system. For example,
111 you might define certain system call names that don't
112 exist on your system, or that do different things on
113 your system and must be used only through an encapsulation
114 (Which you should place, by convention, in sysdep.c). */
115
116 /* Define this to be the separator between path elements */
117 #define DIRECTORY_SEP XINT (Vdirectory_sep_char)
118
119 /* Define this to be the separator between devices and paths */
120 #define DEVICE_SEP ':'
121
122 /* We'll support either convention on NT. */
123 #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
124 #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
125
126 #include <sys/types.h>
127 struct sigaction {
128 int sa_flags;
129 void (*sa_handler)(int);
130 sigset_t sa_mask;
131 };
132 #define SIG_BLOCK 1
133 #define SIG_SETMASK 2
134 #define SIG_UNBLOCK 3
135
136 /* The null device on Windows NT. */
137 #define NULL_DEVICE "NUL:"
138
139 #ifndef MAXPATHLEN
140 #define MAXPATHLEN _MAX_PATH
141 #endif
142
143 #define HAVE_SOUND 1
144 #define LISP_FLOAT_TYPE 1
145
146 #undef HAVE_SYS_SELECT_H
147 #define HAVE_SYS_TIMEB_H 1
148 #define HAVE_SYS_TIME_H 1
149 #define HAVE_UNISTD_H 1
150 #undef HAVE_UTIME_H
151 #undef HAVE_LINUX_VERSION_H
152 #undef HAVE_SYS_SYSTEMINFO_H
153 #undef HAVE_TERMIOS_H
154 #define HAVE_LIMITS_H 1
155 #define HAVE_STRING_H 1
156 #define HAVE_STDLIB_H 1
157 #define HAVE_PWD_H 1
158 #define STDC_HEADERS 1
159 #define TIME_WITH_SYS_TIME 1
160
161 #define HAVE_GETTIMEOFDAY 1
162 #define HAVE_GETHOSTNAME 1
163 #undef HAVE_GETDOMAINNAME
164 #define HAVE_DUP2 1
165 #define HAVE_RENAME 1
166 #define HAVE_CLOSEDIR 1
167 #define HAVE_FSYNC 1 /* fsync is called _commit in MSVC. */
168
169 #undef TM_IN_SYS_TIME
170 #undef HAVE_TM_ZONE
171
172 #define HAVE_LONG_FILE_NAMES 1
173
174 #define HAVE_MKDIR 1
175 #define HAVE_RMDIR 1
176 #define HAVE_RANDOM 1
177 #undef HAVE_SYSINFO
178 #undef HAVE_LRAND48
179 #define HAVE_BCOPY 1
180 #define HAVE_BCMP 1
181 #define HAVE_LOGB 1
182 #define HAVE_FREXP 1
183 #define HAVE_FMOD 1
184 #undef HAVE_RINT
185 #undef HAVE_CBRT
186 #define HAVE_FTIME 1
187 #undef HAVE_RES_INIT /* For -lresolv on Suns. */
188 #undef HAVE_SETSID
189 #undef HAVE_FPATHCONF
190 #define HAVE_SELECT 1
191 #define HAVE_MKTIME 1
192 #undef HAVE_EUIDACCESS
193 #define HAVE_GETPAGESIZE 1
194 #define HAVE_TZSET 1
195 #define HAVE_SETLOCALE 1
196 #undef HAVE_UTIMES
197 #undef HAVE_SETRLIMIT
198 #undef HAVE_SETPGID
199 #undef HAVE_GETCWD
200 #define HAVE_SHUTDOWN 1
201 #define HAVE_STRFTIME 1
202
203 #define LOCALTIME_CACHE
204 #define HAVE_INET_SOCKETS 1
205
206 #undef HAVE_AIX_SMT_EXP
207 #define USE_TOOLKIT_SCROLL_BARS 1
208
209 /* Define if you have the ANSI `strerror' function.
210 Otherwise you must have the variable `char *sys_errlist[]'. */
211 #define HAVE_STRERROR 1
212
213 /* Define if `struct utimbuf' is declared by <utime.h>. */
214 #undef HAVE_STRUCT_UTIMBUF
215
216 #define HAVE_MOUSE 1
217 #define HAVE_H_ERRNO 1
218
219 #ifdef HAVE_NTGUI
220 #define HAVE_WINDOW_SYSTEM 1
221 #define HAVE_MENUS 1
222 #endif
223
224 #define MODE_LINE_BINARY_TEXT(_b_) (NILP ((_b_)->buffer_file_type) ? "T" : "B")
225
226 /* get some redefinitions in place */
227
228 #ifdef emacs
229
230 /* calls that are emulated or shadowed */
231 #undef access
232 #define access sys_access
233 #undef chdir
234 #define chdir sys_chdir
235 #undef chmod
236 #define chmod sys_chmod
237 #define chown sys_chown
238 #undef close
239 #define close sys_close
240 #undef creat
241 #define creat sys_creat
242 #define ctime sys_ctime
243 #undef dup
244 #define dup sys_dup
245 #undef dup2
246 #define dup2 sys_dup2
247 #define fopen sys_fopen
248 #define link sys_link
249 #define mkdir sys_mkdir
250 #undef mktemp
251 #define mktemp sys_mktemp
252 #undef open
253 #define open sys_open
254 #define pipe sys_pipe
255 #undef read
256 #define read sys_read
257 #define rename sys_rename
258 #define rmdir sys_rmdir
259 #define select sys_select
260 #define sleep sys_sleep
261 #define strerror sys_strerror
262 #undef unlink
263 #define unlink sys_unlink
264 #undef write
265 #define write sys_write
266
267 /* subprocess calls that are emulated */
268 #define spawnve sys_spawnve
269 #define wait sys_wait
270 #define kill sys_kill
271 #define signal sys_signal
272
273 /* termcap.c calls that are emulated */
274 #define tputs sys_tputs
275 #define tgetstr sys_tgetstr
276
277 /* cm.c calls that are emulated */
278 #define chcheckmagic sys_chcheckmagic
279 #define cmcostinit sys_cmcostinit
280 #define cmgoto sys_cmgoto
281 #define cmputc sys_cmputc
282 #define Wcm_clear sys_Wcm_clear
283
284 #endif /* emacs */
285
286 /* map to MSVC names */
287 #define execlp _execlp
288 #define execvp _execvp
289 #define fdopen _fdopen
290 #ifndef fileno
291 #define fileno _fileno
292 #endif
293 #define fsync _commit
294 #define ftruncate _chsize
295 #define getpid _getpid
296 #ifdef _MSC_VER
297 typedef int pid_t;
298 #endif
299 #define isatty _isatty
300 #define logb _logb
301 #define _longjmp longjmp
302 #define lseek _lseek
303 #define popen _popen
304 #define pclose _pclose
305 #define umask _umask
306 #define utimbuf _utimbuf
307 #define index strchr
308 #define rindex strrchr
309 #define strdup _strdup
310 #define strupr _strupr
311 #define strnicmp _strnicmp
312 #define stricmp _stricmp
313 #define tzset _tzset
314
315 #if !defined (_MSC_VER) || (_MSC_VER < 1400)
316 #define tzname _tzname
317 #define utime _utime
318 #endif
319
320 /* this is hacky, but is necessary to avoid warnings about macro
321 redefinitions using the SDK compilers */
322 #ifndef __STDC__
323 #define __STDC__ 1
324 #define MUST_UNDEF__STDC__
325 #endif
326 #include <direct.h>
327 #include <io.h>
328 #include <stdio.h>
329 #ifdef MUST_UNDEF__STDC__
330 #undef __STDC__
331 #undef MUST_UNDEF__STDC__
332 #endif
333
334 /* Defines that we need that aren't in the standard signal.h */
335 #define SIGHUP 1 /* Hang up */
336 #define SIGQUIT 3 /* Quit process */
337 #define SIGTRAP 5 /* Trace trap */
338 #define SIGKILL 9 /* Die, die die */
339 #define SIGPIPE 13 /* Write on pipe with no readers */
340 #define SIGALRM 14 /* Alarm */
341 #define SIGCHLD 18 /* Death of child */
342
343 #ifndef NSIG
344 #define NSIG 23
345 #endif
346
347 /* For integration with MSDOS support. */
348 #define getdisk() (_getdrive () - 1)
349 #ifdef emacs
350 #define getdefdir(_drv, _buf) ((_buf[0] = (_drv + 'A' - 1), _buf[1] = ':', _buf[2] = '/', _buf[3] = 0), 1)
351 #else
352 #define getdefdir(_drv, _buf) _getdcwd (_drv, _buf, MAXPATHLEN)
353 #endif
354
355 extern char *get_emacs_configuration (void);
356 extern char *get_emacs_configuration_options (void);
357 #define EMACS_CONFIGURATION get_emacs_configuration ()
358 #define EMACS_CONFIG_OPTIONS get_emacs_configuration_options ()
359
360 /* Define this so that winsock.h definitions don't get included with
361 windows.h. For this to have proper effect, config.h must always be
362 included before windows.h. */
363 #define _WINSOCKAPI_ 1
364 #define _WINSOCK_H
365
366 /* Defines size_t and alloca (). */
367 #ifdef USE_CRT_DLL
368 #define malloc e_malloc
369 #define free e_free
370 #define realloc e_realloc
371 #define calloc e_calloc
372 #endif
373 #include <malloc.h>
374
375 #include <sys/stat.h>
376
377 /* Define for those source files that do not include enough NT
378 system files. */
379 #ifndef NULL
380 #ifdef __cplusplus
381 #define NULL 0
382 #else
383 #define NULL ((void *)0)
384 #endif
385 #endif
386
387 /* For proper declaration of environ. */
388 #include <stdlib.h>
389 #ifndef sys_nerr
390 #define sys_nerr _sys_nerr
391 #endif
392 #include <string.h>
393
394 /* We need a little extra space, see ../../lisp/loadup.el. */
395 #define SYSTEM_PURESIZE_EXTRA 50000
396
397 /* For unexec to work on Alpha systems, we need to put Emacs'
398 initialized data into a separate section from the CRT initialized
399 data (because the Alpha linker freely reorders data variables, even
400 across libraries, so our data and the CRT data get intermingled).
401
402 Starting with MSVC 5.0, we must also place the uninitialized data
403 into its own section. VC5 intermingles uninitialized data from the CRT
404 between Emacs' static uninitialized data and its public uninitialized
405 data. A separate .bss section for Emacs groups both static and
406 public uninitialized together.
407
408 Note that unexw32.c relies on this fact, and must be modified
409 accordingly if this section name is changed, or if this pragma is
410 removed. Also, obviously, all files that define initialized data
411 must include config.h to pick up this pragma. */
412
413 /* Names must be < 8 bytes */
414 #ifdef _MSC_VER
415 #pragma data_seg("EMDATA")
416 #pragma bss_seg("EMBSS")
417 #endif
418
419 /* #define FULL_DEBUG */
420 /* #define EMACSDEBUG */
421
422 #ifdef EMACSDEBUG
423 extern void _DebPrint (const char *fmt, ...);
424 #define DebPrint(stuff) _DebPrint stuff
425 #else
426 #define DebPrint(stuff)
427 #endif
428
429
430 /* ============================================================ */
431
432 /* arch-tag: 5d4a3a1c-40dc-4dea-9c7c-38fed9ae0eae
433 (do not change this comment) */