document mingw linker fix and close associated bug
[debian/gzip] / tailor.h
1 /* tailor.h -- target dependent definitions
2
3    Copyright (C) 1997-1999, 2002, 2006, 2009-2018 Free Software Foundation,
4    Inc.
5    Copyright (C) 1992-1993 Jean-loup Gailly
6
7    This program 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, or (at your option)
10    any later version.
11
12    This program 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 this program; if not, write to the Free Software Foundation,
19    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
20
21 /* The target dependent definitions should be defined here only.
22  * The target dependent functions should be defined in tailor.c.
23  */
24
25 #if defined(__MSDOS__) && !defined(MSDOS)
26 #  define MSDOS
27 #endif
28
29 #if defined(__OS2__) && !defined(OS2)
30 #  define OS2
31 #endif
32
33 #if defined(OS2) && defined(MSDOS) /* MS C under OS/2 */
34 #  undef MSDOS
35 #endif
36
37 #ifdef MSDOS
38 #  ifdef __GNUC__
39      /* DJGPP version 1.09+ on MS-DOS.
40       * The DJGPP 1.09 stat() function must be upgraded before gzip will
41       * fully work.
42       */
43 #    define near
44 #  else
45 #    define MAXSEG_64K
46 #    ifdef __TURBOC__
47 #      define off_t long
48 #    else /* MSC */
49 #      define HAVE_SYS_UTIME_H
50 #    endif
51 #  endif
52 #  define MAX_PATH_LEN  128
53 #  define NO_MULTIPLE_DOTS
54 #  define MAX_EXT_CHARS 3
55 #  define Z_SUFFIX "z"
56 #  define NO_SIZE_CHECK
57 #  define UNLINK_READONLY_BUG
58 #  define casemap(c) tolow(c) /* Force file names to lower case */
59 #  include <io.h>
60 #  define OS_CODE  0x00
61 #  define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
62 #  if !defined(NO_ASM) && !defined(ASMV)
63 #    define ASMV
64 #  endif
65 #else
66 #  define near
67 #endif
68
69 #ifdef OS2
70 #  define MAX_PATH_LEN  260
71 #  ifdef OS2FAT
72 #    define NO_MULTIPLE_DOTS
73 #    define MAX_EXT_CHARS 3
74 #    define Z_SUFFIX "z"
75 #    define casemap(c) tolow(c)
76 #  endif
77 #  define UNLINK_READONLY_BUG
78 #  include <io.h>
79 #  define OS_CODE  0x06
80 #  define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
81 #  ifdef _MSC_VER
82 #    define HAVE_SYS_UTIME_H
83 #    define MAXSEG_64K
84 #    undef near
85 #    define near _near
86 #  endif
87 #  ifdef __EMX__
88 #    define HAVE_SYS_UTIME_H
89 #    define EXPAND(argc,argv) \
90        {_response(&argc, &argv); _wildcard(&argc, &argv);}
91 #  endif
92 #  ifdef __ZTC__
93 #    define NO_DIR 1
94 #    include <dos.h>
95 #    define EXPAND(argc,argv) \
96        {response_expand(&argc, &argv);}
97 #  endif
98 #endif
99
100 #if defined WIN32 || defined _WIN32
101 #  define HAVE_SYS_UTIME_H
102 #  define MAX_PATH_LEN  260
103 #  define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
104 #  define UNLINK_READONLY_BUG
105 #  include <io.h>
106 #  include <malloc.h>
107 #  ifdef NTFAT
108 #    define NO_MULTIPLE_DOTS
109 #    define MAX_EXT_CHARS 3
110 #    define Z_SUFFIX "z"
111 #    define casemap(c) tolow(c) /* Force file names to lower case */
112 #  endif
113 #  define OS_CODE  0x0b
114 #endif
115
116 #ifdef MSDOS
117 #  ifdef __TURBOC__
118 #    include <alloc.h>
119 #    define DYN_ALLOC
120      /* Turbo C 2.0 does not accept static allocations of large arrays */
121      void * fcalloc (unsigned items, unsigned size);
122      void fcfree (void *ptr);
123 #  else /* MSC */
124 #    include <malloc.h>
125 #    define fcalloc(nitems,itemsize) halloc((long)(nitems),(itemsize))
126 #    define fcfree(ptr) hfree(ptr)
127 #  endif
128 #else
129 #  ifdef MAXSEG_64K
130 #    define fcalloc(items,size) calloc((items),(size))
131 #  else
132 #    define fcalloc(items,size) malloc((size_t)(items)*(size_t)(size))
133 #  endif
134 #  define fcfree(ptr) free(ptr)
135 #endif
136
137 #if defined(ATARI) || defined(atarist)
138 #  define OS_CODE  0x05
139 #  ifdef TOSFS
140 #    define MAX_PATH_LEN  128
141 #    define NO_MULTIPLE_DOTS
142 #    define MAX_EXT_CHARS 3
143 #    define Z_SUFFIX "z"
144 #    define casemap(c) tolow(c) /* Force file names to lower case */
145 #  endif
146 #endif
147
148 #ifdef TOPS20
149 #  define OS_CODE  0x0a
150 #endif
151
152 #ifndef SIGPIPE
153 # define SIGPIPE 0
154 #endif
155
156
157         /* Common defaults */
158
159 #ifndef OS_CODE
160 #  define OS_CODE  0x03  /* assume Unix */
161 #endif
162
163 #ifndef casemap
164 #  define casemap(c) (c)
165 #endif
166
167 #ifndef OPTIONS_VAR
168 #  define OPTIONS_VAR "GZIP"
169 #endif
170
171 #ifndef Z_SUFFIX
172 #  define Z_SUFFIX ".gz"
173 #endif
174
175 #ifdef MAX_EXT_CHARS
176 #  define MAX_SUFFIX  MAX_EXT_CHARS
177 #else
178 #  define MAX_SUFFIX  30
179 #endif
180
181 #ifndef MAKE_LEGAL_NAME
182 #  ifdef NO_MULTIPLE_DOTS
183 #    define MAKE_LEGAL_NAME(name)   make_simple_name(name)
184 #  else
185 #    define MAKE_LEGAL_NAME(name)
186 #  endif
187 #endif
188
189 #ifndef MIN_PART
190 #  define MIN_PART 3
191    /* keep at least MIN_PART chars between dots in a file name. */
192 #endif
193
194 #ifndef EXPAND
195 #  define EXPAND(argc,argv)
196 #endif
197
198 #ifndef SET_BINARY_MODE
199 #  define SET_BINARY_MODE(fd)
200 #endif
201
202 #ifndef FALLTHROUGH
203 # if __GNUC__ < 7
204 #  define FALLTHROUGH ((void) 0)
205 # else
206 #  define FALLTHROUGH __attribute__ ((__fallthrough__))
207 # endif
208 #endif