Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(390)

Side by Side Diff: gcc/mpfr/acinclude.m4

Issue 3050029: [gcc] GCC 4.5.0=>4.5.1 (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/nacl-toolchain.git
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gcc/mpfr/PATCHES ('k') | gcc/mpfr/acos.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 dnl MPFR specific autoconf macros
2
3 dnl Copyright 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Softwar e Foundation, Inc.
4 dnl Contributed by the Arenaire and Cacao projects, INRIA.
5 dnl
6 dnl This file is part of the GNU MPFR Library.
7 dnl
8 dnl The GNU MPFR Library is free software; you can redistribute it and/or modif y
9 dnl it under the terms of the GNU Lesser General Public License as published
10 dnl by the Free Software Foundation; either version 2.1 of the License, or (at
11 dnl your option) any later version.
12 dnl
13 dnl The GNU MPFR Library is distributed in the hope that it will be useful, but
14 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16 dnl License for more details.
17 dnl
18 dnl You should have received a copy of the GNU Lesser General Public License
19 dnl along with the GNU MPFR Library; see the file COPYING.LIB. If not, write t o
20 dnl the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
21 dnl MA 02110-1301, USA.
22
23 dnl autoconf 2.60 is necessary because of the use of AC_PROG_SED.
24 dnl The following line allows the autoconf wrapper (when installed)
25 dnl to work as expected.
26 AC_PREREQ(2.60)
27
28 dnl ------------------------------------------------------------
29 dnl You must put in MPFR_CONFIGS everything which configure MPFR
30 dnl except:
31 dnl -everything dealing with CC and CFLAGS in particular the ABI
32 dnl but the IEEE-754 specific flags must be set here.
33 dnl -GMP's linkage.
34 dnl -Libtool stuff.
35 dnl -Handling of special arguments of MPFR's configure.
36 AC_DEFUN([MPFR_CONFIGS],
37 [
38 AC_REQUIRE([AC_OBJEXT])
39 AC_REQUIRE([MPFR_CHECK_LIBM])
40 AC_REQUIRE([AC_HEADER_TIME])
41 AC_REQUIRE([AC_CANONICAL_HOST])
42
43 AC_CHECK_HEADER([limits.h],, AC_MSG_ERROR([limits.h not found]))
44 AC_CHECK_HEADER([float.h],, AC_MSG_ERROR([float.h not found]))
45 AC_CHECK_HEADER([string.h],, AC_MSG_ERROR([string.h not found]))
46
47 dnl Check for locales
48 AC_CHECK_HEADERS([locale.h])
49
50 dnl Check for wide characters (wchar_t and wint_t)
51 AC_CHECK_HEADERS([wchar.h])
52
53 dnl Check for stdargs
54 AC_CHECK_HEADER([stdarg.h],[AC_DEFINE([HAVE_STDARG],1,[Define if stdarg])],
55 [AC_CHECK_HEADER([varargs.h],,
56 AC_MSG_ERROR([stdarg.h or varargs.h not found]))])
57
58 dnl sys/fpu.h - MIPS specific
59 AC_CHECK_HEADERS([sys/time.h sys/fpu.h])
60
61 dnl SIZE_MAX macro
62 gl_SIZE_MAX
63
64 dnl va_copy macro
65 AC_MSG_CHECKING([how to copy va_list])
66 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
67 #include <stdarg.h>
68 ]], [[
69 va_list ap1, ap2;
70 va_copy(ap1, ap2);
71 ]])], AC_MSG_RESULT([va_copy]),
72 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
73 #include <stdarg.h>
74 ]], [[
75 va_list ap1, ap2;
76 __va_copy(ap1, ap2);
77 ]])], [AC_DEFINE([va_copy], [__va_copy]) AC_MSG_RESULT([__va_copy])],
78 [AC_DEFINE([va_copy(dest,src)], [memcpy(&dest,&src,sizeof(va_list))])
79 AC_MSG_RESULT([memcpy])])
80 ])
81
82 dnl FIXME: The functions memmove, memset and strtol are really needed by
83 dnl MPFR, but if they are implemented as macros, this is also OK (in our
84 dnl case). So, we do not return an error, but their tests are currently
85 dnl useless.
86 dnl gettimeofday is not defined for MinGW
87 AC_CHECK_FUNCS([memmove memset setlocale strtol gettimeofday])
88
89 dnl Check for IEEE-754 switches on Alpha
90 case $host in
91 alpha*-*-*)
92 saved_CFLAGS="$CFLAGS"
93 AC_CACHE_CHECK([for IEEE-754 switches], mpfr_cv_ieee_switches, [
94 if test -n "$GCC"; then
95 mpfr_cv_ieee_switches="-mfp-rounding-mode=d -mieee-with-inexact"
96 else
97 mpfr_cv_ieee_switches="-fprm d -ieee_with_inexact"
98 fi
99 CFLAGS="$CFLAGS $mpfr_cv_ieee_switches"
100 AC_TRY_COMPILE(,,, mpfr_cv_ieee_switches="none")
101 ])
102 if test "$mpfr_cv_ieee_switches" = "none"; then
103 CFLAGS="$saved_CFLAGS"
104 else
105 CFLAGS="$saved_CFLAGS $mpfr_cv_ieee_switches"
106 fi
107 esac
108
109 dnl Check for Core2 processor
110 case $host in
111 x86_64-*linux*)
112 case `sed -n '/^vendor_id/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
113 *Intel*) AC_DEFINE(HAVE_HOST_CORE2,1,[Define if processor is Core 2]) ;;
114 esac
115 esac
116
117 dnl check for long long
118 AC_CHECK_TYPE([long long int],
119 AC_DEFINE(HAVE_LONG_LONG, 1, [Define if compiler supports long long]),,)
120
121 dnl intmax_t is C99
122 AC_CHECK_TYPES([intmax_t])
123
124 AC_CHECK_TYPE( [union fpc_csr],
125 AC_DEFINE(HAVE_FPC_CSR,1,[Define if union fpc_csr is available]), ,
126 [
127 #if HAVE_SYS_FPU_H
128 # include <sys/fpu.h>
129 #endif
130 ])
131
132 dnl Check for fesetround
133 AC_CACHE_CHECK([for fesetround], mpfr_cv_have_fesetround, [
134 saved_LIBS="$LIBS"
135 LIBS="$LIBS $MPFR_LIBM"
136 AC_TRY_LINK([#include <fenv.h>], [fesetround(FE_TONEAREST);],
137 mpfr_cv_have_fesetround=yes, mpfr_cv_have_fesetround=no)
138 LIBS="$saved_LIBS"
139 ])
140 if test "$mpfr_cv_have_fesetround" = "yes"; then
141 AC_DEFINE(MPFR_HAVE_FESETROUND,1,[Define if you have the `fesetround' function via the <fenv.h> header file.])
142 fi
143
144 dnl Check for gcc float-conversion bug; if need be, -ffloat-store is used to
145 dnl force the conversion to the destination type when a value is stored to
146 dnl a variable (see ISO C99 standard 5.1.2.3#13, 6.3.1.5#2, 6.3.1.8#2). This
147 dnl is important concerning the exponent range. Note that this doesn't solve
148 dnl the double-rounding problem.
149 if test -n "$GCC"; then
150 AC_CACHE_CHECK([for gcc float-conversion bug], mpfr_cv_gcc_floatconv_bug, [
151 saved_LIBS="$LIBS"
152 LIBS="$LIBS $MPFR_LIBM"
153 AC_TRY_RUN([
154 #include <float.h>
155 #ifdef MPFR_HAVE_FESETROUND
156 #include <fenv.h>
157 #endif
158 static double get_max (void);
159 int main() {
160 double x = 0.5;
161 int i;
162 for (i = 1; i <= 11; i++)
163 x *= x;
164 if (x != 0)
165 return 1;
166 #ifdef MPFR_HAVE_FESETROUND
167 /* Useful test for the G4 PowerPC */
168 fesetround(FE_TOWARDZERO);
169 x = get_max ();
170 x *= 2.0;
171 if (x != get_max ())
172 return 1;
173 #endif
174 return 0;
175 }
176 static double get_max (void) { return DBL_MAX; }
177 ], [mpfr_cv_gcc_floatconv_bug="no"],
178 [mpfr_cv_gcc_floatconv_bug="yes, use -ffloat-store"],
179 [mpfr_cv_gcc_floatconv_bug="cannot test, use -ffloat-store"])
180 LIBS="$saved_LIBS"
181 ])
182 if test "$mpfr_cv_gcc_floatconv_bug" != "no"; then
183 CFLAGS="$CFLAGS -ffloat-store"
184 fi
185 fi
186
187 dnl Check if denormalized numbers are supported
188 AC_CACHE_CHECK([for denormalized numbers], mpfr_cv_have_denorms, [
189 AC_TRY_RUN([
190 #include <math.h>
191 #include <stdio.h>
192 int main() {
193 double x = 2.22507385850720138309e-308;
194 fprintf (stderr, "%e\n", x / 2.0);
195 return 2.0 * (x / 2.0) != x;
196 }
197 ], mpfr_cv_have_denorms=yes, mpfr_cv_have_denorms=no, mpfr_cv_have_denorms=no)
198 ])
199 if test "$mpfr_cv_have_denorms" = "yes"; then
200 AC_DEFINE(HAVE_DENORMS,1,[Define if denormalized floats work.])
201 fi
202
203 dnl Check whether NAN != NAN (as required by the IEEE-754 standard,
204 dnl but not by the ISO C standard). For instance, this is false with
205 dnl MIPSpro 7.3.1.3m under IRIX64. By default, assume this is true.
206 AC_CACHE_CHECK([if NAN == NAN], mpfr_cv_nanisnan, [
207 AC_TRY_RUN([
208 #include <stdio.h>
209 #include <math.h>
210 #ifndef NAN
211 # define NAN (0.0/0.0)
212 #endif
213 int main() {
214 double d;
215 d = NAN;
216 return d != d;
217 }
218 ], [mpfr_cv_nanisnan="yes"],
219 [mpfr_cv_nanisnan="no"],
220 [mpfr_cv_nanisnan="cannot test, assume no"])
221 ])
222 if test "$mpfr_cv_nanisnan" = "yes"; then
223 AC_DEFINE(MPFR_NANISNAN,1,[Define if NAN == NAN.])
224 AC_MSG_WARN([The test NAN != NAN is false. The probable reason is that])
225 AC_MSG_WARN([your compiler optimizes floating-point expressions in an])
226 AC_MSG_WARN([unsafe way because some option, such as -ffast-math or])
227 AC_MSG_WARN([-fast (depending on the compiler), has been used. You])
228 AC_MSG_WARN([should NOT use such an option, otherwise MPFR functions])
229 AC_MSG_WARN([such as mpfr_get_d and mpfr_set_d may return incorrect])
230 AC_MSG_WARN([results on special FP numbers (e.g. NaN or signed zeros).])
231 AC_MSG_WARN([If you did not use such an option, please send us a bug])
232 AC_MSG_WARN([report so that we can try to find a workaround for your])
233 AC_MSG_WARN([platform and/or document the behavior.])
234 fi
235
236 dnl Check if the chars '0' to '9' are consecutive values
237 AC_MSG_CHECKING([if charset has consecutive values])
238 AC_RUN_IFELSE(AC_LANG_PROGRAM([[
239 char *number = "0123456789";
240 char *lower = "abcdefghijklmnopqrstuvwxyz";
241 char *upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
242 ]],[[
243 int i;
244 unsigned char *p;
245 for (p = (unsigned char*) number, i = 0; i < 9; i++)
246 if ( (*p)+1 != *(p+1) ) return 1;
247 for (p = (unsigned char*) lower, i = 0; i < 25; i++)
248 if ( (*p)+1 != *(p+1) ) return 1;
249 for (p = (unsigned char*) upper, i = 0; i < 25; i++)
250 if ( (*p)+1 != *(p+1) ) return 1;
251 ]]), [AC_MSG_RESULT(yes)],[
252 AC_MSG_RESULT(no)
253 AC_DEFINE(MPFR_NO_CONSECUTIVE_CHARSET,1,[Charset is not consecutive])
254 ], [AC_MSG_RESULT(can not test)])
255
256 dnl Must be checked with the LIBM
257 dnl but we don't want to add the LIBM to MPFR dependency.
258 dnl Can't use AC_CHECK_FUNCS since the function may be in LIBM but
259 dnl not exported in math.h
260 saved_LIBS="$LIBS"
261 LIBS="$LIBS $MPFR_LIBM"
262 dnl AC_CHECK_FUNCS([round trunc floor ceil nearbyint])
263 AC_MSG_CHECKING(for math/round)
264 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
265 #include <math.h>
266 int f (double (*func)(double)) { return 0;}
267 ]], [[
268 double a = 17.42;
269 a = f (round);
270 return 0;
271 ]])], [
272 AC_MSG_RESULT(yes)
273 AC_DEFINE(HAVE_ROUND, 1,[Have ISO-C99 round function])
274 ],[AC_MSG_RESULT(no)])
275
276 AC_MSG_CHECKING(for math/trunc)
277 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
278 #include <math.h>
279 int f (double (*func)(double)) { return 0;}
280 ]], [[
281 double a = 17.42;
282 a = f(trunc);
283 return 0;
284 ]])], [
285 AC_MSG_RESULT(yes)
286 AC_DEFINE(HAVE_TRUNC, 1,[Have ISO-C99 trunc function])
287 ],[AC_MSG_RESULT(no)])
288
289 AC_MSG_CHECKING(for math/floor)
290 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
291 #include <math.h>
292 int f (double (*func)(double)) { return 0;}
293 ]], [[
294 double a = 17.42;
295 a = f(floor);
296 return 0;
297 ]])], [
298 AC_MSG_RESULT(yes)
299 AC_DEFINE(HAVE_FLOOR, 1,[Have ISO-C99 floor function])
300 ],[AC_MSG_RESULT(no)])
301
302 AC_MSG_CHECKING(for math/ceil)
303 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
304 #include <math.h>
305 int f (double (*func)(double)) { return 0;}
306 ]], [[
307 double a = 17.42;
308 a = f(ceil);
309 return 0;
310 ]])], [
311 AC_MSG_RESULT(yes)
312 AC_DEFINE(HAVE_CEIL, 1,[Have ISO-C99 ceil function])
313 ],[AC_MSG_RESULT(no)])
314
315 AC_MSG_CHECKING(for math/rint)
316 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
317 #include <math.h>
318 int f (double (*func)(double)) { return 0;}
319 ]], [[
320 double a = 17.42;
321 a = f(nearbyint);
322 return 0;
323 ]])], [
324 AC_MSG_RESULT(yes)
325 AC_DEFINE(HAVE_NEARBYINT, 1,[Have ISO-C99 rint function])
326 ],[AC_MSG_RESULT(no)])
327
328 LIBS="$saved_LIBS"
329
330 dnl Now try to check the long double format
331 MPFR_C_LONG_DOUBLE_FORMAT
332
333 dnl Check if thread-local variables are supported.
334 dnl At least two problems can occur in practice:
335 dnl 1. The compilation fails, e.g. because the compiler doesn't know
336 dnl about the __thread keyword.
337 dnl 2. The compilation succeeds, but the system doesn't support TLS or
338 dnl there is some ld configuration problem. One of the effects can
339 dnl be that thread-local variables always evaluate to 0. So, it is
340 dnl important to run the test below.
341 if test "$enable_thread_safe" = yes; then
342 AC_CACHE_CHECK([for TLS support], mpfr_cv_working_tls, [
343 saved_CPPFLAGS="$CPPFLAGS"
344 # The -I$srcdir is necessary when objdir is different from srcdir.
345 CPPFLAGS="$CPPFLAGS -I$srcdir"
346 AC_RUN_IFELSE([
347 #define MPFR_USE_THREAD_SAFE 1
348 #include "mpfr-thread.h"
349 MPFR_THREAD_ATTR int x = 17;
350 int main() {
351 return x != 17;
352 }
353 ], [mpfr_cv_working_tls="yes"],
354 [AC_MSG_RESULT(no)
355 AC_MSG_ERROR([please configure with --disable-thread-safe])],
356 [mpfr_cv_working_tls="cannot test, assume yes"])
357 CPPFLAGS="$saved_CPPFLAGS"
358 ])
359 fi
360 ])
361
362
363 dnl MPFR_C_LONG_DOUBLE_FORMAT
364 dnl -------------------------
365 dnl Determine the format of a long double.
366 dnl
367 dnl The object file is grepped, so as to work when cross compiling. A
368 dnl start and end sequence is included to avoid false matches, and
369 dnl allowance is made for the desired data crossing an "od -b" line
370 dnl boundary. The test number is a small integer so it should appear
371 dnl exactly, no rounding or truncation etc.
372 dnl
373 dnl "od -b" is supported even by Unix V7, and the awk script used doesn't
374 dnl have functions or anything, so even an "old" awk should suffice.
375 dnl
376 dnl The 10-byte IEEE extended format is generally padded to either 12 or 16
377 dnl bytes for alignment purposes. The SVR4 i386 ABI is 12 bytes, or i386
378 dnl gcc -m128bit-long-double selects 16 bytes. IA-64 is 16 bytes in LP64
379 dnl mode, or 12 bytes in ILP32 mode. The first 10 bytes is the relevant
380 dnl part in all cases (big and little endian).
381 dnl
382 dnl Enhancements:
383 dnl
384 dnl Could match more formats, but no need to worry until there's code
385 dnl wanting to use them.
386 dnl
387 dnl Don't want to duplicate the double matching from GMP_C_DOUBLE_FORMAT,
388 dnl perhaps we should merge with that macro, to match data formats
389 dnl irrespective of the C type in question. Or perhaps just let the code
390 dnl use DOUBLE macros when sizeof(double)==sizeof(long double).
391
392 AC_DEFUN([MPFR_C_LONG_DOUBLE_FORMAT],
393 [AC_REQUIRE([AC_PROG_CC])
394 AC_REQUIRE([AC_PROG_AWK])
395 AC_REQUIRE([AC_OBJEXT])
396 AC_CHECK_TYPES([long double])
397 AC_CACHE_CHECK([format of `long double' floating point],
398 mpfr_cv_c_long_double_format,
399 [mpfr_cv_c_long_double_format=unknown
400 if test "$ac_cv_type_long_double" != yes; then
401 mpfr_cv_c_long_double_format="not available"
402 else
403 cat >conftest.c <<\EOF
404 [
405 /* "before" is 16 bytes to ensure there's no padding between it and "x".
406 We're not expecting any "long double" bigger than 16 bytes or with
407 alignment requirements stricter than 16 bytes. */
408 struct {
409 char before[16];
410 long double x;
411 char after[8];
412 } foo = {
413 { '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
414 '\001', '\043', '\105', '\147', '\211', '\253', '\315', '\357' },
415 -123456789.0,
416 { '\376', '\334', '\272', '\230', '\166', '\124', '\062', '\020' }
417 };
418 ]
419 EOF
420 mpfr_compile="$CC $CFLAGS $CPPFLAGS -c conftest.c >&AC_FD_CC 2>&1"
421 if AC_TRY_EVAL(mpfr_compile); then
422 cat >conftest.awk <<\EOF
423 [
424 BEGIN {
425 found = 0
426 }
427
428 # got[] holds a sliding window of bytes read the input. got[0] is the most
429 # recent byte read, and got[31] the oldest byte read, so when looking to
430 # match some data the indices are "reversed".
431 #
432 {
433 for (f = 2; f <= NF; f++)
434 {
435 # new byte, shift others up
436 for (i = 31; i >= 0; i--)
437 got[i+1] = got[i];
438 got[0] = $f;
439
440 # end sequence
441 if (got[7] != "376") continue
442 if (got[6] != "334") continue
443 if (got[5] != "272") continue
444 if (got[4] != "230") continue
445 if (got[3] != "166") continue
446 if (got[2] != "124") continue
447 if (got[1] != "062") continue
448 if (got[0] != "020") continue
449
450 # start sequence, with 12-byte body
451 if (got[27] == "001" && \
452 got[26] == "043" && \
453 got[25] == "105" && \
454 got[24] == "147" && \
455 got[23] == "211" && \
456 got[22] == "253" && \
457 got[21] == "315" && \
458 got[20] == "357")
459 {
460 saw = " (" got[19] \
461 " " got[18] \
462 " " got[17] \
463 " " got[16] \
464 " " got[15] \
465 " " got[14] \
466 " " got[13] \
467 " " got[12] \
468 " " got[11] \
469 " " got[10] \
470 " " got[9] \
471 " " got[8] ")"
472
473 if (got[19] == "000" && \
474 got[18] == "000" && \
475 got[17] == "000" && \
476 got[16] == "000" && \
477 got[15] == "240" && \
478 got[14] == "242" && \
479 got[13] == "171" && \
480 got[12] == "353" && \
481 got[11] == "031" && \
482 got[10] == "300")
483 {
484 print "IEEE extended, little endian"
485 found = 1
486 exit
487 }
488 }
489
490 # start sequence, with 16-byte body
491 if (got[31] == "001" && \
492 got[30] == "043" && \
493 got[29] == "105" && \
494 got[28] == "147" && \
495 got[27] == "211" && \
496 got[26] == "253" && \
497 got[25] == "315" && \
498 got[24] == "357")
499 {
500 saw = " (" got[23] \
501 " " got[22] \
502 " " got[21] \
503 " " got[20] \
504 " " got[19] \
505 " " got[18] \
506 " " got[17] \
507 " " got[16] \
508 " " got[15] \
509 " " got[14] \
510 " " got[13] \
511 " " got[12] \
512 " " got[11] \
513 " " got[10] \
514 " " got[9] \
515 " " got[8] ")"
516
517 if (got[23] == "000" && \
518 got[22] == "000" && \
519 got[21] == "000" && \
520 got[20] == "000" && \
521 got[19] == "240" && \
522 got[18] == "242" && \
523 got[17] == "171" && \
524 got[16] == "353" && \
525 got[15] == "031" && \
526 got[14] == "300")
527 {
528 print "IEEE extended, little endian"
529 found = 1
530 exit
531 }
532
533 if (got[23] == "300" && \
534 got[22] == "031" && \
535 got[21] == "326" && \
536 got[20] == "363" && \
537 got[19] == "105" && \
538 got[18] == "100" && \
539 got[17] == "000" && \
540 got[16] == "000" && \
541 got[15] == "000" && \
542 got[14] == "000" && \
543 got[13] == "000" && \
544 got[12] == "000" && \
545 got[11] == "000" && \
546 got[10] == "000" && \
547 got[9] == "000" && \
548 got[8] == "000")
549 {
550 print "IEEE quad, big endian"
551 found = 1
552 exit
553 }
554 }
555 }
556 }
557
558 END {
559 if (! found)
560 print "unknown", saw
561 }
562 ]
563 EOF
564 mpfr_cv_c_long_double_format=`od -b conftest.$OBJEXT | $AWK -f conftest.awk`
565 case $mpfr_cv_c_long_double_format in
566 unknown*)
567 echo "cannot match anything, conftest.$OBJEXT contains" >&AC_FD_CC
568 od -b conftest.$OBJEXT >&AC_FD_CC
569 ;;
570 esac
571 else
572 AC_MSG_WARN([oops, cannot compile test program])
573 fi
574 fi
575 rm -f conftest*
576 ])
577
578 AH_VERBATIM([HAVE_LDOUBLE],
579 [/* Define one of the following to 1 for the format of a `long double'.
580 If your format is not among these choices, or you don't know what it is,
581 then leave all undefined.
582 IEEE_EXT is the 10-byte IEEE extended precision format.
583 IEEE_QUAD is the 16-byte IEEE quadruple precision format.
584 LITTLE or BIG is the endianness. */
585 #undef HAVE_LDOUBLE_IEEE_EXT_LITTLE
586 #undef HAVE_LDOUBLE_IEEE_QUAD_BIG])
587
588 case $mpfr_cv_c_long_double_format in
589 "IEEE extended, little endian")
590 AC_DEFINE(HAVE_LDOUBLE_IEEE_EXT_LITTLE, 1)
591 ;;
592 "IEEE quad, big endian")
593 AC_DEFINE(HAVE_LDOUBLE_IEEE_QUAD_BIG, 1)
594 ;;
595 unknown* | "not available")
596 ;;
597 *)
598 AC_MSG_WARN([oops, unrecognised float format: $mpfr_cv_c_long_double_format] )
599 ;;
600 esac
601 ])
602
603
604 dnl MPFR_CHECK_LIBM
605 dnl ---------------
606 dnl Determine a math library -lm to use.
607
608 AC_DEFUN([MPFR_CHECK_LIBM],
609 [AC_REQUIRE([AC_CANONICAL_HOST])
610 AC_SUBST(MPFR_LIBM,'')
611 case $host in
612 *-*-beos* | *-*-cygwin* | *-*-pw32*)
613 # According to libtool AC CHECK LIBM, these systems don't have libm
614 ;;
615 *-*-hpux*)
616 # -lM means something subtly different to -lm, SVID style error handling
617 # or something. FIXME: Why exactly do we want this?
618 AC_CHECK_LIB(M, main, MPFR_LIBM="-lM")
619 ;;
620 *-*-solaris*)
621 # On Solaris the math functions new in C99 are in -lm9x.
622 # FIXME: Do we need -lm9x as well as -lm, or just instead of?
623 AC_CHECK_LIB(m9x, main, MPFR_LIBM="-lm9x")
624 AC_CHECK_LIB(m, main, MPFR_LIBM="$MPFR_LIBM -lm")
625 ;;
626 *-ncr-sysv4.3*)
627 # FIXME: What does -lmw mean? Libtool AC CHECK LIBM does it this way.
628 AC_CHECK_LIB(mw, _mwvalidcheckl, MPFR_LIBM="-lmw")
629 AC_CHECK_LIB(m, main, MPFR_LIBM="$MPFR_LIBM -lm")
630 ;;
631 *)
632 AC_CHECK_LIB(m, main, MPFR_LIBM="-lm")
633 ;;
634 esac
635 ])
636
637
638 dnl MPFR_LD_SEARCH_PATHS_FIRST
639 dnl --------------------------
640
641 AC_DEFUN([MPFR_LD_SEARCH_PATHS_FIRST],
642 [case "$LD $LDFLAGS" in
643 *-Wl,-search_paths_first*) ;;
644 *) AC_MSG_CHECKING([if the compiler understands -Wl,-search_paths_first])
645 saved_LDFLAGS="$LDFLAGS"
646 LDFLAGS="-Wl,-search_paths_first $LDFLAGS"
647 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
648 [AC_MSG_RESULT(yes)],
649 [AC_MSG_RESULT(no)]
650 LDFLAGS="$saved_LDFLAGS")
651 ;;
652 esac
653 ])
654
655
656 dnl GMP_C_ATTRIBUTE_MODE
657 dnl --------------------
658 dnl Introduced in gcc 2.2, but perhaps not in all Apple derived versions.
659 dnl Needed for mpfr-longlong.h; this is currently necessary for s390.
660 dnl
661 dnl TODO: Replace this with a cleaner type size detection, as this
662 dnl solution only works with gcc and assumes CHAR_BIT == 8. Probably use
663 dnl <stdint.h>, and <http://gcc.gnu.org/viewcvs/trunk/config/stdint.m4>
664 dnl as a fallback.
665
666 AC_DEFUN([GMP_C_ATTRIBUTE_MODE],
667 [AC_CACHE_CHECK([whether gcc __attribute__ ((mode (XX))) works],
668 gmp_cv_c_attribute_mode,
669 [AC_TRY_COMPILE([typedef int SItype __attribute__ ((mode (SI)));], ,
670 gmp_cv_c_attribute_mode=yes, gmp_cv_c_attribute_mode=no)
671 ])
672 if test $gmp_cv_c_attribute_mode = yes; then
673 AC_DEFINE(HAVE_ATTRIBUTE_MODE, 1,
674 [Define to 1 if the compiler accepts gcc style __attribute__ ((mode (XX)))])
675 fi
676 ])
677
678
679 dnl MPFR_FUNC_PRINTF_SPEC
680 dnl ------------------------------------
681 dnl MPFR_FUNC_PRINTF_SPEC(spec, type, [includes], [lib-prefix], [if-true], [if- false])
682 dnl Check if printf supports the conversion specification 'spec'
683 dnl with type 'type'.
684 dnl Expand 'if-true' if printf supports 'spec', 'if-false' otherwise.
685
686 AC_DEFUN([MPFR_FUNC_PRINTF_SPEC],[
687 AC_MSG_CHECKING(if $4printf supports "$1")
688 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
689 #include <stdio.h>
690 $3
691 ]], [[
692 char s[256];
693 $2 a = 0;
694 return ($4sprintf (s, "$1", a) != 1) ? 1 : 0;
695 ]])],
696 [AC_MSG_RESULT(yes)
697 $5],
698 [AC_MSG_RESULT(no)
699 $6])
700 ])
701
702
703 dnl MPFR_CHECK_PRINTF_SPEC
704 dnl ----------------------
705 dnl Check if libc printf and gmp_printf support some optional length
706 dnl modifiers.
707 dnl Defined symbols are negative to shorten the gcc command line.
708
709 AC_DEFUN([MPFR_CHECK_PRINTF_SPEC], [
710 AC_REQUIRE([MPFR_CONFIGS])dnl
711 if test "$ac_cv_type_intmax_t" == yes; then
712 MPFR_FUNC_PRINTF_SPEC([%jd], [intmax_t], [
713 #ifdef HAVE_STDINT_H
714 # include <stdint.h>
715 #endif
716 #ifdef HAVE_INTTYPES_H
717 # include <inttypes.h>
718 #endif
719
720 #include <gmp.h>
721 ], [gmp_],,
722 [AC_DEFINE([NPRINTF_J], 1, [gmp_printf cannot read intmax_t])])
723 fi
724
725 MPFR_FUNC_PRINTF_SPEC([%hhd], [char], [
726 #include <gmp.h>
727 ], [gmp_],,
728 [AC_DEFINE([NPRINTF_HH], 1, [gmp_printf cannot use 'hh' length modifier ])])
729
730 MPFR_FUNC_PRINTF_SPEC([%lld], [long long int], [
731 #include <gmp.h>
732 ], [gmp_],,
733 [AC_DEFINE([NPRINTF_LL], 1, [gmp_printf cannot read long long int])])
734
735 MPFR_FUNC_PRINTF_SPEC([%.0Lf], [long double], [
736 #include <gmp.h>
737 ], [gmp_],,
738 [AC_DEFINE([NPRINTF_L], 1, [gmp_printf cannot read long double])])
739
740 MPFR_FUNC_PRINTF_SPEC([%td], [ptrdiff_t], [
741 #if defined (__cplusplus)
742 #include <cstddef>
743 #else
744 #include <stddef.h>
745 #endif
746 #include "gmp.h"
747 ], [gmp_],,
748 [AC_DEFINE([NPRINTF_T], 1, [gmp_printf cannot read ptrdiff_t])])
749 ])
OLDNEW
« no previous file with comments | « gcc/mpfr/PATCHES ('k') | gcc/mpfr/acos.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698