1 /* system description file for cygwin32.
2 Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
4 This file is part of GNU Emacs.
6 GNU Emacs is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with XEmacs; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* Building under cygwin
23 * The approach I have taken with this port is to use primarily the
24 * UNIX code base adding stuff that is MS-Windows specific. This works
25 * quite well, and is in keeping with my perception of the cygwin
26 * philosophy. Note that if you make changes to this file you do NOT
27 * want to define WIN32_NATIVE (formerly "WINDOWSNT"), I repeat - do
28 * not define this, it will break everything horribly. What does get
29 * defined is HAVE_MS_WINDOWS, but this is done by configure and only
30 * applies to the window system.
32 * When building make sure your HOME path is unix style - i.e. without
35 * once you have done this, configure and make.
37 * windows '95 - I haven't tested this under '95, it will probably
38 * build but I konw there are some limitations with cygwin under 95 so
39 * YMMV. I build with NT4 SP3.
41 * Andy Piper <andy@xemacs.org> 8/1/98
42 * http://www.xemacs.freeserve.co.uk/ */
44 /* Identify ourselves */
47 /* cheesy way to determine cygwin version */
50 # ifdef HAVE_CYGWIN_VERSION_H
51 # include <cygwin/version.h>
54 # define CYGWIN_VERSION_DLL_MAJOR 19
55 # define CYGWIN_VERSION_DLL_MINOR 0
58 # define CYGWIN_VERSION_DLL_MAJOR 18
59 # define CYGWIN_VERSION_DLL_MINOR 0
60 # define BROKEN_CYGWIN
64 void cygwin32_win32_to_posix_path_list (const char*, char*);
65 int cygwin32_win32_to_posix_path_list_buf_size (const char*);
66 void cygwin32_posix_to_win32_path_list (const char*, char*);
67 int cygwin32_posix_to_win32_path_list_buf_size (const char*);
68 # if CYGWIN_VERSION_DLL_MAJOR < 20
73 int gettimeofday (struct timeval *tp, struct timezone *tzp);
74 int gethostname (char* name, int namelen);
75 char* mktemp (char *);
78 int ioctl (int, int, ...);
80 int lstat (const char *path, struct stat *buf);
82 int readlink (const char *path, void *buf, unsigned int bufsiz);
83 int symlink (const char *name1, const char *name2);
85 int setitimer (int which, const struct itimerval *value,
86 struct itimerval *ovalue);
87 int utimes (char *file, struct timeval *tvp);
89 int srandom (unsigned seed);
92 # endif /* CYGWIN_VERSION_DLL_MAJOR < 20 */
94 # if CYGWIN_VERSION_DLL_MAJOR <= 20
95 char *getpass (const char *prompt);
97 # endif /* CYGWIN_VERSION_DLL_MAJOR <= 20 */
101 #ifndef ORDINARY_LINK
102 #define ORDINARY_LINK
105 #define C_SWITCH_SYSTEM -Wno-sign-compare -fno-caller-saves
106 #define LIBS_SYSTEM -lwinmm
107 #define WIN32_LEAN_AND_MEAN
109 #define TEXT_START -1
114 #define UNEXEC "unexcw.o"
116 #ifdef CYGWIN_VERSION_DLL_MAJOR
118 /* #### FIXME: although defining BROKEN_SIGIO is correct for proper ^G
119 behavior, bugs in cygwin mean that xemacs locks up frequently if
124 #define PROCESS_IO_BLOCKING
126 #define strnicmp strncasecmp
130 #define OBJECTS_SYSTEM ntplay.o
132 #undef MAIL_USE_SYSTEM_LOCK
134 /* Define NO_ARG_ARRAY if you cannot take the address of the first of a
135 * group of arguments and treat it as an array of the arguments. */
139 /* Data type of load average, as read out of kmem. */
141 #define LOAD_AVE_TYPE long
143 /* Convert that into an integer that is 100 for a load average of 1.0 */
145 #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
147 /* Define VIRT_ADDR_VARIES if the virtual addresses of
148 pure and impure space as loaded can vary, and even their
149 relative order cannot be relied on.
151 Otherwise Emacs assumes that text space precedes data space,
154 /* Text does precede data space, but this is never a safe assumption. */
155 #define VIRT_ADDR_VARIES
157 /* If you are compiling with a non-C calling convention but need to
158 declare vararg routines differently, put it here */
159 #define _VARARGS_ __cdecl
161 /* If you are providing a function to something that will call the
162 function back (like a signal handler and signal, or main) its calling
163 convention must be whatever standard the libraries expect */
164 #define _CALLBACK_ __cdecl
166 /* SYSTEM_TYPE should indicate the kind of system you are using.
167 It sets the Lisp variable system-type. */
169 #define SYSTEM_TYPE "cygwin32"
173 /* define MAIL_USE_FLOCK if the mailer uses flock
174 to interlock access to /usr/spool/mail/$USER.
175 The alternative is that a lock file named
176 /usr/spool/mail/$USER.lock. */
178 /* If the character used to separate elements of the executable path
179 is not ':', #define this to be the appropriate character constant. */
182 /* ============================================================ */
184 /* Here, add any special hacks needed
185 to make Emacs work on this system. For example,
186 you might define certain system call names that don't
187 exist on your system, or that do different things on
188 your system and must be used only through an encapsulation
189 (Which you should place, by convention, in sysdep.c). */
191 /* Define this to be the separator between path elements */
192 /* #define DIRECTORY_SEP XINT (Vdirectory_sep_char) */
194 /* Define this to be the separator between devices and paths */
195 #define DEVICE_SEP ':'
197 /* We'll support either convention on NT. */
198 #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
199 #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
200 #define EXEC_SUFFIXES ".exe:.com:.bat:.cmd:"
202 /* We need a little extra space, see ../../lisp/loadup.el */
203 #define SYSTEM_PURESIZE_EXTRA 15000
205 #define CYGWIN_CONV_PATH(src, dst) \
206 dst = alloca (cygwin32_win32_to_posix_path_list_buf_size(src)); \
207 cygwin32_win32_to_posix_path_list(src, dst)
208 #define CYGWIN_WIN32_PATH(src, dst) \
209 dst = alloca (cygwin32_posix_to_win32_path_list_buf_size(src)); \
210 cygwin32_posix_to_win32_path_list(src, dst)
216 #define FIRST_PTY_LETTER 'z'
218 /* Pseudo-terminal support under SVR4 only loops to deal with errors. */
220 #define PTY_ITERATION for (i = 0, c = 0; i < 1; i++)
222 /* This sets the name of the master side of the PTY. */
224 #define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx");
226 /* This sets the name of the slave side of the PTY. On SysVr4,
227 grantpt(3) forks a subprocess, so keep sigchld_handler() from
228 intercepting that death. If any child but grantpt's should die
229 within, it should be caught after EMACS_UNBLOCK_SIGNAL. */
232 fd = open (pty_name, O_RDWR | O_NONBLOCK | OPEN_BINARY, 0)
234 #define PTY_TTY_NAME_SPRINTF \
236 extern char* ptsname(int); \
239 if (!(ptyname = ptsname (fd))) \
240 { close (fd); return -1; } \
241 strncpy (pty_name, ptyname, sizeof (pty_name)); \
242 pty_name[sizeof (pty_name) - 1] = 0; \
245 /* ============================================================ */