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