1 /*
2  * This file has been modified for the cdrkit suite.
3  *
4  * The behaviour and appearence of the program code below can differ to a major
5  * extent from the version distributed by the original author(s).
6  *
7  * For details, see Changelog file distributed with the cdrkit package. If you
8  * received this file from another source then ask the distributing person for
9  * a log of modifications.
10  *
11  */
12 
13 /* @(#)mconfig.h	1.50 04/07/11 Copyright 1995 J. Schilling */
14 /*
15  *	definitions for machine configuration
16  *
17  *	Copyright (c) 1995 J. Schilling
18  *
19  *	This file must be included before any other file.
20  *	If this file is not included before stdio.h you will not be
21  *	able to get LARGEFILE support
22  *
23  *	Use only cpp instructions.
24  *
25  *	NOTE: SING: (Schily Is Not Gnu)
26  */
27 /*
28  * This program is free software; you can redistribute it and/or modify
29  * it under the terms of the GNU General Public License version 2
30  * as published by the Free Software Foundation.
31  *
32  * This program is distributed in the hope that it will be useful,
33  * but WITHOUT ANY WARRANTY; without even the implied warranty of
34  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
35  * GNU General Public License for more details.
36  *
37  * You should have received a copy of the GNU General Public License along with
38  * this program; see the file COPYING.  If not, write to the Free Software
39  * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
40  */
41 
42 #ifndef _MCONFIG_H
43 #define	_MCONFIG_H
44 
45 /* whatever, just shut up */
46 #define __sccsid "forked version from cdrkit"
47 #define _sccsid "forked version from cdrkit"
48 
49 /*
50  * This hack that is needed as long as VMS has no POSIX shell.
51  */
52 #ifdef	VMS
53 #	define	USE_STATIC_CONF
54 #endif
55 
56 #ifdef	USE_STATIC_CONF
57 #include <xmconfig.h>	/* This is the current static autoconf stuff */
58 #else
59 #include <xconfig.h>	/* This is the current dynamic autoconf stuff */
60 #endif
61 
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65 
66 /*
67  * The NetBSD people want to bother us.
68  * They removed the definition for 'unix' and are bleating for every test
69  * for #if defined(unix). So we need to check for NetBSD early.
70  */
71 #ifndef	IS_UNIX
72 #	if defined(__NetBSD__)
73 #		define	IS_UNIX
74 #	endif
75 #endif
76 
77 #ifndef	IS_UNIX
78 #	if (defined(unix) || defined(__unix) || defined(__unix__)) && !defined(__DJGPP__)
79 #		define	IS_UNIX
80 #	endif
81 #endif
82 
83 #ifdef	__MSDOS__
84 #	define	IS_MSDOS
85 #endif
86 
87 #if defined(tos) || defined(__tos)
88 #	define	IS_TOS
89 #endif
90 
91 #ifdef	THINK_C
92 #	define	IS_MAC
93 #endif
94 
95 #if defined(sun) || defined(__sun) || defined(__sun__)
96 #	define	IS_SUN
97 #endif
98 
99 #if defined(__CYGWIN32__) || defined(__CYGWIN__)
100 #	define	IS_GCC_WIN32
101 #	define	IS_CYGWIN
102 
103 #if	defined(unix) || defined(_X86)
104 #	define	IS_CYGWIN_1
105 #endif
106 #endif
107 
108 /*--------------------------------------------------------------------------*/
109 /*
110  * Some magic that cannot (yet) be figured out with autoconf.
111  */
112 
113 #if defined(sun3) || defined(mc68000) || defined(mc68020)
114 #	ifndef	HAVE_SCANSTACK
115 #	define	HAVE_SCANSTACK
116 #	endif
117 #endif
118 #ifdef sparc
119 #	ifndef	HAVE_LDSTUB
120 #	define	HAVE_LDSTUB
121 #	endif
122 #	ifndef	HAVE_SCANSTACK
123 #	define	HAVE_SCANSTACK
124 #	endif
125 #endif
126 #if	defined(__i386_) || defined(i386)
127 #	ifndef	HAVE_XCHG
128 #	define	HAVE_XCHG
129 #	endif
130 #	ifndef	HAVE_SCANSTACK
131 #	define	HAVE_SCANSTACK
132 #	endif
133 #endif
134 
135 /*
136  * Use of SCANSTACK is disabled by default
137  */
138 #ifndef	USE_SCANSTACK
139 #	undef	HAVE_SCANSTACK
140 #else
141 /*
142  * But ....
143  * The tests are much better now, so always give it a chance.
144  */
145 #ifndef	HAVE_SCANSTACK
146 #	define	HAVE_SCANSTACK
147 #endif
148 #endif
149 
150 /*
151  * Allow to overwrite the defines in the makefiles by calling
152  *
153  *	make COPTX=-DFORCE_SCANSTACK
154  */
155 #ifdef	FORCE_SCANSTACK
156 #	undef	NO_SCANSTACK
157 #ifndef	HAVE_SCANSTACK
158 #	define	HAVE_SCANSTACK
159 #endif
160 #ifndef	USE_SCANSTACK
161 #	define	USE_SCANSTACK
162 #endif
163 #endif
164 
165 /*
166  * This is the global switch to deactivate stack scanning
167  */
168 #ifdef	NO_SCANSTACK
169 #	ifdef	HAVE_SCANSTACK
170 #	undef	HAVE_SCANSTACK
171 #	endif
172 #endif
173 
174 #ifdef	NO_FORK
175 #	ifdef	HAVE_FORK
176 #	undef	HAVE_FORK
177 #	endif
178 #	ifdef	HAVE_VFORK
179 #	undef	HAVE_VFORK
180 #	endif
181 #endif
182 #ifdef	NO_VFORK
183 #	ifdef	HAVE_VFORK
184 #	undef	HAVE_VFORK
185 #	endif
186 #endif
187 
188 #if	defined(SOL2) || defined(SOL2) || \
189 	defined(S5R4) || defined(__S5R4) || defined(SVR4)
190 #	ifndef	__SVR4
191 #		define	__SVR4
192 #	endif
193 #endif
194 
195 #ifdef	__SVR4
196 #	ifndef	SVR4
197 #		define	SVR4
198 #	endif
199 #endif
200 
201 /*
202  * SunOS 4.x / SunOS 5.x
203  */
204 #if defined(IS_SUN)
205 #	define	HAVE_GETAV0
206 #endif
207 
208 /*
209  * AIX
210  */
211 #if	defined(_IBMR2) || defined(_AIX)
212 #	ifndef	IS_UNIX
213 #	define	IS_UNIX		/* ??? really ??? */
214 #	endif
215 #endif
216 
217 /*
218  * QNX
219  */
220 #if defined(__QNX__)
221 #	ifndef	IS_UNIX
222 #	define	IS_UNIX
223 #	endif
224 #endif
225 
226 /*
227  * Silicon Graphics	(must be before SVR4)
228  */
229 #if defined(sgi) || defined(__sgi)
230 #	define	__NOT_SVR4__	/* Not a real SVR4 implementation */
231 #endif
232 
233 /*
234  * Data General
235  */
236 #if defined(__DGUX__)
237 #ifdef	XXXXXXX
238 #	undef	HAVE_MTGET_DSREG
239 #	undef	HAVE_MTGET_RESID
240 #	undef	HAVE_MTGET_FILENO
241 #	undef	HAVE_MTGET_BLKNO
242 #endif
243 #	define	mt_type		mt_model
244 #	define	mt_dsreg	mt_status1
245 #	define	mt_erreg	mt_status2
246 	/*
247 	 * DGUX hides its flock as dg_flock.
248 	 */
249 #	define	HAVE_FLOCK
250 #	define	flock	dg_flock
251 	/*
252 	 * Use the BSD style wait on DGUX to get the resource usages of child
253 	 * processes.
254 	 */
255 #	define	_BSD_WAIT_FLAVOR
256 #endif
257 
258 /*
259  * Apple Rhapsody (This is the name for Mac OS X beta)
260  */
261 #if defined(__NeXT__) && defined(__TARGET_OSNAME) && __TARGET_OSNAME == rhapsody
262 #	define	HAVE_OSDEF /* prevent later definitions to overwrite current */
263 #	ifndef	IS_UNIX
264 #	define	IS_UNIX
265 #	endif
266 #endif
267 
268 /*
269  * NextStep
270  */
271 #if defined(__NeXT__) && !defined(HAVE_OSDEF)
272 #define	NO_PRINT_OVR
273 #undef	HAVE_USG_STDIO		/*
274 				 * NeXT Step 3.x uses __flsbuf(unsigned char, FILE *)
275 				 * instead of __flsbuf(int, FILE *)
276 				 */
277 #	ifndef	IS_UNIX
278 #	define	IS_UNIX
279 #	endif
280 #endif
281 
282 /*
283  * Mac OS X
284  */
285 #if defined(__APPLE__) && defined(__MACH__)
286 #	ifndef	IS_UNIX
287 #	define	IS_UNIX
288 #	endif
289 #	define	IS_MACOS_X
290 #endif
291 
292 /*
293  * NextStep 3.x has a broken linker that does not allow us to override
294  * these functions.
295  */
296 #ifndef	__OPRINTF__
297 
298 #ifdef	NO_PRINT_OVR
299 #	define	printf	Xprintf
300 #	define	fprintf	Xfprintf
301 #	define	sprintf	Xsprintf
302 #endif
303 
304 #endif	/* __OPRINTF__ */
305 
306 /*--------------------------------------------------------------------------*/
307 /*
308  * If there is no flock defined by the system, use emulation
309  * through fcntl record locking.
310  */
311 #ifndef HAVE_FLOCK
312 #define	LOCK_SH		1	/* shared lock */
313 #define	LOCK_EX		2	/* exclusive lock */
314 #define	LOCK_NB		4	/* don't block when locking */
315 #define	LOCK_UN		8	/* unlock */
316 #endif
317 
318 #ifndef	_PROTOTYP_H
319 #include <prototyp.h>
320 #endif
321 
322 /*
323  * gcc 2.x generally implements the long long type.
324  */
325 #ifdef	__GNUC__
326 #	if	__GNUC__ > 1
327 #		ifndef	HAVE_LONGLONG
328 #			define	HAVE_LONGLONG
329 #		endif
330 #	endif
331 #endif
332 
333 /*
334  * Convert to GNU name
335  */
336 #ifdef	HAVE_STDC_HEADERS
337 #	ifndef	STDC_HEADERS
338 #		define	STDC_HEADERS
339 #	endif
340 #endif
341 /*
342  * Convert to SCHILY name
343  */
344 #ifdef	STDC_HEADERS
345 #	ifndef	HAVE_STDC_HEADERS
346 #		define	HAVE_STDC_HEADERS
347 #	endif
348 #endif
349 
350 #ifdef	IS_UNIX
351 #	define	HAVE_PATH_DELIM
352 #	define	PATH_DELIM		'/'
353 #	define	PATH_DELIM_STR		"/"
354 #	define	PATH_ENV_DELIM		':'
355 #	define	PATH_ENV_DELIM_STR	":"
356 #	define	far
357 #	define	near
358 #endif
359 
360 /*
361  * Win32 with Gygwin
362  */
363 #ifdef	IS_GCC_WIN32
364 #	define	HAVE_PATH_DELIM
365 #	define	PATH_DELIM		'/'
366 #	define	PATH_DELIM_STR		"/"
367 #	define	PATH_ENV_DELIM		':'
368 #	define	PATH_ENV_DELIM_STR	":"
369 #	define	HAVE_DOS_DRIVELETTER
370 #	define	far
371 #	define	near
372 #	define	NEED_O_BINARY
373 #endif
374 
375 /*
376  * Win32 with Mingw32
377  */
378 #ifdef	__MINGW32__
379 #	define	HAVE_PATH_DELIM
380 #	define	PATH_DELIM		'/'
381 #	define	PATH_DELIM_STR		"/"
382 #	define	PATH_ENV_DELIM		';'
383 #	define	PATH_ENV_DELIM_STR	";"
384 #	define	HAVE_DOS_DRIVELETTER
385 #	define	far
386 #	define	near
387 #	define	NEED_O_BINARY
388 #endif
389 
390 /*
391  * OS/2 EMX
392  */
393 #ifdef	__EMX__				/* We don't want to call it UNIX */
394 #	define	HAVE_PATH_DELIM
395 #	define	PATH_DELIM		'/'
396 #	define	PATH_DELIM_STR		"/"
397 #	define	PATH_ENV_DELIM		';'
398 #	define	PATH_ENV_DELIM_STR	";"
399 #	define	HAVE_DOS_DRIVELETTER
400 #	define	far
401 #	define	near
402 #	define	NEED_O_BINARY
403 #endif
404 
405 #ifdef	__BEOS__			/* We don't want to call it UNIX */
406 #	define	HAVE_PATH_DELIM
407 #	define	PATH_DELIM		'/'
408 #	define	PATH_DELIM_STR		"/"
409 #	define	PATH_ENV_DELIM		':'
410 #	define	PATH_ENV_DELIM_STR	":"
411 #	define	far
412 #	define	near
413 #endif
414 
415 /*
416  * DOS with DJGPP
417  */
418 #ifdef	__DJGPP__			/* We don't want to call it UNIX */
419 #	define	HAVE_PATH_DELIM
420 #	define	PATH_DELIM		'/'
421 #	define	PATH_DELIM_STR		"/"
422 #	define	PATH_ENV_DELIM		';'
423 #	define	PATH_ENV_DELIM_STR	";"
424 #	define	HAVE_DOS_DRIVELETTER
425 
426 #	define	NEED_O_BINARY
427 #endif
428 
429 /*
430  * Vanilla DOS
431  */
432 #if	defined(IS_MSDOS) && !defined(__DJGPP__)
433 #	define	HAVE_PATH_DELIM
434 #	define	PATH_DELIM		'\\'
435 #	define	PATH_DELIM_STR		"\\"
436 #	define	PATH_ENV_DELIM		';'
437 #	define	PATH_ENV_DELIM_STR	";"
438 #	define	HAVE_DOS_DRIVELETTER
439 
440 #	define	NEED_O_BINARY
441 #endif
442 
443 /*
444  * ATARI TOS
445  */
446 #ifdef	IS_TOS
447 #	define	HAVE_PATH_DELIM
448 #	define	PATH_DELIM		'\\'
449 #	define	PATH_DELIM_STR		"\\"
450 #	define	PATH_ENV_DELIM		','
451 #	define	PATH_ENV_DELIM_STR	","
452 #	define	HAVE_DOS_DRIVELETTER
453 #	define	far
454 #	define	near
455 #endif
456 
457 /*
458  * Mac OS 9
459  */
460 #ifdef	IS_MAC
461 #	define	HAVE_PATH_DELIM
462 #	define	PATH_DELIM		':'
463 #	define	PATH_DELIM_STR		":"
464 #	define	PATH_ENV_DELIM		';'	/* ??? */
465 #	define	PATH_ENV_DELIM_STR	";"	/* ??? */
466 #	define	far
467 #	define	near
468 #endif
469 
470 /*
471  * I hope this will make compilation on unknown OS easier.
472  */
473 #ifndef	HAVE_PATH_DELIM			/* Default to POSIX rules */
474 #	define	HAVE_PATH_DELIM
475 #	define	PATH_DELIM		'/'
476 #	define	PATH_DELIM_STR		"/"
477 #	define	PATH_ENV_DELIM		':'
478 #	define	PATH_ENV_DELIM_STR	":"
479 #	define	far
480 #	define	near
481 #endif
482 
483 #ifdef __cplusplus
484 }
485 #endif
486 
487 #endif /* _MCONFIG_H */
488