ANN
0.1.1.5
A library containing multiple neural network models written in C
config.h
Go to the documentation of this file.
1
9
#ifndef _ANN_CONFIG_H_
10
#define _ANN_CONFIG_H_
11
12
#ifndef _GNU_SOURCE
13
#define _GNU_SOURCE
14
#endif
15
16
// COMPILER CHECK
17
#if defined(__clang__)
18
#define ANN_INLINE static inline
19
#elif defined(__GNUC__) || defined(__GNUG__)
20
#define ANN_INLINE inline
21
#elif defined(_MSC_VER)
22
#error "msvc not supported"
23
#endif
24
25
26
// HEADERS CHECK
27
#define HAVE_STDLIB_H
28
#define HAVE_STDIO_H
29
#define HAVE_STDARG_H
30
#define HAVE_UNISTD_H
31
#define HAVE_MATH_H
32
#define HAVE_MALLOC_H
33
#define HAVE_TIME_H
34
#define HAVE_SYS_TIME_H
35
#define HAVE_SYS_TYPES_H
36
#define HAVE_STRING_H
37
38
39
// FUNCTIONS CHECK
40
41
#define HAVE_SRAND
42
#define HAVE_RAND
43
#define HAVE_SRAND48
44
/* #undef HAVE_RAND48 */
45
#define HAVE_PRINTF
46
#define HAVE_SPRINTF
47
#define HAVE_SNPRINTF
48
#define HAVE_VSNPRINTF
49
#define HAVE_ASPRINTF
50
#define HAVE_VASPRINTF
51
#define HAVE_GRAPHVIZ_GVC_H
52
#define HAVE_GRAPHVIZ_CGRAPH_H
53
/* #undef HAVE_GRAPHVIZ_GRAPH_H */
54
55
// TYPES CHECK
56
57
#define HAVE_SSIZE_T
58
#define HAVE_SIZE_T
59
60
#ifndef HAVE_SIZE_T
61
#define size_t unsigned long int
62
#endif
63
64
#ifndef HAVE_SIZE_T
65
#define ssize_t signed long int
66
#endif
67
68
69
#ifdef HAVE_STDLIB_H
70
#include <stdlib.h>
71
#else
72
#error "stdlib.h not found"
73
#endif
74
75
#ifdef HAVE_STDIO_H
76
#include <stdio.h>
77
#else
78
#error "stdio.h not found"
79
#endif
80
81
#ifdef HAVE_STDARG_H
82
#include <stdarg.h>
83
#else
84
#warning "stdarg.h not found"
85
#endif
86
87
#ifdef HAVE_UNISTD_H
88
#include <unistd.h>
89
#else
90
#warning "stdio.h not found"
91
#endif
92
93
#ifdef HAVE_MATH_H
94
#include <math.h>
95
#else
96
#error "math.h not found"
97
#endif
98
99
#ifdef HAVE_MALLOC_H
100
#include <malloc.h>
101
#else
102
#error "malloc.h not found"
103
#endif
104
105
#ifdef HAVE_TIME_H
106
#include <time.h>
107
#elif defined HAVE_SYS_TIME_H
108
#include <sys/time.h>
109
#else
110
#warning "time.h not fund"
111
#endif
112
113
#ifdef HAVE_SYS_TYPES_H
114
#include <sys/types.h>
115
#else
116
#warning "sys/types.h not found"
117
#endif
118
119
#ifdef HAVE_STRING_H
120
#include <string.h>
121
#else
122
#warning "string.h not found"
123
size_t
strlen(
char
*s)
124
{
125
size_t
i;
126
for
(i = 0; s[i] != 0; ++i);
127
return
i;
128
}
129
#endif
130
131
#ifdef HAVE_GRAPHVIZ_GVC_H
132
#include <graphviz/gvc.h>
133
#if WITH_CGRAPH
134
#ifdef HAVE_GRAPHVIZ_CGRAPH_H
135
#include <graphviz/cgraph.h>
136
#else
137
#error "graphviz/cgraph.h not found"
138
#endif
139
#else
140
#ifdef HAVE_GRAPHVIZ_GRAPH_H
141
#include <graphviz/graph.h>
142
#else
143
#error "graphviz/graph.h not found"
144
#endif
145
#endif
146
#else
147
#error "graphviz/gvc.h not found"
148
#endif
149
150
151
#ifndef HAVE_SRAND
152
#ifdef HAVE_SRAND48
153
#define srand srand48
154
#else
155
#error "srand function undefined"
156
#endif
157
#endif
158
159
#ifndef HAVE_RAND
160
#ifdef HAVE_RAND48
161
#define rand rand48
162
#else
163
#error "rand function undefined"
164
#endif
165
#endif
166
167
#ifndef HAVE_PRINTF
168
#error "printf function undefined"
169
#endif
170
171
#ifndef HAVE_SPRINTF
172
#error "sprintf function undefined"
173
#endif
174
175
#ifndef HAVE_VSNPRINTF
176
#warning "vsnprintf function undefined"
177
#endif
178
179
#ifndef HAVE_SNPRINTF
180
#if (defined HAVE_VSNPRINTF) && (defined HAVE_STDARG_H)
181
int
snprintf (
char
*s,
size_t
n,
const
char
*format, ...)
182
{
183
int
result;
184
va_list ap;
185
va_start (ap, format);
186
result = vsnprintf (s, n, format, ap);
187
va_end (ap);
188
return
result;
189
}
190
#else
191
#error "snprintf function undefined"
192
#endif
193
194
#endif
195
196
#ifndef HAVE_VASPRINTF
197
#warning "vasprintf function undefined"
198
#endif
199
200
#ifndef HAVE_ASPRINTF
201
#if (defined HAVE_VASPRINTF) && (defined HAVE_STDARG_H)
202
int
asprintf (
char
**buf,
const
char
*fmt, ...)
203
{
204
int
status;
205
va_list ap;
206
va_start (ap, fmt);
207
status = vasprintf (buf, fmt, ap);
208
va_end (ap);
209
return
status;
210
}
211
#else
212
#error "asprintf function undefined"
213
#endif
214
#endif
215
216
#endif
/* _ANN_CONFIG_H_ */
include
ANN
config.h
Generated by
1.8.15