1 /* @(#)prototyp.h	1.17 15/12/26 Copyright 1995-2015 J. Schilling */
2 /*
3  *	Definitions for dealing with ANSI / KR C-Compilers
4  *
5  *	Copyright (c) 1995-2015 J. Schilling
6  */
7 /*
8  * The contents of this file are subject to the terms of the
9  * Common Development and Distribution License, Version 1.0 only
10  * (the "License").  You may not use this file except in compliance
11  * with the License.
12  *
13  * See the file CDDL.Schily.txt in this distribution for details.
14  * A copy of the CDDL is also available via the Internet at
15  * http://www.opensource.org/licenses/cddl1.txt
16  *
17  * When distributing Covered Code, include this CDDL HEADER in each
18  * file and include the License file CDDL.Schily.txt from this distribution.
19  */
20 
21 /*
22  * <schily/mconfig.h> includes <schily/prototyp.h>
23  * To be correct, we need to include <schily/mconfig.h> before we test
24  * for _SCHILY_PROTOTYP_H
25  *
26  * In order to keep the silly Solaris hdrchk(1) quiet, we are forced to
27  * have the _SCHILY_PROTOTYP_H first in <schily/prototyp.h>.
28  * To keep hdrchk(1) quiet and be correct, we need to introduce a second
29  * guard _SCHILY_PROTOTYP_X_H.
30  */
31 #ifndef	_SCHILY_PROTOTYP_H
32 #define	_SCHILY_PROTOTYP_H
33 
34 #ifndef _SCHILY_MCONFIG_H
35 #undef	_SCHILY_PROTOTYP_H
36 #include <schily/mconfig.h>
37 #endif
38 
39 #ifndef	_SCHILY_PROTOTYP_X_H
40 #define	_SCHILY_PROTOTYP_X_H
41 
42 #include <schily/ccomdefs.h>
43 
44 #ifdef	__cplusplus
45 extern "C" {
46 #endif
47 
48 #ifndef	PROTOTYPES
49 	/*
50 	 * If this has already been defined,
51 	 * someone else knows better than us...
52 	 */
53 #	ifdef	__STDC__
54 #		if	__STDC__				/* ANSI C */
55 #			define	PROTOTYPES
56 #		endif
57 #		if	defined(sun) && __STDC__ - 0 == 0	/* Sun C */
58 #			define	PROTOTYPES
59 #		endif
60 #	endif
61 #endif	/* PROTOTYPES */
62 
63 #if	!defined(PROTOTYPES) && (defined(__cplusplus) || defined(_MSC_VER))
64 	/*
65 	 * C++ always supports prototypes.
66 	 * Define PROTOTYPES so we are not forced to make
67 	 * a separtate autoconf run for C++
68 	 *
69 	 * Microsoft C has prototypes but does not define __STDC__
70 	 */
71 #	define	PROTOTYPES
72 #endif
73 
74 /*
75  * If we have prototypes, we should have stdlib.h string.h stdarg.h
76  */
77 #ifdef	PROTOTYPES
78 #if	!(defined(SABER) && defined(sun))
79 #	ifndef	HAVE_STDARG_H
80 #		define	HAVE_STDARG_H
81 #	endif
82 #endif
83 #ifndef	JOS
84 #	ifndef	HAVE_STDLIB_H
85 #		define	HAVE_STDLIB_H
86 #	endif
87 #	ifndef	HAVE_STRING_H
88 #		define	HAVE_STRING_H
89 #	endif
90 #	ifndef	HAVE_STDC_HEADERS
91 #		define	HAVE_STDC_HEADERS
92 #	endif
93 #	ifndef	STDC_HEADERS
94 #		define	STDC_HEADERS	/* GNU name */
95 #	endif
96 #endif
97 #endif
98 
99 #ifdef	NO_PROTOTYPES		/* Force not to use prototypes */
100 #	undef	PROTOTYPES
101 #endif
102 
103 #ifdef	PROTOTYPES
104 #	define	__PR(a)	a
105 #else
106 #	define	__PR(a)	()
107 #endif
108 
109 #if !defined(PROTOTYPES) && !defined(NO_CONST_DEFINE)
110 #	ifndef	const
111 #		define	const
112 #	endif
113 #	ifndef	signed
114 #		define	signed
115 #	endif
116 #	ifndef	volatile
117 #		define	volatile
118 #	endif
119 #endif
120 
121 #ifdef	PROTOTYPES
122 #define	ALERT	'\a'
123 #else
124 #define	ALERT	'\07'
125 #endif
126 
127 #ifdef	__cplusplus
128 }
129 #endif
130 
131 #endif	/* _SCHILY_PROTOTYP_X_H */
132 #endif	/* _SCHILY_PROTOTYP_H */
133