]>
Commit | Line | Data |
---|---|---|
ff66d28f PE |
1 | dnl |
2 | dnl This file contains stuff. | |
3 | dnl | |
4 | ||
5 | dnl | |
6 | dnl Check to see if the (math function) argument passed is | |
7 | dnl declared when using the c++ compiler | |
8 | dnl ASSUMES argument is a math function with ONE parameter | |
9 | dnl | |
10 | dnl GLIBCXX_CHECK_MATH_DECL_1 | |
f214923c | 11 | AC_DEFUN([GLIBCXX_CHECK_MATH_DECL_1], [ |
ff66d28f PE |
12 | AC_MSG_CHECKING([for $1 declaration]) |
13 | if test x${glibcxx_cv_func_$1_use+set} != xset; then | |
14 | AC_CACHE_VAL(glibcxx_cv_func_$1_use, [ | |
15 | AC_LANG_SAVE | |
16 | AC_LANG_CPLUSPLUS | |
17 | AC_TRY_COMPILE([#include <math.h> | |
18 | #ifdef HAVE_IEEEFP_H | |
19 | #include <ieeefp.h> | |
20 | #endif | |
21 | ], | |
22 | [ $1(0);], | |
23 | [glibcxx_cv_func_$1_use=yes], [glibcxx_cv_func_$1_use=no]) | |
24 | AC_LANG_RESTORE | |
25 | ]) | |
26 | fi | |
27 | AC_MSG_RESULT($glibcxx_cv_func_$1_use) | |
28 | ]) | |
29 | ||
30 | dnl | |
31 | dnl Check to see if the (math function) argument passed is | |
32 | dnl 1) declared when using the c++ compiler | |
33 | dnl 2) has "C" linkage | |
34 | dnl 3) if not, see if 1) and 2) for argument prepended with '_' | |
35 | dnl | |
36 | dnl Define HAVE_CARGF etc if "cargf" is declared and links | |
37 | dnl | |
38 | dnl argument 1 is name of function to check | |
39 | dnl | |
40 | dnl ASSUMES argument is a math function with ONE parameter | |
41 | dnl | |
42 | dnl GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1 | |
f214923c | 43 | AC_DEFUN([GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1], [ |
ff66d28f PE |
44 | GLIBCXX_CHECK_MATH_DECL_1($1) |
45 | if test x$glibcxx_cv_func_$1_use = x"yes"; then | |
46 | AC_CHECK_FUNCS($1) | |
47 | else | |
48 | GLIBCXX_CHECK_MATH_DECL_1(_$1) | |
49 | if test x$glibcxx_cv_func__$1_use = x"yes"; then | |
50 | AC_CHECK_FUNCS(_$1) | |
51 | fi | |
52 | fi | |
53 | ]) | |
54 | ||
55 | ||
56 | dnl | |
57 | dnl Like GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1, but does a bunch of | |
58 | dnl of functions at once. It's an all-or-nothing check -- either | |
59 | dnl HAVE_XYZ is defined for each of the functions, or for none of them. | |
60 | dnl Doing it this way saves significant configure time. | |
f214923c | 61 | AC_DEFUN([GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1], [ |
ff66d28f PE |
62 | AC_MSG_CHECKING([for $1 functions]) |
63 | AC_CACHE_VAL(glibcxx_cv_func_$2_use, [ | |
64 | AC_LANG_SAVE | |
65 | AC_LANG_CPLUSPLUS | |
66 | AC_TRY_COMPILE([#include <math.h>], | |
67 | [ `for x in $3; do echo "$x (0);"; done` ], | |
68 | [glibcxx_cv_func_$2_use=yes], | |
69 | [glibcxx_cv_func_$2_use=no]) | |
70 | AC_LANG_RESTORE]) | |
71 | AC_MSG_RESULT($glibcxx_cv_func_$2_use) | |
72 | if test x$glibcxx_cv_func_$2_use = x"yes"; then | |
73 | AC_CHECK_FUNCS($3) | |
74 | fi | |
75 | ]) | |
76 | ||
77 | dnl | |
78 | dnl Check to see if the (math function) argument passed is | |
79 | dnl declared when using the c++ compiler | |
80 | dnl ASSUMES argument is a math function with TWO parameters | |
81 | dnl | |
82 | dnl GLIBCXX_CHECK_MATH_DECL_2 | |
f214923c | 83 | AC_DEFUN([GLIBCXX_CHECK_MATH_DECL_2], [ |
ff66d28f PE |
84 | AC_MSG_CHECKING([for $1 declaration]) |
85 | if test x${glibcxx_cv_func_$1_use+set} != xset; then | |
86 | AC_CACHE_VAL(glibcxx_cv_func_$1_use, [ | |
87 | AC_LANG_SAVE | |
88 | AC_LANG_CPLUSPLUS | |
89 | AC_TRY_COMPILE([#include <math.h>], | |
90 | [ $1(0, 0);], | |
91 | [glibcxx_cv_func_$1_use=yes], [glibcxx_cv_func_$1_use=no]) | |
92 | AC_LANG_RESTORE | |
93 | ]) | |
94 | fi | |
95 | AC_MSG_RESULT($glibcxx_cv_func_$1_use) | |
96 | ]) | |
97 | ||
98 | dnl | |
99 | dnl Check to see if the (math function) argument passed is | |
100 | dnl 1) declared when using the c++ compiler | |
101 | dnl 2) has "C" linkage | |
102 | dnl | |
103 | dnl Define HAVE_CARGF etc if "cargf" is declared and links | |
104 | dnl | |
105 | dnl argument 1 is name of function to check | |
106 | dnl | |
107 | dnl ASSUMES argument is a math function with TWO parameters | |
108 | dnl | |
109 | dnl GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2 | |
f214923c | 110 | AC_DEFUN([GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2], [ |
ff66d28f PE |
111 | GLIBCXX_CHECK_MATH_DECL_2($1) |
112 | if test x$glibcxx_cv_func_$1_use = x"yes"; then | |
113 | AC_CHECK_FUNCS($1) | |
114 | else | |
115 | GLIBCXX_CHECK_MATH_DECL_2(_$1) | |
116 | if test x$glibcxx_cv_func__$1_use = x"yes"; then | |
117 | AC_CHECK_FUNCS(_$1) | |
118 | fi | |
119 | fi | |
120 | ]) | |
121 | ||
122 | ||
123 | dnl | |
124 | dnl Check to see if the (math function) argument passed is | |
125 | dnl declared when using the c++ compiler | |
126 | dnl ASSUMES argument is a math function with THREE parameters | |
127 | dnl | |
128 | dnl GLIBCXX_CHECK_MATH_DECL_3 | |
f214923c | 129 | AC_DEFUN([GLIBCXX_CHECK_MATH_DECL_3], [ |
ff66d28f PE |
130 | AC_MSG_CHECKING([for $1 declaration]) |
131 | if test x${glibcxx_cv_func_$1_use+set} != xset; then | |
132 | AC_CACHE_VAL(glibcxx_cv_func_$1_use, [ | |
133 | AC_LANG_SAVE | |
134 | AC_LANG_CPLUSPLUS | |
135 | AC_TRY_COMPILE([#include <math.h>], | |
136 | [ $1(0, 0, 0);], | |
137 | [glibcxx_cv_func_$1_use=yes], [glibcxx_cv_func_$1_use=no]) | |
138 | AC_LANG_RESTORE | |
139 | ]) | |
140 | fi | |
141 | AC_MSG_RESULT($glibcxx_cv_func_$1_use) | |
142 | ]) | |
143 | ||
144 | dnl | |
145 | dnl Check to see if the (math function) argument passed is | |
146 | dnl 1) declared when using the c++ compiler | |
147 | dnl 2) has "C" linkage | |
148 | dnl | |
149 | dnl Define HAVE_CARGF etc if "cargf" is declared and links | |
150 | dnl | |
151 | dnl argument 1 is name of function to check | |
152 | dnl | |
153 | dnl ASSUMES argument is a math function with THREE parameters | |
154 | dnl | |
155 | dnl GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_3 | |
f214923c | 156 | AC_DEFUN([GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_3], [ |
ff66d28f PE |
157 | GLIBCXX_CHECK_MATH_DECL_3($1) |
158 | if test x$glibcxx_cv_func_$1_use = x"yes"; then | |
159 | AC_CHECK_FUNCS($1) | |
160 | else | |
161 | GLIBCXX_CHECK_MATH_DECL_3(_$1) | |
162 | if test x$glibcxx_cv_func__$1_use = x"yes"; then | |
163 | AC_CHECK_FUNCS(_$1) | |
164 | fi | |
165 | fi | |
166 | ]) | |
167 | ||
168 | ||
222a5b1d RO |
169 | dnl |
170 | dnl Check to see if the (stdlib function) argument passed is | |
171 | dnl 1) declared when using the c++ compiler | |
172 | dnl 2) has "C" linkage | |
173 | dnl | |
174 | dnl argument 1 is name of function to check | |
175 | dnl | |
176 | dnl ASSUMES argument is a stdlib function without parameters | |
177 | dnl | |
178 | dnl GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_0 | |
f214923c | 179 | AC_DEFUN([GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_0], [ |
222a5b1d RO |
180 | AC_MSG_CHECKING([for $1 declaration]) |
181 | if test x${glibcxx_cv_func_$1_use+set} != xset; then | |
182 | AC_CACHE_VAL(glibcxx_cv_func_$1_use, [ | |
183 | AC_LANG_SAVE | |
184 | AC_LANG_CPLUSPLUS | |
185 | AC_TRY_COMPILE([#include <stdlib.h>], | |
186 | [ $1();], | |
187 | [glibcxx_cv_func_$1_use=yes], [glibcxx_cv_func_$1_use=no]) | |
188 | AC_LANG_RESTORE | |
189 | ]) | |
190 | fi | |
191 | AC_MSG_RESULT($glibcxx_cv_func_$1_use) | |
192 | if test x$glibcxx_cv_func_$1_use = x"yes"; then | |
193 | AC_CHECK_FUNCS($1) | |
194 | fi | |
195 | ]) | |
196 | ||
197 | ||
ff66d28f PE |
198 | dnl |
199 | dnl Check to see if the (stdlib function) argument passed is | |
200 | dnl 1) declared when using the c++ compiler | |
201 | dnl 2) has "C" linkage | |
202 | dnl | |
203 | dnl argument 1 is name of function to check | |
204 | dnl | |
205 | dnl ASSUMES argument is a math function with TWO parameters | |
206 | dnl | |
207 | dnl GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_2 | |
f214923c | 208 | AC_DEFUN([GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_2], [ |
ff66d28f PE |
209 | AC_MSG_CHECKING([for $1 declaration]) |
210 | if test x${glibcxx_cv_func_$1_use+set} != xset; then | |
211 | AC_CACHE_VAL(glibcxx_cv_func_$1_use, [ | |
212 | AC_LANG_SAVE | |
213 | AC_LANG_CPLUSPLUS | |
214 | AC_TRY_COMPILE([#include <stdlib.h>], | |
215 | [ $1(0, 0);], | |
216 | [glibcxx_cv_func_$1_use=yes], [glibcxx_cv_func_$1_use=no]) | |
217 | AC_LANG_RESTORE | |
218 | ]) | |
219 | fi | |
220 | AC_MSG_RESULT($glibcxx_cv_func_$1_use) | |
221 | if test x$glibcxx_cv_func_$1_use = x"yes"; then | |
222 | AC_CHECK_FUNCS($1) | |
223 | fi | |
224 | ]) | |
225 | ||
226 | ||
227 | dnl | |
228 | dnl Check to see if the (stdlib function) argument passed is | |
229 | dnl 1) declared when using the c++ compiler | |
230 | dnl 2) has "C" linkage | |
231 | dnl | |
232 | dnl argument 1 is name of function to check | |
233 | dnl | |
234 | dnl ASSUMES argument is a function with THREE parameters | |
235 | dnl | |
236 | dnl GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_3 | |
f214923c | 237 | AC_DEFUN([GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_3], [ |
ff66d28f PE |
238 | AC_MSG_CHECKING([for $1 declaration]) |
239 | if test x${glibcxx_cv_func_$1_use+set} != xset; then | |
240 | AC_CACHE_VAL(glibcxx_cv_func_$1_use, [ | |
241 | AC_LANG_SAVE | |
242 | AC_LANG_CPLUSPLUS | |
243 | AC_TRY_COMPILE([#include <stdlib.h>], | |
244 | [ $1(0, 0, 0);], | |
245 | [glibcxx_cv_func_$1_use=yes], [glibcxx_cv_func_$1_use=no]) | |
246 | AC_LANG_RESTORE | |
247 | ]) | |
248 | fi | |
249 | AC_MSG_RESULT($glibcxx_cv_func_$1_use) | |
250 | if test x$glibcxx_cv_func_$1_use = x"yes"; then | |
251 | AC_CHECK_FUNCS($1) | |
252 | fi | |
253 | ]) | |
254 | ||
255 | dnl | |
256 | dnl Because the builtins are picky picky picky about the arguments they take, | |
257 | dnl do an explict linkage tests here. | |
258 | dnl Check to see if the (math function) argument passed is | |
259 | dnl 1) declared when using the c++ compiler | |
260 | dnl 2) has "C" linkage | |
261 | dnl | |
262 | dnl Define HAVE_CARGF etc if "cargf" is declared and links | |
263 | dnl | |
264 | dnl argument 1 is name of function to check | |
265 | dnl | |
266 | dnl ASSUMES argument is a math function with ONE parameter | |
267 | dnl | |
268 | dnl GLIBCXX_CHECK_BUILTIN_MATH_DECL_LINKAGE_1 | |
f214923c | 269 | AC_DEFUN([GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1], [ |
ff66d28f PE |
270 | AC_MSG_CHECKING([for $1 declaration]) |
271 | if test x${glibcxx_cv_func_$1_use+set} != xset; then | |
272 | AC_CACHE_VAL(glibcxx_cv_func_$1_use, [ | |
273 | AC_LANG_SAVE | |
274 | AC_LANG_CPLUSPLUS | |
275 | AC_TRY_COMPILE([#include <math.h>], | |
276 | [ $1(0);], | |
277 | [glibcxx_cv_func_$1_use=yes], [glibcxx_cv_func_$1_use=no]) | |
278 | AC_LANG_RESTORE | |
279 | ]) | |
280 | fi | |
281 | AC_MSG_RESULT($glibcxx_cv_func_$1_use) | |
282 | if test x$glibcxx_cv_func_$1_use = x"yes"; then | |
283 | AC_MSG_CHECKING([for $1 linkage]) | |
284 | if test x${glibcxx_cv_func_$1_link+set} != xset; then | |
285 | AC_CACHE_VAL(glibcxx_cv_func_$1_link, [ | |
286 | AC_TRY_LINK([#include <math.h>], | |
287 | [ $1(0);], | |
288 | [glibcxx_cv_func_$1_link=yes], [glibcxx_cv_func_$1_link=no]) | |
289 | ]) | |
290 | fi | |
291 | AC_MSG_RESULT($glibcxx_cv_func_$1_link) | |
292 | if test x$glibcxx_cv_func_$1_link = x"yes"; then | |
293 | ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` | |
294 | AC_DEFINE_UNQUOTED(${ac_tr_func}) | |
295 | fi | |
296 | fi | |
297 | ]) | |
298 | ||
299 | ||
300 | dnl | |
301 | dnl Check to see what builtin math functions are supported | |
302 | dnl | |
303 | dnl check for __builtin_abs | |
304 | dnl check for __builtin_fabsf | |
305 | dnl check for __builtin_fabs | |
306 | dnl check for __builtin_fabl | |
307 | dnl check for __builtin_labs | |
308 | dnl check for __builtin_sqrtf | |
309 | dnl check for __builtin_sqrtl | |
310 | dnl check for __builtin_sqrt | |
311 | dnl check for __builtin_sinf | |
312 | dnl check for __builtin_sin | |
313 | dnl check for __builtin_sinl | |
314 | dnl check for __builtin_cosf | |
315 | dnl check for __builtin_cos | |
316 | dnl check for __builtin_cosl | |
317 | dnl | |
318 | dnl GLIBCXX_CHECK_BUILTIN_MATH_SUPPORT | |
f214923c | 319 | AC_DEFUN([GLIBCXX_CHECK_BUILTIN_MATH_SUPPORT], [ |
ff66d28f PE |
320 | dnl Test for builtin math functions. |
321 | dnl These are made in gcc/c-common.c | |
322 | GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs) | |
323 | GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf) | |
324 | GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs) | |
325 | GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl) | |
326 | GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs) | |
327 | ||
328 | GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf) | |
329 | GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrt) | |
330 | GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl) | |
331 | ||
332 | GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf) | |
333 | GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin) | |
334 | GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl) | |
335 | ||
336 | GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf) | |
337 | GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos) | |
338 | GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl) | |
339 | ||
340 | dnl There is, without a doubt, a more elegant way to have these | |
341 | dnl names exported so that they won't be stripped out of acconfig.h by | |
342 | dnl autoheader. I leave this as an exercise to somebody less frustrated | |
343 | dnl than I.... please email the libstdc++ list if you can figure out a | |
344 | dnl more elegant approach (see autoconf/acgen.m4 and specifically | |
345 | dnl AC_CHECK_FUNC for things to steal.) | |
346 | dummyvar=no | |
347 | if test x$dummyvar = x"yes"; then | |
348 | AC_DEFINE(HAVE___BUILTIN_ABS) | |
349 | AC_DEFINE(HAVE___BUILTIN_LABS) | |
350 | AC_DEFINE(HAVE___BUILTIN_COS) | |
351 | AC_DEFINE(HAVE___BUILTIN_COSF) | |
352 | AC_DEFINE(HAVE___BUILTIN_COSL) | |
353 | AC_DEFINE(HAVE___BUILTIN_FABS) | |
354 | AC_DEFINE(HAVE___BUILTIN_FABSF) | |
355 | AC_DEFINE(HAVE___BUILTIN_FABSL) | |
356 | AC_DEFINE(HAVE___BUILTIN_SIN) | |
357 | AC_DEFINE(HAVE___BUILTIN_SINF) | |
358 | AC_DEFINE(HAVE___BUILTIN_SINL) | |
359 | AC_DEFINE(HAVE___BUILTIN_SQRT) | |
360 | AC_DEFINE(HAVE___BUILTIN_SQRTF) | |
361 | AC_DEFINE(HAVE___BUILTIN_SQRTL) | |
362 | fi | |
363 | ]) | |
364 | ||
365 | dnl | |
366 | dnl Check to see what the underlying c library is like | |
367 | dnl These checks need to do two things: | |
368 | dnl 1) make sure the name is declared when using the c++ compiler | |
369 | dnl 2) make sure the name has "C" linkage | |
370 | dnl This might seem like overkill but experience has shown that it's not... | |
371 | dnl | |
372 | dnl Define HAVE_STRTOLD if "strtold" is declared and links | |
373 | dnl Define HAVE_STRTOF if "strtof" is declared and links | |
ff66d28f PE |
374 | dnl |
375 | dnl GLIBCXX_CHECK_STDLIB_SUPPORT | |
f214923c | 376 | AC_DEFUN([GLIBCXX_CHECK_STDLIB_SUPPORT], [ |
ff66d28f PE |
377 | ac_test_CXXFLAGS="${CXXFLAGS+set}" |
378 | ac_save_CXXFLAGS="$CXXFLAGS" | |
379 | CXXFLAGS='-fno-builtin -D_GNU_SOURCE' | |
380 | ||
381 | GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold) | |
382 | GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtof) | |
ff66d28f PE |
383 | |
384 | CXXFLAGS="$ac_save_CXXFLAGS" | |
385 | ]) | |
386 | ||
387 | dnl | |
388 | dnl Check to see what the underlying c library or math library is like. | |
389 | dnl These checks need to do two things: | |
390 | dnl 1) make sure the name is declared when using the c++ compiler | |
391 | dnl 2) make sure the name has "C" linkage | |
392 | dnl This might seem like overkill but experience has shown that it's not... | |
393 | dnl | |
394 | dnl Define HAVE_CARGF etc if "cargf" is found. | |
395 | dnl | |
396 | dnl GLIBCXX_CHECK_MATH_SUPPORT | |
f214923c | 397 | AC_DEFUN([GLIBCXX_CHECK_MATH_SUPPORT], [ |
ff66d28f PE |
398 | ac_test_CXXFLAGS="${CXXFLAGS+set}" |
399 | ac_save_CXXFLAGS="$CXXFLAGS" | |
400 | CXXFLAGS='-fno-builtin -D_GNU_SOURCE' | |
401 | ||
402 | dnl Check libm | |
403 | AC_CHECK_LIB(m, sin, libm="-lm") | |
404 | ac_save_LIBS="$LIBS" | |
405 | LIBS="$LIBS $libm" | |
406 | ||
fc2ae431 AP |
407 | dnl Check libmx |
408 | AC_CHECK_LIB(mx, sqrtf, libmx="-lmx") | |
409 | dnl ac_save_LIBS="$LIBS" | |
410 | LIBS="$LIBS $libmx" | |
411 | ||
ff66d28f PE |
412 | dnl Check to see if certain C math functions exist. |
413 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(isinf) | |
414 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(isnan) | |
415 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(finite) | |
416 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(copysign) | |
417 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_3(sincos) | |
418 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass) | |
419 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass) | |
420 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(hypot) | |
421 | ||
422 | dnl Check to see if basic C math functions have float versions. | |
423 | GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1(float trig, | |
424 | float_trig, | |
425 | acosf asinf atanf \ | |
426 | cosf sinf tanf \ | |
427 | coshf sinhf tanhf) | |
428 | GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1(float round, | |
429 | float_round, | |
430 | ceilf floorf) | |
431 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(expf) | |
432 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf) | |
433 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(isinff) | |
434 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(atan2f) | |
435 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf) | |
436 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf) | |
437 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf) | |
438 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(hypotf) | |
439 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf) | |
440 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(logf) | |
441 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(log10f) | |
442 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(modff) | |
443 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(powf) | |
444 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf) | |
445 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf) | |
446 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(finitef) | |
447 | ||
448 | dnl Check to see if basic C math functions have long double versions. | |
449 | GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1(long double trig, | |
450 | long_double_trig, | |
451 | acosl asinl atanl \ | |
452 | cosl sinl tanl \ | |
453 | coshl sinhl tanhl) | |
454 | GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1(long double round, | |
455 | long_double_round, | |
456 | ceill floorl) | |
457 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl) | |
458 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl) | |
459 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl) | |
460 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l) | |
461 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(expl) | |
462 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl) | |
463 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl) | |
464 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl) | |
465 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(hypotl) | |
466 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl) | |
467 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(logl) | |
468 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(log10l) | |
469 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(modfl) | |
470 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(powl) | |
471 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl) | |
472 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl) | |
473 | GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(finitel) | |
474 | ||
475 | dnl Some runtimes have these functions with a preceding underscore. Please | |
476 | dnl keep this sync'd with the one above. And if you add any new symbol, | |
477 | dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h. | |
478 | dnl Check to see if certain C math functions exist. | |
479 | ||
480 | dnl Check to see if basic C math functions have float versions. | |
481 | GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1(_float trig, | |
482 | _float_trig, | |
483 | _acosf _asinf _atanf \ | |
484 | _cosf _sinf _tanf \ | |
485 | _coshf _sinhf _tanhf) | |
486 | GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1(_float round, | |
487 | _float_round, | |
488 | _ceilf _floorf) | |
489 | ||
490 | dnl Check to see if basic C math functions have long double versions. | |
491 | GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double trig, | |
492 | _long_double_trig, | |
493 | _acosl _asinl _atanl \ | |
494 | _cosl _sinl _tanl \ | |
495 | _coshl _sinhl _tanhl) | |
496 | GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double round, | |
497 | _long_double_round, | |
498 | _ceill _floorl) | |
499 | ||
500 | LIBS="$ac_save_LIBS" | |
501 | CXXFLAGS="$ac_save_CXXFLAGS" | |
502 | ]) | |
503 | ||
504 | ||
505 | dnl | |
506 | dnl Check to see if there is native support for complex | |
507 | dnl | |
508 | dnl Don't compile bits in math/* if native support exits. | |
509 | dnl | |
510 | dnl Define USE_COMPLEX_LONG_DOUBLE etc if "copysignl" is found. | |
511 | dnl | |
512 | dnl GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT | |
f214923c | 513 | AC_DEFUN([GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT], [ |
ff66d28f PE |
514 | dnl Check for complex versions of math functions of platform. This will |
515 | dnl always pass if libm is available, and fail if it isn't. If it is | |
516 | dnl available, we assume we'll need it later, so add it to LIBS. | |
517 | AC_CHECK_LIB(m, main) | |
129057c1 | 518 | AC_REPLACE_MATHFUNCS(copysignf) |
ff66d28f PE |
519 | |
520 | dnl For __signbit to signbit conversions. | |
521 | AC_CHECK_FUNCS([__signbit], , [LIBMATHOBJS="$LIBMATHOBJS signbit.lo"]) | |
522 | AC_CHECK_FUNCS([__signbitf], , [LIBMATHOBJS="$LIBMATHOBJS signbitf.lo"]) | |
523 | ||
524 | dnl Compile the long double complex functions only if the function | |
525 | dnl provides the non-complex long double functions that are needed. | |
526 | dnl Currently this includes copysignl, which should be | |
527 | dnl cached from the GLIBCXX_CHECK_MATH_SUPPORT macro, above. | |
528 | if test x$ac_cv_func_copysignl = x"yes"; then | |
529 | AC_CHECK_FUNCS([__signbitl], , [LIBMATHOBJS="$LIBMATHOBJS signbitl.lo"]) | |
530 | fi | |
531 | ||
0df3f383 | 532 | # XXX Review this. Nothing uses it. |
ff66d28f PE |
533 | if test -n "$LIBMATHOBJS"; then |
534 | need_libmath=yes | |
535 | fi | |
536 | AC_SUBST(LIBMATHOBJS) | |
537 | ]) | |
538 | ||
539 | ||
540 | # Check for functions in math library. | |
541 | # Ulrich Drepper <drepper@cygnus.com>, 1998. | |
542 | # | |
543 | # This file can be copied and used freely without restrictions. It can | |
544 | # be used in projects which are not available under the GNU Public License | |
545 | # but which still want to provide support for the GNU gettext functionality. | |
546 | # Please note that the actual code is *not* freely available. | |
547 | # | |
548 | # serial 1 | |
549 | # | |
550 | dnl AC_REPLACE_MATHFUNCS(FUNCTION...) | |
f214923c | 551 | AC_DEFUN([AC_REPLACE_MATHFUNCS], |
ff66d28f PE |
552 | [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])]) |
553 | ||
554 | dnl vim:et:ts=2 |