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